1 | void test4() {↵ | | 1 | void test() {↵
|
2 | int max = 99;↵ | | 2 | int max = 1000;↵
|
|
3 | Object[] uids = new Object[max];↵ | | 3 | Object[] uids = new Object[max];↵
|
|
4 | for (int i = 0; i < max; i++)↵ | | 4 | for (int i = 0; i < max; i++)↵
|
5 | uids[i] = new Integer(i);↵ | | 5 | uids[i] = new Integer(i);↵
|
|
6 | int stepSize = 100;↵ | | 6 | int stepSize = 100;↵
|
7 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵ | | 7 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵
|
|
8 | while (tok.hasNext()) {↵ | | 8 | while (tok.hasNext()) {↵
|
9 | List sublist = (List) tok.next();↵ | | 9 | List sublist = (List) tok.next();↵
|
|
10 | System.out.print("start=" + sublist.get(0));↵ | | 10 | System.out.print("start=" + sublist.get(0));↵
|
11 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵ | | 11 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵
|
|
12 | // if this is the last token, check if the last element↵ | | 12 | // if this is the last token, check if the last element↵
|
13 | // is the same than in the array↵ | | 13 | // is the same than in the array↵
|
14 | if (tok.hasNext() == false) {↵ | | 14 | if (tok.hasNext() == false) {↵
|
15 | assertEquals(sublist.get(sublist.size() - 1),↵ | | 15 | assertEquals(sublist.get(sublist.size() - 1),↵
|
16 | uids[uids.length - 1]);↵ | | 16 | uids[uids.length - 1]);↵
|
17 | }↵ | | 17 | }↵
|
18 | }↵ | | 18 | }↵
|
19 | }↵ | | 19 | }↵
|
|
20 | public void test5() {↵ | | 20 | public void test2() {↵
|
21 | int max = 1;↵ | | 21 | int max = 1001;↵
|
|
22 | Object[] uids = new Object[max];↵ | | 22 | Object[] uids = new Object[max];↵
|
|
23 | for (int i = 0; i < max; i++)↵ | | 23 | for (int i = 0; i < max; i++)↵
|
24 | uids[i] = new Integer(i);↵ | | 24 | uids[i] = new Integer(i);↵
|
|
25 | int stepSize = 100;↵ | | 25 | int stepSize = 100;↵
|
26 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵ | | 26 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵
|
|
27 | while (tok.hasNext()) {↵ | | 27 | while (tok.hasNext()) {↵
|
28 | List sublist = (List) tok.next();↵ | | 28 | List sublist = (List) tok.next();↵
|
|
29 | System.out.print("start=" + sublist.get(0));↵ | | 29 | System.out.print("start=" + sublist.get(0));↵
|
30 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵ | | 30 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵
|
|
31 | // if this is the last token, check if the last element↵ | | 31 | // if this is the last token, check if the last element↵
|
32 | // is the same than in the array↵ | | 32 | // is the same than in the array↵
|
33 | if (tok.hasNext() == false) {↵ | | 33 | if (tok.hasNext() == false) {↵
|
34 | assertEquals(sublist.get(sublist.size() - 1),↵ | | 34 | assertEquals(sublist.get(sublist.size() - 1),↵
|
35 | uids[uids.length - 1]);↵ | | 35 | uids[uids.length - 1]);↵
|
36 | }↵ | | 36 | }↵
|
37 | }↵ | | 37 | }↵
|
38 | | | 38 |
|