Example usage for java.util Stack peek

List of usage examples for java.util Stack peek

Introduction

In this page you can find the example usage for java.util Stack peek.

Prototype

public synchronized E peek() 

Source Link

Document

Looks at the object at the top of this stack without removing it from the stack.

Usage

From source file:org.apache.tajo.engine.planner.PhysicalPlannerImpl.java

public PhysicalExec createScanPlan(TaskAttemptContext ctx, ScanNode scanNode, Stack<LogicalNode> node)
        throws IOException {
    // check if an input is sorted in the same order to the subsequence sort operator.
    if (checkIfSortEquivalance(ctx, scanNode, node)) {
        if (ctx.getTable(scanNode.getCanonicalName()) == null) {
            return new SeqScanExec(ctx, scanNode, null);
        }//from  w  w  w.  jav  a2 s.  c  o  m
        FragmentProto[] fragments = ctx.getTables(scanNode.getCanonicalName());
        return new ExternalSortExec(ctx, (SortNode) node.peek(), scanNode, fragments);
    } else {
        Enforcer enforcer = ctx.getEnforcer();

        // check if this table is broadcasted one or not.
        boolean broadcastFlag = false;
        if (enforcer != null && enforcer.hasEnforceProperty(EnforceType.BROADCAST)) {
            List<EnforceProperty> properties = enforcer.getEnforceProperties(EnforceType.BROADCAST);
            for (EnforceProperty property : properties) {
                broadcastFlag |= scanNode.getCanonicalName().equals(property.getBroadcast().getTableName());
            }
        }

        if (scanNode instanceof PartitionedTableScanNode
                && ((PartitionedTableScanNode) scanNode).getInputPaths() != null
                && ((PartitionedTableScanNode) scanNode).getInputPaths().length > 0) {

            if (broadcastFlag) {
                PartitionedTableScanNode partitionedTableScanNode = (PartitionedTableScanNode) scanNode;
                List<Fragment> fileFragments = new ArrayList<>();

                FileTablespace space = TablespaceManager.get(scanNode.getTableDesc().getUri());
                for (Path path : partitionedTableScanNode.getInputPaths()) {
                    fileFragments.addAll(Arrays.asList(space.split(scanNode.getCanonicalName(), path)));
                }

                FragmentProto[] fragments = FragmentConvertor.toFragmentProtoArray(conf,
                        fileFragments.toArray(new Fragment[fileFragments.size()]));

                ctx.addFragments(scanNode.getCanonicalName(), fragments);
                return new PartitionMergeScanExec(ctx, scanNode, fragments);
            }
        }

        if (ctx.getTable(scanNode.getCanonicalName()) == null) {
            return new SeqScanExec(ctx, scanNode, null);
        }
        FragmentProto[] fragments = ctx.getTables(scanNode.getCanonicalName());
        return new SeqScanExec(ctx, scanNode, fragments);
    }
}

From source file:aula1.Aula1.java

