Mercurial > hg > Members > tatsuki > Alice
comparison src/main/java/alice/test/codesegment/local/bitonicsort/MakeData.java @ 345:8f71c3e6f11d
Change directory structure Maven standard
author | sugi |
---|---|
date | Wed, 16 Apr 2014 18:26:07 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
344:9f97ec18f8c5 | 345:8f71c3e6f11d |
---|---|
1 package alice.test.codesegment.local.bitonicsort; | |
2 | |
3 import java.util.Random; | |
4 | |
5 import alice.codesegment.CodeSegment; | |
6 import alice.datasegment.CommandType; | |
7 import alice.datasegment.Receiver; | |
8 | |
9 public class MakeData extends CodeSegment { | |
10 | |
11 private Receiver info1 = ids.create(CommandType.PEEK); | |
12 private Receiver info2 = ids.create(CommandType.TAKE); | |
13 | |
14 public MakeData(){ | |
15 info1.setKey("sortconf"); | |
16 info2.setKey("data"); | |
17 } | |
18 | |
19 @Override | |
20 public void run() { | |
21 // This conversion over head should be remove. | |
22 SortConfig conf = info1.asClass(SortConfig.class); | |
23 DataList list = info2.asClass(DataList.class); | |
24 int size = conf.getLength(); | |
25 Random rnd = new Random(); | |
26 for (int i = 0; i < size; i++){ | |
27 list.table[i] = rnd.nextInt(100000)+10; | |
28 } | |
29 ods.update("list", list); | |
30 } | |
31 } |