annotate src/main/java/alice/topology/node/IncomingReverseKey.java @ 393:38021fceabef draft multicast

test commit
author tatsuki
date Tue, 17 Jun 2014 17:39:47 +0900
parents 8f71c3e6f11d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
345
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
1 package alice.topology.node;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
2
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
3 import alice.codesegment.CodeSegment;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
4 import alice.datasegment.CommandType;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
5 import alice.datasegment.DataSegment;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
6 import alice.datasegment.Receiver;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
7 import org.msgpack.type.Value;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
8
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
9 public class IncomingReverseKey extends CodeSegment {
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
10
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
11 public Receiver reverseKey = ids.create(CommandType.TAKE);
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
12 public Receiver reverseCount = ids.create(CommandType.PEEK);
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
13
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
14 @Override
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
15 public void run() {
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
16 String reverseKey = ((Value)this.reverseKey.getVal()).asRawValue().getString();
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
17 String from = this.reverseKey.from;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
18 DataSegment.getAccept(from).reverseKey = reverseKey;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
19
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
20 int reverseCount = this.reverseCount.asInteger();
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
21 reverseCount++;
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
22 ods.update("local", "reverseCount", reverseCount);
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
23
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
24
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
25 IncomingReverseKey cs = new IncomingReverseKey();
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
26 cs.reverseKey.setKey("local", "reverseKey");
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
27 cs.reverseCount.setKey("local", "reverseCount");
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
28 }
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
29
8f71c3e6f11d Change directory structure Maven standard
sugi
parents:
diff changeset
30 }