Package java.util

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


     */
    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

     * @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

    }
   
    public Node compile(String expression)
    {
        p = new Lexer(expression);
        stack = new Stack();
        return compileExpression();
    }
View Full Code Here

    }
   
    public Node compileVariable(String expression)
    {
        p = new Lexer(expression);
        stack = new Stack();
        if (!compileIdentifier())
        {
            throw new QueryCompilerSyntaxException("expected identifier", p.getIndex(), p.getInput());
        }
        if (!compileIdentifier())
View Full Code Here

        return compileOrder(p);
    }

    public Node[] compileOrder(Lexer p)
    {
        stack = new Stack();
        return compileOrderExpression();
    }
View Full Code Here

        return compileTupple(p);
    }

    public Node[] compileTupple(Lexer p)
    {
        stack = new Stack();
        List nodes = new ArrayList();
        do
        {
            compileExpression();
            Node expr = (Node) stack.pop();
View Full Code Here

    }

    public Node[][] compileVariables(String expression)
    {
        p = new Lexer(expression);
        stack = new Stack();
        List nodes = new ArrayList();
        do
        {
            compilePrimary();
            if (stack.isEmpty())
View Full Code Here

                    FileObject[] newChildren = this.file.getChildren();
                    if (this.children != null)
                    {
                        // See which new children are not listed in the current children map.
                        Map newChildrenMap = new HashMap();
                        Stack missingChildren = new Stack();

                        for (int i = 0; i < newChildren.length; i++)
                        {
                            newChildrenMap.put(newChildren[i].getName(), new
                                Object()); // null ?
                            // If the child's not there
                            if
                            (!this.children.containsKey(newChildren[i].getName()))
                            {
                                missingChildren.push(newChildren[i]);
                            }
                        }

                        this.children = newChildrenMap;

                        // If there were missing children
                        if (!missingChildren.empty())
                        {

                            while (!missingChildren.empty())
                            {
                                FileObject child = (FileObject)
                                    missingChildren.pop();
                                this.fireAllCreate(child);
                            }
                        }

                    }
View Full Code Here

        s = s + h;
      }
    }
    else {
      // This is algorithm 1a from chapter 4.4 in Seminumerical Algorithms, slow but it works
      Stack S = new Stack();
      BigInteger base = new BigInteger(Integer.toString(rdx, rdx), rdx);
      // The sign is handled separatly.
      // Notice however that for this to work, radix 16 _MUST_ be a special case,
      // unless we want to enter a recursion well. In their infinite wisdom, why did not
      // the Sun engineers made a c'tor for BigIntegers taking a BigInteger as parameter?
      // (Answer: Becuase Sun's BigIntger is clonable, something bouncycastle's isn't.)
      BigInteger u = new BigInteger(this.abs().toString(16), 16);
      BigInteger b;

      // For speed, maye these test should look directly a u.magnitude.length?
      while (!u.equals(BigInteger.ZERO)) {
        b = u.mod(base);
        if (b.equals(BigInteger.ZERO)) {
          S.push("0");
        }
        else {
          S.push(Integer.toString(b.mag[0], rdx));
        }
        u = u.divide(base);
      }
      // Then pop the stack
      while (!S.empty()) {
        s = s + S.pop();
      }
    }
    // Strip leading zeros.
    while (s.length() > 1 && s.charAt(0) == '0') {
      s = s.substring(1);
View Full Code Here

TOP

Related Classes of java.util.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.