Package java.util

Examples of java.util.ListIterator.previousIndex()


        for(int i=0;i<list.size();i++) {
            // walk forward i
            for(int j=0;j<i;j++) {
                assertEquals(expected.nextIndex(),testing.nextIndex());
                assertEquals(expected.previousIndex(),testing.previousIndex());
                assertTrue(expected.hasNext()); // if this one fails we've got a logic error in the test
                assertTrue(testing.hasNext());
                assertEquals(expected.next(),testing.next());
            }
            // walk back i/2
View Full Code Here


                assertEquals(expected.next(),testing.next());
            }
            // walk back i/2
            for(int j=0;j<i/2;j++) {
                assertEquals(expected.nextIndex(),testing.nextIndex());
                assertEquals(expected.previousIndex(),testing.previousIndex());
                assertTrue(expected.hasPrevious()); // if this one fails we've got a logic error in the test
                assertTrue(testing.hasPrevious());
                assertEquals(expected.previous(),testing.previous());
            }
            // walk foward i/2
View Full Code Here

                assertEquals(expected.previous(),testing.previous());
            }
            // walk foward i/2
            for(int j=0;j<i/2;j++) {
                assertEquals(expected.nextIndex(),testing.nextIndex());
                assertEquals(expected.previousIndex(),testing.previousIndex());
                assertTrue(expected.hasNext()); // if this one fails we've got a logic error in the test
                assertTrue(testing.hasNext());
                assertEquals(expected.next(),testing.next());
            }
            // walk back i
View Full Code Here

                assertEquals(expected.next(),testing.next());
            }
            // walk back i
            for(int j=0;j<i;j++) {
                assertEquals(expected.nextIndex(),testing.nextIndex());
                assertEquals(expected.previousIndex(),testing.previousIndex());
                assertTrue(expected.hasPrevious()); // if this one fails we've got a logic error in the test
                assertTrue(testing.hasPrevious());
                assertEquals(expected.previous(),testing.previous());
            }
        }
View Full Code Here

                if(expected.hasPrevious()) {
                    assertEquals(walkdescr.toString(),expected.previous(),testing.previous());
                }
            }
            assertEquals(walkdescr.toString(),expected.nextIndex(),testing.nextIndex());
            assertEquals(walkdescr.toString(),expected.previousIndex(),testing.previousIndex());
        }

    }

}
View Full Code Here

        tryToAdd(list,"element5");
        Object[] values = list.toArray();
        ListIterator iter = list.listIterator();
        for(int i=0;i<values.length;i++) {
            assertEquals("nextIndex should be " + i,i,iter.nextIndex());
            assertEquals("previousIndex should be " + (i-1),i-1,iter.previousIndex());
            assertEquals(values[i],iter.next());
        }
        assertTrue(!iter.hasNext());
        for(int i=values.length-1;i>=0;i--) {
            assertEquals("previousIndex should be " + i,i,iter.previousIndex());
View Full Code Here

            assertEquals("previousIndex should be " + (i-1),i-1,iter.previousIndex());
            assertEquals(values[i],iter.next());
        }
        assertTrue(!iter.hasNext());
        for(int i=values.length-1;i>=0;i--) {
            assertEquals("previousIndex should be " + i,i,iter.previousIndex());
            assertEquals("nextIndex should be " + (i+1),i+1,iter.nextIndex());
            assertEquals(values[i],iter.previous());
        }
    }
View Full Code Here

            public int nextIndex() {
                return listIterator.nextIndex();
            }

            public int previousIndex() {
                return listIterator.previousIndex();
            }

            public void remove() {
                invalidateIndex();
                listIterator.remove();
View Full Code Here

            firstElement = (KnuthElement) currParIterator.next();
            //
            if (firstElement.getLayoutManager() != currLM) {
                currLM = (InlineLevelLayoutManager) firstElement.getLayoutManager();
                if (currLM != null) {
                    updateList.add(new Update(currLM, currParIterator.previousIndex()));
                } else {
                    break;
                }
            } else if (currLM == null) {
                break;
View Full Code Here

                    nextElement = (KnuthElement) currParIterator.next();
                    if (nextElement.isBox() && !nextElement.isAuxiliary()) {
                        // a non-auxiliary KnuthBox: append word chars
                        if (currLM != nextElement.getLayoutManager()) {
                            currLM = (InlineLevelLayoutManager) nextElement.getLayoutManager();
                            updateList.add(new Update(currLM, currParIterator.previousIndex()));
                        }
                        // append text to recreate the whole word
                        boxCount++;
                        currLM.getWordChars(sbChars, nextElement.getPosition());
                    } else if (!nextElement.isAuxiliary()) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.