1 | void test() {↵ | | |
|
2 | int max = 1000;↵ | | |
|
|
3 | Object[] uids = new Object[max];↵ | | |
|
|
4 | for (int i = 0; i < max; i++)↵ | | |
|
5 | uids[i] = new Integer(i);↵ | | |
|
|
6 | int stepSize = 100;↵ | | |
|
7 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵ | | |
|
|
8 | while (tok.hasNext()) {↵ | | |
|
9 | List sublist = (List) tok.next();↵ | | |
|
|
10 | System.out.print("start=" + sublist.get(0));↵ | | |
|
11 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵ | | |
|
|
12 | // if this is the last token, check if the last element↵ | | |
|
13 | // is the same than in the array↵ | | |
|
14 | if (tok.hasNext() == false) {↵ | | |
|
15 | assertEquals(sublist.get(sublist.size() - 1),↵ | | |
|
16 | uids[uids.length - 1]);↵ | | |
|
17 | }↵ | | |
|
18 | }↵ | | |
|
19 | }↵ | | |
|
|
20 | public void test2() {↵ | | 1 | void test2() {↵
|
21 | int max = 1001;↵ | | 2 | int max = 1001;↵
|
|
22 | Object[] uids = new Object[max];↵ | | 3 | Object[] uids = new Object[max];↵
|
|
23 | for (int i = 0; i < max; i++)↵ | | 4 | for (int i = 0; i < max; i++)↵
|
24 | uids[i] = new Integer(i);↵ | | 5 | uids[i] = new Integer(i);↵
|
|
25 | int stepSize = 100;↵ | | 6 | int stepSize = 100;↵
|
26 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵ | | 7 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵
|
|
27 | while (tok.hasNext()) {↵ | | 8 | while (tok.hasNext()) {↵
|
28 | List sublist = (List) tok.next();↵ | | 9 | List sublist = (List) tok.next();↵
|
|
29 | System.out.print("start=" + sublist.get(0));↵ | | 10 | System.out.print("start=" + sublist.get(0));↵
|
30 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵ | | 11 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵
|
|
31 | // if this is the last token, check if the last element↵ | | 12 | // if this is the last token, check if the last element↵
|
32 | // is the same than in the array↵ | | 13 | // is the same than in the array↵
|
33 | if (tok.hasNext() == false) {↵ | | 14 | if (tok.hasNext() == false) {↵
|
34 | assertEquals(sublist.get(sublist.size() - 1),↵ | | 15 | assertEquals(sublist.get(sublist.size() - 1),↵
|
35 | uids[uids.length - 1]);↵ | | 16 | uids[uids.length - 1]);↵
|
36 | }↵ | | 17 | }↵
|
37 | }↵ | | 18 | }↵
|
38 | }↵ | | 19 | }↵
|
|
39 | public void test3() {↵ | | 20 | public void test3() {↵
|
40 | int max = 999;↵ | | 21 | int max = 999;↵
|
|
41 | Object[] uids = new Object[max];↵ | | 22 | Object[] uids = new Object[max];↵
|
|
42 | for (int i = 0; i < max; i++)↵ | | 23 | for (int i = 0; i < max; i++)↵
|
43 | uids[i] = new Integer(i);↵ | | 24 | uids[i] = new Integer(i);↵
|
|
44 | int stepSize = 100;↵ | | 25 | int stepSize = 100;↵
|
45 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵ | | 26 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵
|
|
46 | while (tok.hasNext()) {↵ | | 27 | while (tok.hasNext()) {↵
|
47 | List sublist = (List) tok.next();↵ | | 28 | List sublist = (List) tok.next();↵
|
|
48 | System.out.print("start=" + sublist.get(0));↵ | | 29 | System.out.print("start=" + sublist.get(0));↵
|
49 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵ | | 30 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵
|
|
50 | // if this is the last token, check if the last element↵ | | 31 | // if this is the last token, check if the last element↵
|
51 | // is the same than in the array↵ | | 32 | // is the same than in the array↵
|
52 | if (tok.hasNext() == false) {↵ | | 33 | if (tok.hasNext() == false) {↵
|
53 | assertEquals(sublist.get(sublist.size() - 1),↵ | | 34 | assertEquals(sublist.get(sublist.size() - 1),↵
|
54 | uids[uids.length - 1]);↵ | | 35 | uids[uids.length - 1]);↵
|
55 | }↵ | | 36 | }↵
|
56 | }↵ | | 37 | }↵
|
57 | }↵ | | 38 | }↵
|
|
58 | public void test4() {↵ | | 39 | public void test4() {↵
|
59 | int max = 99;↵ | | 40 | int max = 99;↵
|
|
60 | Object[] uids = new Object[max];↵ | | 41 | Object[] uids = new Object[max];↵
|
|
61 | for (int i = 0; i < max; i++)↵ | | 42 | for (int i = 0; i < max; i++)↵
|
62 | uids[i] = new Integer(i);↵ | | 43 | uids[i] = new Integer(i);↵
|
|
63 | int stepSize = 100;↵ | | 44 | int stepSize = 100;↵
|
64 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵ | | 45 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵
|
|
65 | while (tok.hasNext()) {↵ | | 46 | while (tok.hasNext()) {↵
|
66 | List sublist = (List) tok.next();↵ | | 47 | List sublist = (List) tok.next();↵
|
|
67 | System.out.print("start=" + sublist.get(0));↵ | | 48 | System.out.print("start=" + sublist.get(0));↵
|
68 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵ | | 49 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵
|
|
69 | // if this is the last token, check if the last element↵ | | 50 | // if this is the last token, check if the last element↵
|
70 | // is the same than in the array↵ | | 51 | // is the same than in the array↵
|
71 | if (tok.hasNext() == false) {↵ | | 52 | if (tok.hasNext() == false) {↵
|
72 | assertEquals(sublist.get(sublist.size() - 1),↵ | | 53 | assertEquals(sublist.get(sublist.size() - 1),↵
|
73 | uids[uids.length - 1]);↵ | | 54 | uids[uids.length - 1]);↵
|
74 | }↵ | | 55 | }↵
|
75 | }↵ | | 56 | }↵
|
76 | | | 57 | }↵
|
|
| | | 58 | public void test5() {↵
|
| | | 59 | int max = 1;↵
|
|
| | | 60 | Object[] uids = new Object[max];↵
|
|
| | | 61 | for (int i = 0; i < max; i++)↵
|
| | | 62 | uids[i] = new Integer(i);↵
|
|
| | | 63 | int stepSize = 100;↵
|
| | | 64 | MessageSetTokenizer tok = new MessageSetTokenizer(uids, stepSize);↵
|
|
| | | 65 | while (tok.hasNext()) {↵
|
| | | 66 | List sublist = (List) tok.next();↵
|
|
| | | 67 | System.out.print("start=" + sublist.get(0));↵
|
| | | 68 | System.out.println(" end=" + sublist.get(sublist.size() - 1));↵
|
|
| | | 69 | // if this is the last token, check if the last element↵
|
| | | 70 | // is the same than in the array↵
|
| | | 71 | if (tok.hasNext() == false) {↵
|
| | | 72 | assertEquals(sublist.get(sublist.size() - 1),↵
|
| | | 73 | uids[uids.length - 1]);↵
|
| | | 74 | }↵
|
| | | 75 | }↵
|
| | | 76 |
|