Package com.volantis.synergetics.cornerstone.stack

Examples of com.volantis.synergetics.cornerstone.stack.Stack


    }

    // Javadoc inherited.
    public DefinitionScope beginDefinitionScope(DefinitionType definitionType) {

        Stack scopeStack = (Stack) type2ScopeStack.get(definitionType);
        if (scopeStack == null) {
            scopeStack = new ArrayListStack();
            type2ScopeStack.put(definitionType, scopeStack);
        }
        DefinitionScope scope = new DefinitionScopeImpl(definitionType);
        scopeStack.push(scope);
        return scope;
    }
View Full Code Here


    // Javadoc inherited.

    public DefinitionScope getDefinitionScope(DefinitionType definitionType) {
        DefinitionScope scope = null;
        Stack scopeStack = (Stack) type2ScopeStack.get(definitionType);
        if (scopeStack != null) {
            scope = (DefinitionScope) scopeStack.peek();
        }
        return scope;
    }
View Full Code Here

        return scope;
    }

    // Javadoc inherited.
    public void endDefinitionScope(DefinitionType definitionType) {
        Stack scopeStack = (Stack) type2ScopeStack.get(definitionType);
        if (scopeStack == null || scopeStack.isEmpty()) {
            throw new IllegalArgumentException(
                    "Scope for " + definitionType + " not found");
        }
        scopeStack.pop();
        if (scopeStack.isEmpty()) {
            type2ScopeStack.remove(definitionType);
        }
    }
View Full Code Here

    private void debugNode(Node node, String message) {
        if (logger.isDebugEnabled()) {

            // Calculate the path to this element for debugging.
            Node parent = node;
            Stack stack = new ArrayListStack();
            do {
                stack.push(parent);
                parent = parent.getParent();
            } while (parent != null);

            // Remove the fake parent node if there is one.
            Node top = (Node) stack.peek();
            if (top instanceof Element && ((Element) top).getName() == null) {
                stack.pop();
            }

            StringBuffer path = new StringBuffer();
            while (!stack.isEmpty()) {
                Node pathNode = (Node) stack.pop();

                if (pathNode instanceof Element) {
                    final String name = ((Element) pathNode).getName();
                    path.append(name);
                } else {
                    path.append("(text)");
                }

                // Count the next and previous nodes
                int nextCount = 0;
                Node next = pathNode.getNext();
                while (next != null) {
                    nextCount++;
                    next = next.getNext();
                }
                int previousCount = 0;
                Node previous = pathNode.getPrevious();
                while (previous != null) {
                    previousCount++;
                    previous = previous.getPrevious();
                }
                int position = previousCount + 1;
                int total = position + nextCount;
                path.append("[").append(position).append(":").append(total)
                        .append("]");

                if (!stack.isEmpty()) {
                    path.append(" -> ");
                }
            }

            logger.debug(
View Full Code Here

TOP

Related Classes of com.volantis.synergetics.cornerstone.stack.Stack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.