Code example for Stack

Methods: isEmpty, peek, pop, size

0
 
    // pop command from stack and put it to one of collections 
    @Override 
    public void endElement(String namespaceURI, String localeName, 
            String tagName) throws SAXException { 
        Command cmd = stack.pop(); 
        // cmd.setTabCount(tabCount); 
 
        // find if command works in context 
        if (!stack.isEmpty()) { 
            Command ctx = stack.peek(); 
            ctx.addChild(cmd); 
        } 
 
        // upper level commands 
        if (stack.size() == 1 && cmd.isExecutable()) { 
            commands.add(cmd); 
        } 
 
        // store reference to command 
        if (cmd.hasAttr("id")) { //$NON-NLS-1$