public static String conversor(String entrada, String info) throws Exception {
    Pilha<String> input = new Pilha<>();
    Pilha<String> simbolos = new Pilha<>();
    Stack<Op> operadores = new Stack<>();
    Pilha<String> saida = new Pilha<>();
    String[] operadoresSuportados = { "+", "-", "*", "/", "^", "(", ")", "sen" };

    for (int i = 0; i < entrada.length(); i++) {
        String s = "";
        try {/*from ww w . j a  va2  s.com*/
            if (Character.isDigit(entrada.charAt(i))) {
                s = String.valueOf(entrada.charAt(i));
                while (Character.isDigit(entrada.charAt(i + 1))) {
                    s += String.valueOf(entrada.charAt(i + 1));
                    i++;
                }
            } else {
                if (entrada.charAt(i) == 's' && entrada.contains("sen")) {
                    int ind = entrada.indexOf("sen");
                    String ent = entrada.substring(ind);
                    int ini = ent.indexOf("sen(") + 4;
                    int fim = ent.indexOf(")/");
                    CharSequence x = ent.subSequence(ini, fim);
                    if (entrada.contains("sen(" + x + ")/" + x)) {
                        entrada = entrada.replace("sen(" + x + ")/" + x, "1");
                        s = "1";
                    } else {
                        ind += 2;
                        i = -1;
                        entrada = entrada.substring(ind + 1);
                        if (entrada.charAt(0) != '(')
                            throw new Exception("Falta de '(' aps sen");
                        s = "sen";
                    }
                } else
                    s = String.valueOf(entrada.charAt(i));
            }
            simbolos.push(s);
            input.push(s);
        } catch (IndexOutOfBoundsException ex) {
            s = String.valueOf(entrada.charAt(i));
            simbolos.push(s);
            input.push(s);
        }
    }
    while (!simbolos.isEMpty()) {
        String simbolo = simbolos.pop();

        if (Character.isDigit(simbolo.charAt(0)) || simbolo.charAt(0) == 'x')
            saida.push(simbolo);
        else if (Arrays.asList(operadoresSuportados).contains(simbolo)) {
            Op operador = new Op(simbolo);
            Op topOperador;
            try {
                topOperador = operadores.peek();
            } catch (EmptyStackException e) {
                topOperador = null;
            }
            if (simbolo.equals(")")) {
                while (topOperador != null && !topOperador.op().equals("(")) {
                    saida.push(topOperador.op());
                    operadores.pop();
                    topOperador = operadores.peek();
                }
                operadores.pop();
            } else if (simbolo.equals("(")) {
                operadores.push(operador);
            } else {
                while (topOperador != null && topOperador.Precedencia() > operador.Precedencia()) {
                    saida.push(topOperador.op());
                    operadores.pop();
                    try {
                        topOperador = operadores.peek();
                    } catch (EmptyStackException e) {
                        topOperador = null;
                    }
                }
                operadores.push(operador);
            }
        }
    }
    while (!operadores.isEmpty()) {
        Op operador = operadores.pop();
        saida.push(operador.op());
    }
    String resultado = "";
    for (String s : saida) {
        System.out.println("saida: " + s);
        resultado += s + " ";
    }
    resultado = calculaPolonesaINversa(resultado, info);
    return resultado;

}

From source file:org.seasar.mayaa.impl.builder.TemplateBuilderImpl.java

protected TemplateProcessor resolveInjectedNode(Template template, Stack stack, SpecificationNode original,
        SpecificationNode injected, Set divided) {
    if (injected == null) {
        throw new IllegalArgumentException();
    }// www.  j  av a2s .c  o m
    saveToCycle(original, injected);
    TemplateProcessor processor = createProcessor(original, injected);
    if (processor == null) {
        PrefixMapping mapping = original.getMappingFromPrefix("", true);
        if (mapping == null) {
            throw new IllegalStateException();
        }
        URI defaultURI = mapping.getNamespaceURI();
        if (defaultURI.equals(injected.getQName().getNamespaceURI())) {
            InjectionChain chain = getDefaultInjectionChain();
            SpecificationNode retry = chain.getNode(injected);
            processor = createProcessor(original, retry);
        }
        if (processor == null) {
            throw new ProcessorNotInjectedException(injected.toString());
        }
    }
    ProcessorTreeWalker parent = (ProcessorTreeWalker) stack.peek();
    parent.addChildProcessor(processor);
    processor.initialize();
    Iterator it = injected.iterateChildNode();
    if (it.hasNext() == false) {
        return processor;
    }
    // "injected" node has children, nested node definition on .mayaa
    stack.push(processor);
    while (it.hasNext()) {
        SpecificationNode childNode = (SpecificationNode) it.next();
        saveToCycle(original, childNode);
        TemplateProcessor childProcessor = resolveInjectedNode(template, stack, original, childNode, divided);
        if (childProcessor instanceof DoBodyProcessor) {
            stack.push(childProcessor);
            walkParsedTree(template, stack, original, divided);
            stack.pop();
        }
    }
    stack.pop();
    saveToCycle(original, injected);
    return findConnectPoint(processor);
}

From source file:com.hippo.vectorold.drawable.VectorDrawable.java

