Package java.util

Examples of java.util.Stack



  public static final void destroyInstance(Thread thread)
  {
    synchronized(_context) {
      Stack stack = (Stack)_context.get(thread);
      if (stack != null && !stack.isEmpty()) {
        Context ctx = (Context)stack.pop();
      }
    }
  }
View Full Code Here


  /**
   * the draw method actually does the drawing
   */
  public void draw(TreeDrawerNode startNode) {
    Stack remaining = new Stack();
    remaining.push(startNode);
    while (remaining.empty() == false) {
      TreeDrawerNode node = (TreeDrawerNode) remaining.pop();

      // just return if no subkids visible.
      if ((node.getMaxIndex() < minInd) ||
          (node.getMinIndex() > maxInd))
        continue;
      // handle selection...
      if (node == selected) {
        if (isSelected == false) {
          isSelected = true;
          // push onto stack, so we know when we're finished with the selected subtree..
          remaining.push(selected);
        } else {
          // isSelected is true, so we're pulling the selected node off the second time.
          isSelected = false;
          continue;
        }
      }
      // lots of stack allocation...
      TreeDrawerNode left = node.getLeft();
      TreeDrawerNode right = node.getRight();
      if (left.isLeaf() == false) remaining.push(left);
      if (right.isLeaf() == false) remaining.push(right);
      // finally draw
      drawSingle(node);
    }
  }
