Search in sources :

Example 96 with ListIterator

use of java.util.ListIterator in project groovy by apache.

the class EmptyRangeTest method testListIterator.

/**
     * Test method for {@link groovy.lang.EmptyRange#listIterator()}.
     */
public void testListIterator() {
    final ListIterator iterator = range.listIterator();
    assertFalse("iterator has next value", iterator.hasNext());
    assertFalse("iterator has previous value", iterator.hasPrevious());
    try {
        iterator.next();
        fail("got next value in an empty range");
    } catch (NoSuchElementException e) {
        assertTrue("expected exception thrown", true);
    }
}
Also used : ListIterator(java.util.ListIterator) NoSuchElementException(java.util.NoSuchElementException)

Example 97 with ListIterator

use of java.util.ListIterator in project groovy by apache.

the class EmptyRangeTest method testListIteratorInt.

/**
     * Test method for {@link groovy.lang.EmptyRange#listIterator(int)}.
     */
public void testListIteratorInt() {
    final ListIterator iterator = range.listIterator(0);
    assertFalse("iterator has next value", iterator.hasNext());
    assertFalse("iterator has previous value", iterator.hasPrevious());
    try {
        range.listIterator(1);
        fail("got list iterator at index 1");
    } catch (IndexOutOfBoundsException e) {
        assertTrue("expected exception thrown", true);
    }
}
Also used : ListIterator(java.util.ListIterator)

Example 98 with ListIterator

use of java.util.ListIterator in project processdash by dtuma.

the class CsvNodeDataImporter method tweakNodes.

private void tweakNodes(List nodes) {
    if (nodes == null)
        return;
    if (nodes.size() > 2) {
        // remove top-down estimates from non-leaf nodes
        ListIterator i = nodes.listIterator(nodes.size());
        WBSNode nextNode = (WBSNode) i.previous();
        tweakInitialsData(nextNode);
        while (i.hasPrevious()) {
            WBSNode node = (WBSNode) i.previous();
            int nodeIndent = node.getIndentLevel();
            int nextIndent = nextNode.getIndentLevel();
            if (nodeIndent < nextIndent) {
                // this node is a parent node.
                node.setAttribute(TIME_PER_PERSON_ATTR, null);
                node.setAttribute(NUM_PEOPLE_ATTR, null);
            } else {
                // this node is a leaf node.
                tweakInitialsData(node);
            }
            node.setAttribute(INITIALS_TEMP, null);
            node.setAttribute(DURATION_TEMP, null);
            nextNode = node;
        }
    }
}
Also used : ListIterator(java.util.ListIterator)

Example 99 with ListIterator

use of java.util.ListIterator in project vcell by virtualcell.

the class ListPolynomial method multiply.

public Polynomial multiply(Monomial monomial) {
    if (defined)
        throw new UnsupportedOperationException();
    if (monomial.degree() == 0)
        return this;
    if (mutable) {
        ListIterator it = content.listIterator();
        while (it.hasNext()) it.set(((Term) it.next()).multiply(monomial));
        degree += monomial.degree();
        sugar += monomial.degree();
        return this;
    } else
        return copy().multiply(monomial);
}
Also used : ListIterator(java.util.ListIterator)

Example 100 with ListIterator

use of java.util.ListIterator in project vcell by virtualcell.

the class ListPolynomial method divide.

public Polynomial divide(Generic generic) throws ArithmeticException {
    if (generic.compareTo(JSCLInteger.valueOf(1)) == 0)
        return this;
    if (mutable) {
        ListIterator it = content.listIterator();
        while (it.hasNext()) it.set(((Term) it.next()).divide(generic));
        normalized = false;
        return this;
    } else
        return copy().divide(generic);
}
Also used : ListIterator(java.util.ListIterator)

Aggregations

ListIterator (java.util.ListIterator)121 ArrayList (java.util.ArrayList)42 List (java.util.List)41 LinkedList (java.util.LinkedList)26 Iterator (java.util.Iterator)21 Map (java.util.Map)12 Handler (com.sun.jsftemplating.annotation.Handler)8 AbstractList (java.util.AbstractList)7 HashMap (java.util.HashMap)7 AbstractSequentialList (java.util.AbstractSequentialList)6 IOException (java.io.IOException)5 RandomAccess (java.util.RandomAccess)5 SelectResults (org.apache.geode.cache.query.SelectResults)5 Test (org.junit.Test)5 File (java.io.File)4 HashSet (java.util.HashSet)4 NoSuchElementException (java.util.NoSuchElementException)4 SipURI (javax.sip.address.SipURI)4 ArgumentIntKey (lucee.runtime.type.scope.ArgumentIntKey)4 StructTypeImpl (org.apache.geode.cache.query.internal.types.StructTypeImpl)4