aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/layoutmgr/BreakPossPosIter.java
blob: 9d9eaf5d530970e12e86d2144f3e81eeca74caf3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * $Id$
 * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
 * For details on use and redistribution please refer to the
 * LICENSE file included with these sources.
 */

package org.apache.fop.layoutmgr;


import java.util.List;

public class BreakPossPosIter extends PositionIterator {
    private int m_iterCount ;

    public BreakPossPosIter(List bpList, int startPos, int endPos) {
        super(bpList.listIterator(startPos));
        m_iterCount = endPos - startPos;
    }

    // Check position < endPos

    protected boolean checkNext() {
        if (m_iterCount > 0) {
            return super.checkNext();
        } else {
            endIter();
            return false;
        }
    }

    public Object next() {
        --m_iterCount;
        return super.next();
    }

    public BreakPoss getBP() {
        return (BreakPoss) peekNext();
    }

    protected LayoutManager getLM(Object nextObj) {
        return ((BreakPoss) nextObj).getLayoutManager();
    }

    protected Position getPos(Object nextObj) {
        return ((BreakPoss) nextObj).getPosition();
    }

}