View Full Code Here

    }

    private int printTask(Graphics g, List child) {
        int rowCount=0;
        final int h = getTree().getTreeTable().getRowHeight();
        Stack nestingStack = new Stack();
        //int x = 5;
        final int fourEmWidth = new TextLengthCalculatorImpl(g).getTextLength("mmmm");
        int y = getTree().getTable().getTableHeader().getHeight()
        + HEADER_OFFSET;
        for (Iterator tasks = child.iterator(); tasks.hasNext();) {
            DefaultMutableTreeNode nextTreeNode = (DefaultMutableTreeNode) tasks
                    .next();

            boolean blankline = nextTreeNode instanceof BlankLineNode;
            Task next = null;
            if (!blankline) {
                next = (Task) nextTreeNode.getUserObject();
                while (!nestingStack.isEmpty()) {
                  DefaultMutableTreeNode topStackNode = (DefaultMutableTreeNode) nestingStack.pop();
                  if (nextTreeNode.getParent()==topStackNode) {
                    nestingStack.push(topStackNode);
                    break;
                  }
                }
            nestingStack.push(nextTreeNode);
            }
            if (blankline || isVisible(next)) {
                if (rowCount % 2 == 1) {
                    g.setColor(new Color((float) 0.933, (float) 0.933,
                            (float) 0.933));
                    g.fillRect(0, y, getWidth() - h / 2, h);
                }
                g.setColor(Color.black);
                g.drawRect(0, y, getWidth() - h / 2, h);
                if (!blankline) {
                    int charH = (int) g.getFontMetrics().getLineMetrics(
                            next.getName(), g).getAscent();
                    int x = (nestingStack.size()-1)*fourEmWidth+5;
                    g.drawString(next.getName(), x, y + charH
                                    + (h - charH) / 2);

                }

View Full Code Here

  /**
   * the draw method actually does the drawing
   */
  public void draw(TreeDrawerNode startNode) {
    Stack remaining = new Stack();
    remaining.push(startNode);
    while (remaining.empty() == false) {
      TreeDrawerNode node = (TreeDrawerNode) remaining.pop();
      // just return if no subkids visible.
      if ((node.getMaxIndex() < minInd) ||
          (node.getMinIndex() > maxInd))
        continue;
     
      // handle selection...
      if (node == selected) {
        if (isSelected == false) {
          isSelected = true;
          // push onto stack, so we know when we're finished with the selected subtree..
          remaining.push(selected);
        } else {
          // isSelected is true, so we're pulling the selected node off the second time.
          isSelected = false;
          continue;
        }
      }
      // lots of stack allocation...
      TreeDrawerNode left = node.getLeft();
      TreeDrawerNode right = node.getRight();
      if (left.isLeaf() == false) remaining.push(left);
      if (right.isLeaf() == false) remaining.push(right);
      // finally draw
      drawSingle(node);
    }
  }
View Full Code Here

  }

  private void interateGTR(PrintStream ps, TreeDrawerNode startNode) {
    int height = (int)getYmapHeight();
    Stack remaining = new Stack();
    remaining.push(startNode);
    while (remaining.empty() == false) {
      TreeDrawerNode node = (TreeDrawerNode) remaining.pop();
      TreeDrawerNode left = node.getLeft();
      TreeDrawerNode right = node.getRight();
     
      int rx = (int) (scaleGTR * (right.getCorr() - corrGTR));
      int lx = (int) (scaleGTR * (left.getCorr() - corrGTR));
      int tx = (int) (scaleGTR * (node.getCorr() - corrGTR));
     
      int ry = getYmapPixel(right.getIndex());
      int ly = getYmapPixel(left.getIndex());
      Color color =  node.getColor();
      // setcolor
      ps.println(convertColor(color)+ " sr");
     
      ps.println(rx + " " + (height - ry) + " " + tx + " " + (height - ly) + " " + lx + " snGTR");
     
      if (left.isLeaf() == false) remaining.push(left);
      if (right.isLeaf() == false) remaining.push(right);
    }
  }
View Full Code Here

            for (Enumeration e = container.getAttributeNames(); e.hasMoreElements();) {
                String attName = (String) e.nextElement();
                sessionSet.add(attName);
            }

            Stack webflowStack = navigationManager.getWebflowStack();

            log.debug("***** Webflow stack: START *****");

            for (int i = 0; i < webflowStack.size(); i++) {
                Webflow webflow = (Webflow) webflowStack.elementAt(i);
                log.debug("Webflow " + webflow.getName() + " owns " + webflow.getOwnedObjectSet());
                sessionSet.removeAll(webflow.getOwnedObjectSet());

                Stack pageStack = webflow.getPageStack();

                for (int j = 0; j < pageStack.size(); j++) {
                    Page page = (Page) pageStack.get(j);
                    log.debug("\tpage " + page.getUrl() + " owns " + page.getOwnedObjectSet());
                    sessionSet.removeAll(page.getOwnedObjectSet());
                }
            }

View Full Code Here

            buffer1.append("<table width='100%' cellSpacing='1' cellPadding='1' bgcolor='#C0C0C0'>\n");

            StringBuffer buffer2 = new StringBuffer();
            int count = 1;

            Stack webflowStack = manager.getWebflowStack();

            for (int i = webflowStack.size() - 1; i >= 0; i--) {
                count++;

                Webflow webflow = (Webflow) webflowStack.elementAt(i);
                String wfBgColor = getColor(webflow.getName(), i);

                buffer2.append("<tr valign='bottom'><td>\n");
                buffer2.append("<table bgcolor='");
                buffer2.append(wfBgColor);
                buffer2.append("' width='100%' cellSpacing='0' cellPadding='0' border='1' bordercolor='#C0C0C0'>\n");
                buffer2.append("<tr><td align='center' bordercolor='#000000'>\n");

                buffer2.append("<table width='100%' cellSpacing='2' cellPadding='2' border='1' bordercolor='");
                buffer2.append(wfBgColor);
                buffer2.append("' >\n");

                Stack pageStack = webflow.getPageStack();

                for (int j = pageStack.size() - 1; j >= 0; j--) {
                    count++;

                    Page page = (Page) pageStack.elementAt(j);

                    buffer2.append("<tr><td align='center' bgcolor='");
                    buffer2.append(pageColor);
                    buffer2.append("' bordercolor='#000000' >\n");
                    buffer2.append("Page <b>");
View Full Code Here

    this.expressionString = expression;
  }

  public ConditionExpression(String idName) {
    this.id = idName;
    errorStack = new Stack();
    softReferences = new HashMap();
  }
View Full Code Here

    private Class defaultType;

    private StringBuffer currentText;

    public XmlCommonHandler() {
        objectStack = new Stack();
        qnameStack = new Stack();
        types = new HashMap();
    }
View Full Code Here

     */
    public StackObjectPool(PoolableObjectFactory factory, int maxIdle, int initIdleCapacity) {
        _factory = factory;
        _maxSleeping = (maxIdle < 0 ? DEFAULT_MAX_SLEEPING : maxIdle);
        int initcapacity = (initIdleCapacity < 1 ? DEFAULT_INIT_SLEEPING_CAPACITY : initIdleCapacity);
        _pool = new Stack();
        _pool.ensureCapacity( initcapacity > _maxSleeping ? _maxSleeping : initcapacity);
    }
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.