private void inflateInternal(Resources res, XmlPullParser parser, AttributeSet attrs)
        throws XmlPullParserException, IOException {
    final VectorDrawableState state = mVectorState;
    final VPathRenderer pathRenderer = state.mVPathRenderer;
    boolean noPathTag = true;

    // Use a stack to help to build the group tree.
    // The top of the stack is always the current group.
    final Stack<VGroup> groupStack = new Stack<VGroup>();
    groupStack.push(pathRenderer.mRootGroup);

    int eventType = parser.getEventType();
    while (eventType != XmlPullParser.END_DOCUMENT) {
        if (eventType == XmlPullParser.START_TAG) {
            final String tagName = parser.getName();
            final VGroup currentGroup = groupStack.peek();

            if (SHAPE_PATH.equals(tagName)) {
                final VFullPath path = new VFullPath();
                path.inflate(res, attrs);
                currentGroup.mChildren.add(path);
                if (path.getPathName() != null) {
                    pathRenderer.mVGTargetsMap.put(path.getPathName(), path);
                }//w  ww.j  a  v a  2 s.c o m
                noPathTag = false;
                state.mChangingConfigurations |= path.mChangingConfigurations;
            } else if (SHAPE_CLIP_PATH.equals(tagName)) {
                final VClipPath path = new VClipPath();
                path.inflate(res, attrs);
                currentGroup.mChildren.add(path);
                if (path.getPathName() != null) {
                    pathRenderer.mVGTargetsMap.put(path.getPathName(), path);
                }
                state.mChangingConfigurations |= path.mChangingConfigurations;
            } else if (SHAPE_GROUP.equals(tagName)) {
                VGroup newChildGroup = new VGroup();
                newChildGroup.inflate(res, attrs);
                currentGroup.mChildren.add(newChildGroup);
                groupStack.push(newChildGroup);
                if (newChildGroup.getGroupName() != null) {
                    pathRenderer.mVGTargetsMap.put(newChildGroup.getGroupName(), newChildGroup);
                }
                state.mChangingConfigurations |= newChildGroup.mChangingConfigurations;
            }
        } else if (eventType == XmlPullParser.END_TAG) {
            final String tagName = parser.getName();
            if (SHAPE_GROUP.equals(tagName)) {
                groupStack.pop();
            }
        }
        eventType = parser.next();
    }

    // Print the tree out for debug.
    if (DBG_VECTOR_DRAWABLE) {
        printGroupTree(pathRenderer.mRootGroup, 0);
    }

    if (noPathTag) {
        final StringBuffer tag = new StringBuffer();

        if (tag.length() > 0) {
            tag.append(" or ");
        }
        tag.append(SHAPE_PATH);

        throw new XmlPullParserException("no " + tag + " defined");
    }
}

From source file:org.docx4j.fonts.fop.fonts.type1.AFMParser.java

private String parseCharMetrics(String line, Stack stack) throws IOException {
    int startpos = 0;
    AFMCharMetrics chm = new AFMCharMetrics();
    stack.push(chm);/*from   w  w  w  .j a  va  2  s  .  com*/
    while (true) {
        //Find key
        startpos = skipToNonWhiteSpace(line, startpos);
        int endpos = skipToWhiteSpace(line, startpos);
        String key = line.substring(startpos, endpos);
        if (END_CHAR_METRICS.equals(key)) {
            stack.pop(); //Pop and forget unused AFMCharMetrics instance
            return key;
        } else if (key.length() == 0) {
            //EOL: No more key so break
            break;
        }

        //Extract value
        startpos = skipToNonWhiteSpace(line, endpos);
        endpos = skipToSemicolon(line, startpos);
        String value = line.substring(startpos, endpos).trim();
        startpos = endpos + 1;

        //Parse value
        ValueHandler vp = (ValueHandler) VALUE_PARSERS.get(key);
        if (vp != null) {
            vp.parse(value, 0, stack);
        }
        if (false) {
            break;
        }
    }
    stack.pop();
    AFMFile afm = (AFMFile) stack.peek();
    afm.addCharMetrics(chm);
    return null;
}

From source file:org.sakaiproject.component.app.syllabus.SyllabusServiceImpl.java

