Mercurial > hg > Members > tatsuki > Alice
comparison src/alice/test/topology/movement/CheckMyName.java @ 94:38f4021353c5 working
"setKey" is in the instance
author | sugi |
---|---|
date | Mon, 18 Jun 2012 17:10:23 +0900 |
parents | 6601f8854126 |
children | df786bf8f036 |
comparison
equal
deleted
inserted
replaced
93:6601f8854126 | 94:38f4021353c5 |
---|---|
8 import alice.datasegment.Receiver; | 8 import alice.datasegment.Receiver; |
9 | 9 |
10 public class CheckMyName extends CodeSegment { | 10 public class CheckMyName extends CodeSegment { |
11 Receiver host = ids.create(CommandType.PEEK); | 11 Receiver host = ids.create(CommandType.PEEK); |
12 Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); | 12 Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$"); |
13 | |
13 | 14 |
14 @Override | 15 @Override |
15 public void run(){ | 16 public void run(){ |
16 | 17 |
17 String name = host.asString(); | 18 String name = host.asString(); |
24 if (type.equals("cli")){ | 25 if (type.equals("cli")){ |
25 System.out.println("cli"+cliNum); | 26 System.out.println("cli"+cliNum); |
26 | 27 |
27 MakeFrame frame = new MakeFrame(); | 28 MakeFrame frame = new MakeFrame(); |
28 | 29 |
30 MakeObject obj3 = new MakeObject(frame); | |
31 frame.register(obj3); | |
32 new CheckFishLocation(obj3,"fish3X"); | |
33 | |
29 MakeObject obj = new MakeObject(frame); | 34 MakeObject obj = new MakeObject(frame); |
30 frame.register(obj); | 35 frame.register(obj); |
31 CheckFishLocation cs = new CheckFishLocation(obj,"fish1X"); | 36 new CheckFishLocation(obj,"fish1X"); |
32 cs.host.setKey("local","host"); | 37 |
33 cs.nowX.setKey("parent","fish1X"); | |
34 | |
35 MakeObject obj2 = new MakeObject(frame); | |
36 frame.register(obj2); | |
37 CheckFishLocation cs2 = new CheckFishLocation(obj2,"fish2X"); | |
38 cs2.host.setKey("local","host"); | |
39 cs2.nowX.setKey("parent","fish2X"); | |
40 | |
41 MakeObject obj3 = new MakeObject(frame); | |
42 frame.register(obj3); | |
43 CheckFishLocation cs3 = new CheckFishLocation(obj3,"fish3X"); | |
44 cs3.host.setKey("local","host"); | |
45 cs3.nowX.setKey("parent","fish3X"); | |
46 | |
47 | |
48 }else if(type.equals("node")){ | 38 }else if(type.equals("node")){ |
49 System.out.println("node0"); | 39 System.out.println("node0"); |
40 ods.update("local", "fish3X", 0); | |
50 ods.update("local", "fish1X", -1000); | 41 ods.update("local", "fish1X", -1000); |
51 ods.update("local", "fish2X", -1000); | 42 |
52 ods.update("local", "fish3X", 0); | |
53 | 43 |
54 } | 44 } |
55 } | 45 } |
56 } | 46 } |