Mercurial > hg > Database > Alice
annotate src/alice/test/topology/fish/AsignStartX.java @ 216:21bd8af1cf26 working
change asClass method
author | one |
---|---|
date | Wed, 27 Mar 2013 19:38:33 +0900 |
parents | fec0726bb126 |
children |
rev | line source |
---|---|
36
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 package alice.test.topology.fish; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 import alice.codesegment.CodeSegment; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 import alice.datasegment.CommandType; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 import alice.datasegment.Receiver; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 public class AsignStartX extends CodeSegment { |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 public Receiver routing = ids.create(CommandType.PEEK); |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 public int startX; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 public int index; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 public AsignStartX(int startX, int index) { |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 this.startX = startX; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 this.index = index; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 } |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
17 |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 @Override |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
19 public void run() { |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
20 System.out.println("AsignStartX: " + startX); |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
21 |
216 | 22 RoutingTable routing = this.routing.asClass(RoutingTable.class); |
36
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
23 int x = startX; |
214 | 24 System.out.println("RoutingTable: " + this.routing.getVal()); |
25 if (this.index >= this.routing.index) { | |
36
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
26 AsignStartX cs = new AsignStartX(startX, index); |
214 | 27 cs.routing.setKey("local", "routing", this.routing.index); |
36
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
28 return; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
29 } |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
30 for (Routing r : routing.table) { |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
31 System.out.println(r.name); |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
32 ods.update(r.name, "startX", x); |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
33 System.out.println("Assign: " + r.name + ".startX = " + x); |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
34 x += r.width; |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
35 } |
214 | 36 PeekStartX cs = new PeekStartX(this.routing.index); |
36
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
37 cs.startX.setKey("local", "startX", this.index); |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
38 } |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
39 |
0b25b48116b6
DistributedFish share width each other (not work)
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
40 } |