1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.view.facelets.tag.jstl.core; |
20 | |
|
21 | |
import java.io.Serializable; |
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
public final class IterationStatus implements Serializable |
28 | |
{ |
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
private static final long serialVersionUID = 1L; |
34 | |
|
35 | |
private final int index; |
36 | |
|
37 | |
private final boolean first; |
38 | |
|
39 | |
private final boolean last; |
40 | |
|
41 | |
private final Integer begin; |
42 | |
|
43 | |
private final Integer end; |
44 | |
|
45 | |
private final Integer step; |
46 | |
|
47 | |
private final Object value; |
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
public IterationStatus(boolean first, boolean last, int index, Integer begin, Integer end, |
53 | |
Integer step, Object value) |
54 | 0 | { |
55 | 0 | this.index = index; |
56 | 0 | this.begin = begin; |
57 | 0 | this.end = end; |
58 | 0 | this.step = step; |
59 | 0 | this.first = first; |
60 | 0 | this.last = last; |
61 | 0 | this.value = value; |
62 | 0 | } |
63 | |
|
64 | |
public boolean isFirst() |
65 | |
{ |
66 | 0 | return this.first; |
67 | |
} |
68 | |
|
69 | |
public boolean isLast() |
70 | |
{ |
71 | 0 | return this.last; |
72 | |
} |
73 | |
|
74 | |
public Integer getBegin() |
75 | |
{ |
76 | 0 | return begin; |
77 | |
} |
78 | |
|
79 | |
public Integer getCount() |
80 | |
{ |
81 | 0 | if ((step == null) || (step == 1)) |
82 | |
{ |
83 | 0 | return (index + 1); |
84 | |
} |
85 | |
|
86 | 0 | return ((index / step) + 1); |
87 | |
} |
88 | |
|
89 | |
public Object getCurrent() |
90 | |
{ |
91 | 0 | return value; |
92 | |
} |
93 | |
|
94 | |
public Integer getEnd() |
95 | |
{ |
96 | 0 | return end; |
97 | |
} |
98 | |
|
99 | |
public int getIndex() |
100 | |
{ |
101 | 0 | return index; |
102 | |
} |
103 | |
|
104 | |
public Integer getStep() |
105 | |
{ |
106 | 0 | return step; |
107 | |
} |
108 | |
|
109 | |
} |