litesoft
Diff Revisions
947
vs
948
for /trunk/Java/GWT/Client/src/org/litesoft/GWT/client/widgets/datatables/LimitingIteratorWrapper.java
|
@@ -7,42 +7,36 @@ |
7 |
7 |
|
* A proxy that enables us to limit the number of rows returned to the specified |
8 |
8 |
|
* number. |
9 |
9 |
|
*/ |
10 |
|
- |
public class LimitingIteratorWrapper<RowType> implements Iterator<RowType> |
11 |
|
- |
{ |
|
10 |
+ |
public class LimitingIteratorWrapper<RowType> implements Iterator<RowType> { |
12 |
11 |
|
private final Iterator<RowType> mImpl; |
13 |
12 |
|
private final int mMaxRows; |
14 |
13 |
|
|
15 |
14 |
|
int mCount = 0; |
16 |
15 |
|
|
17 |
|
- |
public LimitingIteratorWrapper( Iterator<RowType> pWrapped, int pMaxRows ) |
18 |
|
- |
{ |
|
16 |
+ |
public LimitingIteratorWrapper( Iterator<RowType> pWrapped, int pMaxRows ) { |
19 |
17 |
|
mImpl = pWrapped; |
20 |
18 |
|
mMaxRows = pMaxRows; |
21 |
19 |
|
} |
22 |
20 |
|
|
23 |
21 |
|
@Override |
24 |
|
- |
public boolean hasNext() |
25 |
|
- |
{ |
|
22 |
+ |
public boolean hasNext() { |
26 |
23 |
|
return mCount < mMaxRows && mImpl.hasNext(); |
27 |
24 |
|
} |
28 |
25 |
|
|
29 |
26 |
|
@Override |
30 |
|
- |
public RowType next() |
31 |
|
- |
{ |
|
27 |
+ |
public RowType next() { |
32 |
28 |
|
assert mCount < mMaxRows; |
33 |
29 |
|
mCount++; |
34 |
30 |
|
return mImpl.next(); |
35 |
31 |
|
} |
36 |
32 |
|
|
37 |
33 |
|
@Override |
38 |
|
- |
public void remove() |
39 |
|
- |
{ |
|
34 |
+ |
public void remove() { |
40 |
35 |
|
mImpl.remove(); |
41 |
36 |
|
} |
42 |
37 |
|
|
43 |
38 |
|
@Override |
44 |
|
- |
public String toString() |
45 |
|
- |
{ |
|
39 |
+ |
public String toString() { |
46 |
40 |
|
return "[maxRows=" + mMaxRows + ",iter=" + mImpl + "]"; |
47 |
41 |
|
} |
48 |
42 |
|
} |