Mercurial > hg > Database > Alice
comparison src/alice/test/topology/movement/CheckMyName.java @ 105:993a9f194615 working
success share TEST
author | sugi |
---|---|
date | Tue, 03 Jul 2012 15:58:08 +0900 |
parents | df786bf8f036 |
children |
comparison
equal
deleted
inserted
replaced
104:e9005fc9b913 | 105:993a9f194615 |
---|---|
4 import java.util.regex.Pattern; | 4 import java.util.regex.Pattern; |
5 | 5 |
6 import alice.codesegment.CodeSegment; | 6 import alice.codesegment.CodeSegment; |
7 import alice.datasegment.CommandType; | 7 import alice.datasegment.CommandType; |
8 import alice.datasegment.Receiver; | 8 import alice.datasegment.Receiver; |
9 import alice.test.topology.share.CheckLocalIndex; | |
10 import alice.test.topology.share.CheckParentIndex; | |
9 | 11 |
10 public class CheckMyName extends CodeSegment { | 12 public class CheckMyName extends CodeSegment { |
11 Receiver host = ids.create(CommandType.PEEK); | 13 Receiver host = ids.create(CommandType.PEEK); |
12 Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); | 14 Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); |
13 | 15 String key = "fish"; |
14 | 16 |
15 @Override | 17 @Override |
16 public void run(){ | 18 public void run(){ |
17 | 19 |
18 String name = host.asString(); | 20 String name = host.asString(); |
22 String type = matcher.group(1); | 24 String type = matcher.group(1); |
23 int cliNum = new Integer(matcher.group(2)); | 25 int cliNum = new Integer(matcher.group(2)); |
24 | 26 |
25 if (type.equals("cli")){ | 27 if (type.equals("cli")){ |
26 System.out.println("cli"+cliNum); | 28 System.out.println("cli"+cliNum); |
27 | 29 ods.update("local", key, new FishPoint(0.0f,0.0f)); |
28 MakeFrame frame = new MakeFrame(); | 30 MakeFrame frame = new MakeFrame(); |
29 | 31 |
30 MakeObject obj3 = new MakeObject(frame); | 32 MakeObject obj3 = new MakeObject(frame); |
31 frame.register(obj3); | 33 frame.register(obj3); |
32 new CheckFishLocation(obj3,"fish3X"); | 34 new CheckFishLocation(obj3,key,0); |
35 new CheckLocalIndex(key,0); | |
36 new CheckParentIndex(key,0); | |
33 /* | 37 /* |
34 MakeObject obj = new MakeObject(frame); | 38 MakeObject obj = new MakeObject(frame); |
35 frame.register(obj); | 39 frame.register(obj); |
36 new CheckFishLocation(obj,"fish1X"); | 40 new CheckFishLocation(obj,"fish1X"); |
37 */ | 41 */ |
38 }else if(type.equals("node")){ | 42 }else if(type.equals("node")){ |
39 System.out.println("node0"); | 43 System.out.println("node0"); |
40 | 44 |
41 ods.update("local", "fish3X", new FishPoint(0.0f,0.0f)); | 45 ods.update("local", key, new FishPoint(0.0f,0.0f)); |
42 //ods.update("local", "fish1X", new FishPoint(-1.0f,0.0f)); | 46 //ods.update("local", "fish1X", new FishPoint(-1.0f,0.0f)); |
43 | 47 if(cliNum == 0){ |
48 new LookData(key,0); | |
49 } else { | |
50 new CheckLocalIndex(key,0); | |
51 new CheckParentIndex(key,0); | |
52 | |
53 } | |
54 | |
55 | |
44 | 56 |
45 } | 57 } |
46 } | 58 } |
47 } | 59 } |