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);
}
}
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);
}
}
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;
}
}
}
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);
}
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);
}
Aggregations