345
|
1 package alice.test.codesegment.api;
|
|
2
|
|
3 import java.util.Random;
|
|
4
|
|
5 import alice.codesegment.CodeSegment;
|
|
6 import alice.test.codesegment.local.bitonicsort.DataList;
|
|
7
|
|
8 public class StartCodeSegment extends CodeSegment {
|
|
9 String[] args;
|
|
10 public static int count = 1;
|
|
11 public static int cnt = 1;
|
|
12 public static long t = 0;
|
|
13
|
|
14
|
|
15 public StartCodeSegment(String[] args){
|
|
16 this.args = args;
|
|
17 }
|
|
18
|
|
19 @Override
|
|
20 public void run() {
|
|
21 for (String arg : args) {
|
|
22 if ("-update".equals(arg)) {
|
|
23 UpdateCodeSegment cs1 = new UpdateCodeSegment();
|
|
24 cs1.ds1.setKey("key");
|
|
25 int[] array = new int[65536];
|
|
26 array[0] = 0;
|
|
27 ods.update("local", "key", array);
|
|
28
|
|
29 } else if ("-put".equals(arg)) {
|
|
30 new PutCodeSegment().execute();
|
|
31
|
|
32 } else if ("-take".equals(arg)) {
|
|
33 new PutCodeSegment().execute();
|
|
34 new TakeCodeSegment("num");
|
|
35
|
|
36 } else if ("-flip".equals(arg)) {
|
|
37 new FlipCodeSegment("key").execute();
|
|
38 } else if ("-peek".equals(arg)) {
|
|
39 System.out.println("start peek Test");
|
|
40 String key = "peek";
|
|
41 int size = 100000;
|
|
42 DataList list = new DataList(size);
|
|
43 Random rnd = new Random();
|
|
44 for (int cnt = 0; cnt < size; cnt++) {
|
|
45 list.table[cnt] = rnd.nextInt(100000) + 10;
|
|
46 }
|
|
47 ods.put(key, list);
|
|
48 new PeekCodeSegment(key);
|
|
49 }
|
|
50 }
|
|
51
|
|
52 }
|
|
53
|
|
54 }
|