annotate src/alice/test/codesegment/api/FlipTest.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 (2013-10-17)
parents bc451bb72d5a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
198
f151dea22b2c add flip api
sugi
parents:
diff changeset
1 package alice.test.codesegment.api;
f151dea22b2c add flip api
sugi
parents:
diff changeset
2
f151dea22b2c add flip api
sugi
parents:
diff changeset
3 import alice.codesegment.CodeSegment;
f151dea22b2c add flip api
sugi
parents:
diff changeset
4 import alice.datasegment.CommandType;
f151dea22b2c add flip api
sugi
parents:
diff changeset
5 import alice.datasegment.Receiver;
f151dea22b2c add flip api
sugi
parents:
diff changeset
6
f151dea22b2c add flip api
sugi
parents:
diff changeset
7 public class FlipTest extends CodeSegment{
f151dea22b2c add flip api
sugi
parents:
diff changeset
8
f151dea22b2c add flip api
sugi
parents:
diff changeset
9 private Receiver arg1 = ids.create(CommandType.PEEK);
f151dea22b2c add flip api
sugi
parents:
diff changeset
10 public static long t = 0;
f151dea22b2c add flip api
sugi
parents:
diff changeset
11 public static boolean flag = false;
233
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
12 public static int count = 10000;
198
f151dea22b2c add flip api
sugi
parents:
diff changeset
13 public FlipTest(String key){
f151dea22b2c add flip api
sugi
parents:
diff changeset
14 arg1.setKey(key);
f151dea22b2c add flip api
sugi
parents:
diff changeset
15 }
f151dea22b2c add flip api
sugi
parents:
diff changeset
16
f151dea22b2c add flip api
sugi
parents:
diff changeset
17 public FlipTest(String key, int index){
f151dea22b2c add flip api
sugi
parents:
diff changeset
18 arg1.setKey(key, index);
f151dea22b2c add flip api
sugi
parents:
diff changeset
19 }
f151dea22b2c add flip api
sugi
parents:
diff changeset
20
f151dea22b2c add flip api
sugi
parents:
diff changeset
21 @Override
f151dea22b2c add flip api
sugi
parents:
diff changeset
22 public void run() {
233
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
23 if(flag){
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
24 System.out.println(System.currentTimeMillis() - t +" ms");
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
25 System.exit(0);
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
26 }
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
27 t = System.currentTimeMillis();
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
28 for (int i=0;i<count;i++)
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
29 ods.flip(arg1);
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
30 //ods.put(arg1.key ,arg1.getObj());
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
31 flag=true;
205
28469b1671e7 repair flip API
sugi
parents: 202
diff changeset
32
233
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
33 new FlipTest(arg1.key,count);
bc451bb72d5a add peek test
sugi
parents: 214
diff changeset
34
198
f151dea22b2c add flip api
sugi
parents:
diff changeset
35 }
f151dea22b2c add flip api
sugi
parents:
diff changeset
36
205
28469b1671e7 repair flip API
sugi
parents: 202
diff changeset
37
198
f151dea22b2c add flip api
sugi
parents:
diff changeset
38 }