Package java.util

Examples of java.util.Stack


       


        public static void push (JAASRole role)
        {
            Stack s = (Stack)local.get();

            if (s == null)
            {
                s = new Stack();
                local.set (s);
            }

            s.push (role);
        }
View Full Code Here


        }


        public static void pop ()
        {
            Stack s = (Stack)local.get();

            if ((s == null) || s.empty())
                return;

            s.pop();
        }
View Full Code Here

            s.pop();
        }

        public static JAASRole peek ()
        {
            Stack s = (Stack)local.get();
           
            if ((s == null) || (s.empty()))
                return null;
           
           
            return (JAASRole)s.peek();
        }
View Full Code Here

            return (JAASRole)s.peek();
        }
       
        public static void clear ()
        {
            Stack s = (Stack)local.get();

            if ((s == null) || (s.empty()))
                return;

            s.clear();
        }
View Full Code Here

    public XMLWriterNamespaceBase(String[] uris) {
        m_uris = uris;
        m_prefixes = new String[uris.length];
        m_prefixes[0] = "";
        m_prefixes[1] = "xml";
        m_namespaceStack = new Stack();
        m_namespaceDepth = -1;
        m_translateTableStack = new Stack();
    }
View Full Code Here

  /**
   * Return an ASCII-Art representation of the tree
   */
  public String dumpStructure() {
    return dumpStructure(new Stack());
  }
View Full Code Here

            if (g != pivot) {
                sortedGeos.add(g);
            }
        }

        Stack hullStack = new Stack();
        hullStack.push(pivot);

        Geo gCross, midCross = null;
        Geo geo = null, endGeo = null, midGeo = null;

        Iterator sortedGeoIt = sortedGeos.iterator();
        if (sortedGeoIt.hasNext()) {
            midGeo = (Geo) sortedGeoIt.next();

            while (midGeo.distance(pivot) == 0 && sortedGeoIt.hasNext()) {
                midGeo = (Geo) sortedGeoIt.next();
            }
        }

        Geo lastGeoRead = midGeo;

        while (sortedGeoIt.hasNext() && midGeo != null) {
            geo = (Geo) sortedGeoIt.next();
            double dist = geo.distance(lastGeoRead);
            if (dist <= tolerance) {
                // Debug.output("Skipping duplicate geo");
                continue;
            }

            endGeo = (Geo) hullStack.peek();

            midCross = endGeo.crossNormalize(midGeo);
            gCross = midGeo.crossNormalize(geo);
            Geo i = gCross.crossNormalize(midCross).antipode();

            // Debug.output("Evaluating:\n\tendGeo: " + endGeo + "\n\tmidGeo: "
            // + midGeo + "\n\tto " + geo
            // + "\n ****** intersection point: " + i);

            if (midGeo.distance(i) < Math.PI / 2) {
                // Debug.output("+++++++++++++ midGeo to hull");

                // left turn, OK for hull
                hullStack.push(midGeo);
                endGeo = midGeo;
                midGeo = geo;

            } else {

                // right turn, need to backtrack
                while (hullStack.size() > 1) {

                    // Debug.output("-------- midGeo dropped");

                    midGeo = (Geo) hullStack.pop();
                    endGeo = (Geo) hullStack.peek();

                    midCross = endGeo.crossNormalize(midGeo);
                    gCross = midGeo.crossNormalize(geo);
                    i = gCross.crossNormalize(midCross).antipode();

                    // Debug.output("Evaluating:\n\tendGeo: " + endGeo
                    // + "\n\tmidGeo: " + midGeo + "\n\tto " + geo
                    // + "\n ****** intersection point: " + i);

                    if (midGeo.distance(i) < Math.PI / 2) {

                        // Debug.output("+++++++++++++ midGeo to hull");

                        hullStack.push(midGeo);
                        midGeo = geo;
                        break;
                    }
                }
            }

            lastGeoRead = geo;
        }

        if (midGeo != null) {
            hullStack.push(midGeo);
        }

        hullStack.push(pivot);

        Geo[] regionGeos = new Geo[hullStack.size()];

        int i = 0;
        // Need to reverse order to get inside of poly on the right side of
        // line.
        while (!hullStack.isEmpty()) {
            regionGeos[i++] = (Geo) hullStack.pop();
        }

        return regionGeos;
    }
View Full Code Here

        }

        Stack stack;

        public DirectiveStack() {
            stack = new Stack();
        }
View Full Code Here

     */
    protected synchronized ProjHolder pop() {
        ProjHolder proj = (ProjHolder)backStack.pop();

        if (forwardStack == null) {
            forwardStack = new Stack();
        }

        while (forwardStack.size() >= stackSize) {
            forwardStack.removeElementAt(0);
        }
View Full Code Here

    protected synchronized ProjHolder backPop() {
        ProjHolder proj = (ProjHolder)forwardStack.pop();

        // This has almost no chance of happening...
        if (backStack == null) {
            backStack = new Stack();
        }

        while (backStack.size() >= stackSize) {
            backStack.removeElementAt(0);
        }
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.