public String archive(String siteId, Document doc, Stack stack, String arg3, List attachments) {

    StringBuilder results = new StringBuilder();

    try {//from www .j  a  va  2 s .  c  o  m
        int syDataCount = 0;
        results.append("archiving " + getLabel() + " context " + Entity.SEPARATOR + siteId + Entity.SEPARATOR
                + SiteService.MAIN_CONTAINER + ".\n");
        // start with an element with our very own (service) name
        Element element = doc.createElement(SyllabusService.class.getName());
        ((Element) stack.peek()).appendChild(element);
        stack.push(element);
        if (siteId != null && siteId.trim().length() > 0) {
            Element siteElement = doc.createElement(SITE_ARCHIVE);
            siteElement.setAttribute(SITE_NAME, SiteService.getSite(siteId).getId());
            siteElement.setAttribute(SITE_ID, SiteService.getSite(siteId).getTitle());
            SyllabusItem syllabusItem = syllabusManager.getSyllabusItemByContextId(siteId);
            if (syllabusItem != null) {
                Element syllabus = doc.createElement(SYLLABUS);
                syllabus.setAttribute(SYLLABUS_ID, syllabusItem.getSurrogateKey().toString());
                syllabus.setAttribute(SYLLABUS_USER_ID, syllabusItem.getUserId());
                syllabus.setAttribute(SYLLABUS_CONTEXT_ID, syllabusItem.getContextId());
                syllabus.setAttribute(SYLLABUS_REDIRECT_URL, syllabusItem.getRedirectURL());

                Set syllabi = syllabusManager.getSyllabiForSyllabusItem(syllabusItem);

                if (syllabi != null && !syllabi.isEmpty()) {
                    Iterator syllabiIter = syllabi.iterator();
                    while (syllabiIter.hasNext()) {
                        SyllabusData syllabusData = (SyllabusData) syllabiIter.next();
                        if (syllabusData != null) {
                            syDataCount++;
                            Element syllabus_data = doc.createElement(SYLLABUS_DATA);
                            syllabus_data.setAttribute(SYLLABUS_DATA_ID,
                                    syllabusData.getSyllabusId().toString());
                            syllabus_data.setAttribute(SYLLABUS_DATA_POSITION,
                                    syllabusData.getPosition().toString());
                            syllabus_data.setAttribute(SYLLABUS_DATA_TITLE, syllabusData.getTitle());
                            syllabus_data.setAttribute(SYLLABUS_DATA_VIEW, syllabusData.getView());
                            syllabus_data.setAttribute(SYLLABUS_DATA_STATUS, syllabusData.getStatus());
                            syllabus_data.setAttribute(SYLLABUS_DATA_EMAIL_NOTIFICATION,
                                    syllabusData.getEmailNotification());
                            Element asset = doc.createElement(SYLLABUS_DATA_ASSET);

                            Set<SyllabusAttachment> syllabusAttachments = syllabusManager
                                    .getSyllabusAttachmentsForSyllabusData(syllabusData);
                            for (SyllabusAttachment s : syllabusAttachments) {
                                ContentResource cr = null;
                                try {
                                    cr = contentHostingService.getResource(s.getAttachmentId());
                                } catch (PermissionException e) {
                                    logger.warn("Permission error fetching resource: " + s.getAttachmentId());
                                } catch (TypeException e) {
                                    logger.warn(
                                            "TypeException error fetching resource: " + s.getAttachmentId());
                                }

                                if (cr != null) {
                                    Reference ref = entityManager.newReference(cr.getReference());
                                    attachments.add(ref);
                                    Element a = doc.createElement("attachment");
                                    syllabus_data.appendChild(a);
                                    a.setAttribute("relative-url", ref.getReference());
                                }
                            }

                            try {
                                String encoded = new String(
                                        Base64.encodeBase64(syllabusData.getAsset().getBytes()), "UTF-8");
                                asset.setAttribute("syllabus_body-html", encoded);
                            } catch (Exception e) {
                                logger.warn("Encode Syllabus - " + e);
                            }

                            syllabus_data.appendChild(asset);
                            syllabus.appendChild(syllabus_data);

                        }
                    }

                    siteElement.appendChild(syllabus);
                }
                results.append("archiving " + getLabel() + ": (" + syDataCount
                        + ") syllabys items archived successfully.\n");
            } else {
                results.append("archiving " + getLabel() + ": empty syllabus archived.\n");
            }
            ((Element) stack.peek()).appendChild(siteElement);
            stack.push(siteElement);
        }
        stack.pop();

    } catch (DOMException e) {
        logger.error(e.getMessage(), e);
    } catch (IdUnusedException e) {
        logger.error(e.getMessage(), e);
    }
    return results.toString();
}

From source file:org.apache.zeppelin.sap.universe.UniverseUtil.java

