Package org.gephi.graph.dhns.node.iterators

Examples of org.gephi.graph.dhns.node.iterators.TreeListIterator


            AbstractNode node = new AbstractNode(i, 0, 0, 0, 0, null);
            expected.add(node);
            durableTreeList.add(node);
        }

        TreeListIterator treeListIterator = new TreeListIterator(durableTreeList);
        for (; treeListIterator.hasNext();) {
            AbstractNode node = treeListIterator.next();
            if (node.getId() == 4) {
                treeListIterator.remove();
            }
        }

        //Expected array
        List<AbstractNode> expected1 = new ArrayList<AbstractNode>();
        List<AbstractNode> actual = new ArrayList<AbstractNode>();
        for (int i = 0; i < durableTreeList.size; i++) {
            AbstractNode node = durableTreeList.get(i);
            actual.add(node);
        }
        expected1.addAll(expected);
        expected1.remove(4);
        assertArrayEquals(expected1.toArray(), actual.toArray());

        durableTreeList.remove(2);

        //Expected array
        List<AbstractNode> expected2 = new ArrayList<AbstractNode>();
        actual = new ArrayList<AbstractNode>();
        for (int i = 0; i < durableTreeList.size; i++) {
            AbstractNode node = durableTreeList.get(i);
            actual.add(node);
        }
        expected2.addAll(expected);
        expected2.remove(4);
        expected2.remove(2);
        assertArrayEquals(expected2.toArray(), actual.toArray());

        treeListIterator = new TreeListIterator(durableTreeList);
        for (; treeListIterator.hasNext();) {
            AbstractNode node = treeListIterator.next();
            if (node.getId() == 5) {
                treeListIterator.remove();
            }
        }

        durableTreeList.remove(5);
View Full Code Here

TOP

Related Classes of org.gephi.graph.dhns.node.iterators.TreeListIterator

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.