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.component;
20
21 import java.io.Serializable;
22
23
24
25
26
27
28
29
30
31 public final class RepeatStatus implements Serializable
32 {
33
34 private static final long serialVersionUID = 1L;
35
36 private final int count;
37
38 private final int index;
39
40 private final boolean first;
41
42 private final boolean last;
43
44 private final Integer begin;
45
46 private final Integer end;
47
48 private final Integer step;
49
50 public RepeatStatus(boolean first, boolean last, int count, int index,
51 Integer begin, Integer end, Integer step)
52 {
53 this.count = count;
54 this.index = index;
55 this.begin = begin;
56 this.end = end;
57 this.step = step;
58 this.first = first;
59 this.last = last;
60 }
61
62 public boolean isFirst()
63 {
64 return first;
65 }
66
67 public boolean isLast()
68 {
69 return last;
70 }
71
72 public boolean isEven ()
73 {
74 return ((count % 2) == 0);
75 }
76
77 public boolean isOdd ()
78 {
79 return !isEven();
80 }
81
82 public Integer getBegin()
83 {
84 if (begin == -1)
85 {
86 return null;
87 }
88
89 return begin;
90 }
91
92 public Integer getEnd()
93 {
94 if (end == -1)
95 {
96 return null;
97 }
98
99 return end;
100 }
101
102 public int getIndex()
103 {
104 return index;
105 }
106
107 public Integer getStep()
108 {
109 if (step == -1)
110 {
111 return null;
112 }
113
114 return step;
115 }
116
117 }