private String parseWhere(String where, Map<String, UniverseNodeInfo> nodeInfos) throws UniverseException {
    List<String> out = new ArrayList<>();
    Stack<String> stack = new Stack<>();

    where = where.replaceAll("\\s*", "");

    Set<String> operationSymbols = new HashSet<>(OPERATIONS.keySet());
    operationSymbols.add(LEFT_BRACE);/*from   w w  w  .  j  ava2 s .c o m*/
    operationSymbols.add(RIGHT_BRACE);

    int index = 0;

    boolean findNext = true;
    while (findNext) {
        int nextOperationIndex = where.length();
        String nextOperation = "";
        for (String operation : operationSymbols) {
            int i = where.indexOf(operation, index);
            if (i >= 0 && i < nextOperationIndex) {
                nextOperation = operation;
                nextOperationIndex = i;
            }
        }
        if (nextOperationIndex == where.length()) {
            findNext = false;
        } else {
            if (index != nextOperationIndex) {
                out.add(where.substring(index, nextOperationIndex));
            }
            if (nextOperation.equals(LEFT_BRACE)) {
                stack.push(nextOperation);
            } else if (nextOperation.equals(RIGHT_BRACE)) {
                while (!stack.peek().equals(LEFT_BRACE)) {
                    out.add(stack.pop());
                    if (stack.empty()) {
                        throw new UniverseException("Unmatched brackets");
                    }
                }
                stack.pop();
            } else {
                while (!stack.empty() && !stack.peek().equals(LEFT_BRACE)
                        && (OPERATIONS.get(nextOperation) >= OPERATIONS.get(stack.peek()))) {
                    out.add(stack.pop());
                }
                stack.push(nextOperation);
            }
            index = nextOperationIndex + nextOperation.length();
        }
    }
    if (index != where.length()) {
        out.add(where.substring(index));
    }
    while (!stack.empty()) {
        out.add(stack.pop());
    }
    StringBuffer result = new StringBuffer();
    if (!out.isEmpty())
        result.append(out.remove(0));
    while (!out.isEmpty())
        result.append(" ").append(out.remove(0));

    // result contains the reverse polish notation
    return convertWhereToXml(result.toString(), nodeInfos);
}

From source file:com.taobao.tdhs.jdbc.sqlparser.ParseSQL.java

private void analyzeUpdateSetColumns(String substring) {
    if (substring == null)
        return;//from   w  ww . j av  a 2s. c om

    /*String[] array_setColumn = substring.split(",");
      for (String setColumn : array_setColumn) {
      int addr = StringUtils.indexOfIgnoreCase(setColumn, "=");
      String column = setColumn.substring(0, addr).trim();
      String value = setColumn.substring(addr + 1).trim();
      this.updateEntries.add(new Entry<String, String>(column, value));
      }*/

    //Stack??
    Stack<String> updateColumnValueStack = new Stack<String>();
    for (int i = 0; i < substring.length(); i++) {
        updateColumnValueStack.push(substring.substring(i, i + 1));
    }

    String column = "";
    String value = "";
    while (updateColumnValueStack.isEmpty() == false) {
        column = "";
        value = "";
        //value String
        while (updateColumnValueStack.peek().equals("=") == false
                || checkRealEqual(updateColumnValueStack) == false) {
            value = updateColumnValueStack.pop() + value;
        }
        //=
        updateColumnValueStack.pop();
        //column String
        try {
            while (updateColumnValueStack.peek().equals(",") == false) {
                column = updateColumnValueStack.pop() + column;
            }
        } catch (EmptyStackException e) {
            //?
            this.updateEntries.add(new Entry<String, String>(column, value));
            break;
        }

        //,
        updateColumnValueStack.pop();
        //?
        this.updateEntries.add(new Entry<String, String>(column, value));
    }

}

From source file:org.etudes.component.app.melete.MeleteSecurityServiceImpl.java

/**
 * {@inheritDoc}/*from   w w  w . j  a va  2s .c o  m*/
 */
