Package java.util

Examples of java.util.ArrayDeque$ReverseArrayDequeIterator


    });
      }
            bc.classLoaderSwitched = true;
        }

        ArrayDeque beanContextStack =
            (ArrayDeque) threadLocalContext.get();
               
        if ( beanContextStack == null ) {
            beanContextStack = new ArrayDeque();
            threadLocalContext.set(beanContextStack);
        }
        beanContextStack.push(bc);
    }
View Full Code Here


        beanContextStack.push(bc);
    }

    public void externalPostInvoke() {
        try {
          ArrayDeque beanContextStack =
                (ArrayDeque) threadLocalContext.get();
           
            final BeanContext bc = (BeanContext) beanContextStack.pop();
            if ( bc.classLoaderSwitched == true ) {
              if (System.getSecurityManager() == null) {
                Thread.currentThread().setContextClassLoader(bc.previousClassLoader);
            } else {
                java.security.AccessController.doPrivileged(
View Full Code Here

                new SequentialConditionInfo(node).split();
            }
        }

        // Search all backedge nodes.
        searchBackEdge(nodes.get(0), new ArrayDeque());

        // Resoleve all string switch blocks
        for (Node node : nodes) {
            if (node.switchy != null) {
                for (Node disposable : node.switchy.process()) {
View Full Code Here

            }

            // search exit node of this infinite loop structure (depth-first search)
            //
            // startfrom base node
            Deque<Node> candidates = new ArrayDeque(base.outgoing);

            // record accessed nodes to avoid second access
            Set<Node> recorder = new HashSet(entrance.incoming);
            recorder.add(entrance);

            while (!candidates.isEmpty()) {
                Node node = candidates.pollFirst();

                if (recorder.add(node)) {
                    if (!node.hasDominator(base)) {
                        exit = node;
                        break;
                    } else {
                        candidates.addAll(node.outgoing);
                    }
                }
            }
        }
View Full Code Here

            for (TryCatchFinally block : blocks) {
                for (Catch catchBlock : block.catches) {
                    Set<Node> recorder = new HashSet();
                    recorder.add(catchBlock.node);

                    Deque<Node> queue = new ArrayDeque();
                    queue.add(catchBlock.node);

                    while (!queue.isEmpty()) {
                        Node node = queue.pollFirst();

                        for (Node out : node.outgoing) {
                            if (out.hasDominator(catchBlock.node)) {
                                if (recorder.add(out)) {
                                    // test next node
                                    queue.add(out);
                                }
                            } else {
                                if (!out.backedges.isEmpty()) {
                                    // purge the catch block from the loop structure
                                    node.disconnect(out);
View Full Code Here

         * <p>
         * Search exit node of this try-catch-finally block.
         * </p>
         */
        private void searchExit() {
            Deque<Node> nodes = new ArrayDeque();
            nodes.addAll(catcher.outgoing); // catcher node must be first
            nodes.addAll(end.outgoing); // then end node

            Set<Node> recorder = new HashSet(nodes);

            while (!nodes.isEmpty()) {
                Node node = nodes.pollFirst();

                if (node.getDominator() == start) {
                    exit = node;
                    return;
                }

                for (Node n : node.outgoing) {
                    if (recorder.add(n)) {
                        nodes.add(n);
                    }
                }
            }
        }
View Full Code Here

    final boolean canReachTo(Node node, Node... exclusionNodes) {
        List<Node> exclusions = Arrays.asList(exclusionNodes);
        Set<Node> recorder = new HashSet();
        recorder.add(this);

        Deque<Node> queue = new ArrayDeque();
        queue.add(this);

        while (!queue.isEmpty()) {
            for (Node out : queue.pollFirst().outgoing) {
                if (out == node) {
                    return true;
                }

                if (!exclusions.contains(out) && recorder.add(out)) {
                    queue.addLast(out);
                }
            }
        }
        return false;
    }
View Full Code Here

@RunWith(ScriptRunner.class)
public class ArrayDequeTest {

    @Test
    public void peek() throws Exception {
        ArrayDeque deque = create();
        assert deque.size() == 4;
        assert deque.peek().equals("1");
        assert deque.peekFirst().equals("1");
        assert deque.peekLast().equals("4");
        assert deque.size() == 4;
    }
View Full Code Here

        assert deque.size() == 1;
    }

    @Test
    public void add() throws Exception {
        ArrayDeque deque = new ArrayDeque();
        assert deque.size() == 0;
        assert deque.add("1");
        assert deque.size() == 1;
        assert deque.peekLast().equals("1");

        assert deque.add("2");
        assert deque.size() == 2;
        assert deque.peekLast().equals("2");
    }
View Full Code Here

        assert deque.peekLast().equals("2");
    }

    @Test
    public void remove() throws Exception {
        ArrayDeque deque = create();
        assert deque.remove("1");
        assert deque.size() == 3;
        assert deque.peekFirst().equals("2");

        assert deque.remove("4");
        assert deque.size() == 2;
        assert deque.peekLast().equals("3");
    }
View Full Code Here

TOP

Related Classes of java.util.ArrayDeque$ReverseArrayDequeIterator

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.