Package java.util

Examples of java.util.ListIterator.previous()


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

    public void testListListIteratorSet() {
        List list = makeList();
View Full Code Here


                // expected
            }
        }
        assertTrue(!iter.hasNext());
        for(int i=values.length-1;i>=0;i--) {
            iter.previous();
            try {
                iter.set(String.valueOf(i));
                values[i] = String.valueOf(i);
                assertTrue(Arrays.equals(values,list.toArray()));
            } catch(UnsupportedOperationException e) {
View Full Code Here

    ListIterator iter1 = l1.listIterator(l1.size());
    ListIterator iter2 = l2.listIterator(l2.size());

    while (iter1.hasPrevious()) {
      if (!(((String) iter1.previous().toString())
          .equals(iter2.previous().toString()))) {

        //System.out.println("ends are NOT equal.");
        return false;
      }
    }
View Full Code Here

                    li.add(be);
                    break;
                }
                BridgeExtension lbe = (BridgeExtension)li.next();
                if (lbe.getPriority() > priority) {
                    li.previous();
                    li.add(be);
                    break;
                }
            }
        }
View Full Code Here

        ListIterator paragraphsIterator
            = knuthParagraphs.listIterator(knuthParagraphs.size());
        lineLayoutsList = new ArrayList(knuthParagraphs.size());
        LineLayoutPossibilities llPoss;
        while (paragraphsIterator.hasPrevious()) {
            KnuthSequence seq = (KnuthSequence) paragraphsIterator.previous();
            if (!seq.isInlineSequence()) {
                // This set of line layout possibilities does not matter;
                // we only need an entry in lineLayoutsList.
                llPoss = new LineLayoutPossibilities();
            } else {
View Full Code Here

                        boxCount++;
                        currLM.getWordChars(sbChars, nextElement.getPosition());
                    } else if (!nextElement.isAuxiliary()) {
                        // a non-auxiliary non-box KnuthElement: stop
                        // go back to the last box or auxiliary element
                        currParIterator.previous();
                        break;
                    } else {
                        if (currLM != nextElement.getLayoutManager()) {
                            currLM = (InlineLevelLayoutManager) nextElement.getLayoutManager();
                            updateList.add(new Update(currLM, currParIterator.previousIndex()));
View Full Code Here

                HyphContext hc = getHyphenContext(sbChars);
                // ask each LM to hyphenate its word fragment
                if (hc != null) {
                    KnuthElement element = null;
                    for (int i = 0; i < (boxCount + auxCount); i++) {
                        currParIterator.previous();
                    }
                    for (int i = 0; i < (boxCount + auxCount); i++) {
                        element = (KnuthElement) currParIterator.next();
                        if (element.isBox() && !element.isAuxiliary()) {
                            ((InlineLevelLayoutManager)
View Full Code Here

            int fromIndex = currUpdate.iFirstIndex;
            int toIndex;
            if (updateListIterator.hasNext()) {
                Update nextUpdate = (Update) updateListIterator.next();
                toIndex = nextUpdate.iFirstIndex;
                updateListIterator.previous();
            } else {
                // maybe this is not always correct!
                toIndex = currPar.size() - currPar.ignoreAtEnd
                    - iAddedElements;
            }
View Full Code Here

                seqIterator = seq.listIterator(iEndElement);
                tempElement = (KnuthElement) seqIterator.next();
                if (tempElement.isGlue()) {
                    iEndElement--;
                    // this returns the same KnuthElement
                    seqIterator.previous();
                    if (seqIterator.hasPrevious()) {
                        tempElement = (KnuthElement) seqIterator.previous();
                    } else {
                        tempElement = null;
                    }
View Full Code Here

                if (tempElement.isGlue()) {
                    iEndElement--;
                    // this returns the same KnuthElement
                    seqIterator.previous();
                    if (seqIterator.hasPrevious()) {
                        tempElement = (KnuthElement) seqIterator.previous();
                    } else {
                        tempElement = null;
                    }
                }
                if (tempElement != null) {
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.