public String archive(String siteId, Document doc, Stack stack, String archivePath, List attachments) {
    logger.debug("siteid as arg in archive function is " + siteId);
    int count = 0;
    try {
        Element modulesElement = doc.createElement(MeleteSecurityService.class.getName());

        if (siteId != null && siteId.length() > 0) {
            List<Module> selectList = getModuleService().getModules(siteId);
            count = selectList.size();
            File basePackDir = new File(archivePath);
            List orgResElements = getMeleteExportService().generateOrganizationResourceItems(selectList, true,
                    basePackDir, SiteService.getSite(siteId).getTitle(), siteId);

            if (orgResElements != null && orgResElements.size() > 0) {

                String xmlstr = createdom4jtree((org.dom4j.Element) (org.dom4j.Element) orgResElements.get(0));
                // read organizations 4j document as w3c document
                org.w3c.dom.Document meletew3cDocument = Xml.readDocumentFromString(xmlstr);
                org.w3c.dom.Element meletew3cElement = (org.w3c.dom.Element) meletew3cDocument.getFirstChild();
                org.w3c.dom.Element meletew3cNewElement = (org.w3c.dom.Element) ((Element) stack.peek())
                        .getOwnerDocument().importNode(meletew3cElement, true);
                modulesElement.appendChild(meletew3cNewElement);

                // now resources document
                xmlstr = createdom4jtree((org.dom4j.Element) (org.dom4j.Element) orgResElements.get(1));

                org.w3c.dom.Document meletew3cResDocument = Xml.readDocumentFromString(xmlstr);
                org.w3c.dom.Element meletew3cElement1 = (org.w3c.dom.Element) meletew3cResDocument
                        .getFirstChild();
                org.w3c.dom.Element meletew3cNewElement1 = (org.w3c.dom.Element) ((Element) stack.peek())
                        .getOwnerDocument().importNode(meletew3cElement1, true);
                modulesElement.appendChild(meletew3cNewElement1);

                ((Element) stack.peek()).appendChild(modulesElement);
                stack.push(modulesElement);
            }
        }
        //      stack.pop();
    } catch (IdUnusedException iue) {
        logger.debug("error in melete during site archive");
        return "error archiving modules";
    } catch (Exception ex) {
        if (logger.isDebugEnabled()) {
            logger.debug("error in melete during site archive" + ex.toString());
            ex.printStackTrace();
        }
        return "error archiving modules";
    }
    return "archiving modules: (" + count + ") modules archived successfully. \n";
}

From source file:com.grottworkshop.gwsvectorsandboxlib.VectorDrawable.java

private void inflateInternal(Resources res, XmlPullParser parser, AttributeSet attrs, Theme theme)
        throws XmlPullParserException, IOException {
    final VectorDrawableState state = mVectorState;
    final VPathRenderer pathRenderer = state.mVPathRenderer;
    boolean noPathTag = true;

    // Use a stack to help to build the group tree.
    // The top of the stack is always the current group.
    final Stack<VGroup> groupStack = new Stack<VGroup>();
    groupStack.push(pathRenderer.mRootGroup);

    int eventType = parser.getEventType();
    while (eventType != XmlPullParser.END_DOCUMENT) {
        if (eventType == XmlPullParser.START_TAG) {
            final String tagName = parser.getName();
            final VGroup currentGroup = groupStack.peek();

            if (SHAPE_PATH.equals(tagName)) {
                final VFullPath path = new VFullPath();
                path.inflate(res, attrs, theme);
                currentGroup.mChildren.add(path);
                if (path.getPathName() != null) {
                    pathRenderer.mVGTargetsMap.put(path.getPathName(), path);
                }/*ww w  . ja v  a2  s  .com*/
                noPathTag = false;
                state.mChangingConfigurations |= path.mChangingConfigurations;
            } else if (SHAPE_CLIP_PATH.equals(tagName)) {
                final VClipPath path = new VClipPath();
                path.inflate(res, attrs, theme);
                currentGroup.mChildren.add(path);
                if (path.getPathName() != null) {
                    pathRenderer.mVGTargetsMap.put(path.getPathName(), path);
                }
                state.mChangingConfigurations |= path.mChangingConfigurations;
            } else if (SHAPE_GROUP.equals(tagName)) {
                VGroup newChildGroup = new VGroup();
                newChildGroup.inflate(res, attrs, theme);
                currentGroup.mChildren.add(newChildGroup);
                groupStack.push(newChildGroup);
                if (newChildGroup.getGroupName() != null) {
                    pathRenderer.mVGTargetsMap.put(newChildGroup.getGroupName(), newChildGroup);
                }
                state.mChangingConfigurations |= newChildGroup.mChangingConfigurations;
            }
        } else if (eventType == XmlPullParser.END_TAG) {
            final String tagName = parser.getName();
            if (SHAPE_GROUP.equals(tagName)) {
                groupStack.pop();
            }
        }
        eventType = parser.next();
    }

    // Print the tree out for debug.
    if (DBG_VECTOR_DRAWABLE) {
        printGroupTree(pathRenderer.mRootGroup, 0);
    }

    if (noPathTag) {
        final StringBuffer tag = new StringBuffer();

        if (tag.length() > 0) {
            tag.append(" or ");
        }
        tag.append(SHAPE_PATH);

        throw new XmlPullParserException("no " + tag + " defined");
    }
}