Examples of Stack


Examples of java.util.Stack

   private Stack getStackCloses()
   {
      if (stackCloses.get() == null)
      {
         stackCloses.set(new Stack());
      }

      return (Stack) stackCloses.get();
   }
View Full Code Here

Examples of java.util.Stack

   private Stack getStackEnters()
   {
      if (stackEnters.get() == null)
      {
         stackEnters.set(new Stack());
      }
      return (Stack) stackEnters.get();
   }
View Full Code Here

Examples of java.util.Stack

        // currentBreakPositions, move a break from possibleBreakPositions
        // to currentBreakPositions, and start over from there.  This process
        // continues in this way until we either successfully make it all the way
        // across the range, or exhaust all of our combinations of break
        // positions.)
        Stack currentBreakPositions = new Stack();
        Stack possibleBreakPositions = new Stack();
        Vector wrongBreakPositions = new Vector();

        // the dictionary is implemented as a trie, which is treated as a state
        // machine.  -1 represents the end of a legal word.  Every word in the
        // dictionary is represented by a path from the root node to -1.  A path
        // that ends in state 0 is an illegal combination of characters.
        int state = 0;

        // these two variables are used for error handling.  We keep track of the
        // farthest we've gotten through the range being divided, and the combination
        // of breaks that got us that far.  If we use up all possible break
        // combinations, the text contains an error or a word that's not in the
        // dictionary.  In this case, we "bless" the break positions that got us the
        // farthest as real break positions, and then start over from scratch with
        // the character where the error occurred.
        int farthestEndPoint = text.getIndex();
        Stack bestBreakPositions = null;

        // initialize (we always exit the loop with a break statement)
        c = getCurrent();
        while (true) {
View Full Code Here

Examples of java.util.Stack

                    nestingLevel++;

                    // Make sure we have a stack.
                    if (accumulatedClassNames == null)
                    {
                        accumulatedClassNames = new Stack();
                    }

                    // Remember the accumulated class name.
                    accumulatedClassNames.push(accumulatedClassName);
View Full Code Here

Examples of java.util.Stack

            );
      if (language != null)
      {
        allTag.put(PdfName.LANG, new PdfString(language));
      }
      tagStack = new Stack();
      tagStack.push(allTag);
    }
  }
View Full Code Here

Examples of java.util.Stack

            mBuilder.newObject(mIntArrayType);
            mBuilder.storeLocal(mPositionsLocal);

            mBuilder.loadConstant(0);
            mBuilder.storeLocal(mIndexLocal);
            mTempLocals = new Stack();
            mReturnLabel = mBuilder.createLabel();

            generateBranches(mPatternRoot, -1, 0);

            mReturnLabel.setLocation();
View Full Code Here

Examples of java.util.Stack

        if (depth == 0) {
            parseProperties(req, resources, generatedXML, path, type,
                            properties);
        } else {
            // The stack always contains the object of the current level
            Stack stack = new Stack();
            stack.push(path);

            // Stack of the objects one level below
            Stack stackBelow = new Stack();

            while ((!stack.isEmpty()) && (depth >= 0)) {

                String currentPath = (String) stack.pop();
                parseProperties(req, resources, generatedXML, currentPath,
                                type, properties);

                try {
                    object = resources.lookup(currentPath);
                } catch (NamingException e) {
                    continue;
                }

                if ((object instanceof DirContext) && (depth > 0)) {

                    try {
                        NamingEnumeration enumeration = resources.list(currentPath);
                        while (enumeration.hasMoreElements()) {
                            NameClassPair ncPair =
                                (NameClassPair) enumeration.nextElement();
                            String newPath = currentPath;
                            if (!(newPath.endsWith("/")))
                                newPath += "/";
                            newPath += ncPair.getName();
                            stackBelow.push(newPath);
                        }
                    } catch (NamingException e) {
                        resp.sendError
                            (HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
                             path);
                        return;
                    }

                    // Displaying the lock-null resources present in that
                    // collection
                    String lockPath = currentPath;
                    if (lockPath.endsWith("/"))
                        lockPath =
                            lockPath.substring(0, lockPath.length() - 1);
                    Vector currentLockNullResources =
                        (Vector) lockNullResources.get(lockPath);
                    if (currentLockNullResources != null) {
                        Enumeration lockNullResourcesList =
                            currentLockNullResources.elements();
                        while (lockNullResourcesList.hasMoreElements()) {
                            String lockNullPath = (String)
                                lockNullResourcesList.nextElement();
                            parseLockNullProperties
                                (req, generatedXML, lockNullPath, type,
                                 properties);
                        }
                    }

                }

                if (stack.isEmpty()) {
                    depth--;
                    stack = stackBelow;
                    stackBelow = new Stack();
                }

                generatedXML.sendData();

            }
View Full Code Here

Examples of java.util.Stack

    */
    public double getMaxCorr() {
      double curCorr = getCorr();
      if (isLeaf())  return curCorr;
     
      Stack remaining = new Stack();
      remaining.push(this);
      while (remaining.empty() == false) {
        TreeDrawerNode node = (TreeDrawerNode) remaining.pop();
        if (node.getCorr() > curCorr)
          curCorr = node.getCorr();

        TreeDrawerNode leftNode = node.getLeft();
        if (leftNode != null) remaining.push(leftNode);

        TreeDrawerNode rightNode = node.getRight();
        if (rightNode != null) remaining.push(rightNode);
      }
     
      return curCorr;
    }
View Full Code Here

Examples of java.util.Stack

     */
    public double getMinCorr() {
      double curCorr = getCorr();
      if (isLeaf())  return curCorr;
     
      Stack remaining = new Stack();
      remaining.push(this);
      while (remaining.empty() == false) {
        TreeDrawerNode node = (TreeDrawerNode) remaining.pop();
        if (node.getCorr() < curCorr)
          curCorr = node.getCorr();

        TreeDrawerNode leftNode = node.getLeft();
        if (leftNode != null) remaining.push(leftNode);

        TreeDrawerNode rightNode = node.getRight();
        if (rightNode != null) remaining.push(rightNode);
      }
      return curCorr;
    }
View Full Code Here

Examples of java.util.Stack

     * @param nodeid ID of the node to be found.
     * @return the node found, or null if no such node exists
     */
    public TreeDrawerNode findNode(String nodeid)
    {
      Stack remaining = new Stack();
      remaining.push(this);
      while (remaining.empty() == false) {
        TreeDrawerNode node = (TreeDrawerNode) remaining.pop();
     
        if(node.getId().equals(nodeid)) return node;

        TreeDrawerNode leftNode = node.getLeft();
        if (leftNode != null) remaining.push(leftNode);

        TreeDrawerNode rightNode = node.getRight();
        if (rightNode != null) remaining.push(rightNode);
      }
     
      return null;
     
   
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.