comparison src/alice/test/codesegment/api/StartCodeSegment.java @ 290:4074077d118d

Refactor iterating process with for-each sentence.
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Fri, 18 Oct 2013 03:26:38 +0900
parents e4a5da56b394
children
comparison
equal deleted inserted replaced
289:3f29a59267e2 290:4074077d118d
16 this.args = args; 16 this.args = args;
17 } 17 }
18 18
19 @Override 19 @Override
20 public void run() { 20 public void run() {
21 for (int i = 0;i<args.length;i++){ 21 for (String arg : args) {
22 if ("-update".equals(args[i])){ 22 if ("-update".equals(arg)) {
23 UpdateCodeSegment cs1 = new UpdateCodeSegment(); 23 UpdateCodeSegment cs1 = new UpdateCodeSegment();
24 cs1.ds1.setKey("key"); 24 cs1.ds1.setKey("key");
25 int[] array = new int[65536]; 25 int[] array = new int[65536];
26 array[0] = 0; 26 array[0] = 0;
27 ods.update("local", "key", array); 27 ods.update("local", "key", array);
28 28
29 } else if ("-put".equals(args[i])){ 29 } else if ("-put".equals(arg)) {
30 new PutCodeSegment().execute(); 30 new PutCodeSegment().execute();
31 31
32 } else if ("-take".equals(args[i])){ 32 } else if ("-take".equals(arg)) {
33 new PutCodeSegment().execute(); 33 new PutCodeSegment().execute();
34 new TakeCodeSegment("num"); 34 new TakeCodeSegment("num");
35 35
36 } else if ("-flip".equals(args[i])){ 36 } else if ("-flip".equals(arg)) {
37 new FlipCodeSegment("key").execute(); 37 new FlipCodeSegment("key").execute();
38 } else if ("-peek".equals(args[i])){ 38 } else if ("-peek".equals(arg)) {
39 System.out.println("start peek Test"); 39 System.out.println("start peek Test");
40 String key = "peek"; 40 String key = "peek";
41 int size = 100000; 41 int size = 100000;
42 DataList list = new DataList(size); 42 DataList list = new DataList(size);
43 Random rnd = new Random(); 43 Random rnd = new Random();
44 for (int cnt = 0; cnt < size; cnt++){ 44 for (int cnt = 0; cnt < size; cnt++) {
45 list.table[cnt] = rnd.nextInt(100000)+10; 45 list.table[cnt] = rnd.nextInt(100000) + 10;
46 } 46 }
47 ods.put(key, list); 47 ods.put(key, list);
48 new PeekCodeSegment(key); 48 new PeekCodeSegment(key);
49
50 } 49 }
51
52
53 } 50 }
54 51
55 } 52 }
56 53
57 } 54 }