Mercurial > hg > Members > tatsuki > Alice
annotate src/alice/datasegment/Command.java @ 250:38154e695025
Refactor
author | sugi |
---|---|
date | Tue, 11 Jun 2013 16:58:35 +0900 |
parents | b5c642ba998e |
children | 88be2824a989 |
rev | line source |
---|---|
3 | 1 package alice.datasegment; |
2 | |
250 | 3 import java.io.IOException; |
13 | 4 import java.util.concurrent.BlockingQueue; |
3 | 5 import org.msgpack.type.Value; |
6 | |
7 | 7 import alice.codesegment.CodeSegment; |
250 | 8 import alice.codesegment.SingletonMessage; |
9 import alice.daemon.CommandMessage; | |
7 | 10 |
3 | 11 public class Command { |
13 | 12 public CommandType type; |
14
e3f1b21718b0
implements RemoteDataSegment
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
13
diff
changeset
|
13 public String key; |
33
20c67f673224
change name of DataSegmentReceiver
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
14 public Receiver receiver; |
3 | 15 public Value val; |
16 public int index; | |
17 public int seq; | |
13 | 18 public BlockingQueue<Command> replyQueue; |
7 | 19 public CodeSegment cs; |
28
98ab26e09a98
Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
20 public String reverseKey; |
190 | 21 public Object obj; |
202 | 22 |
33
20c67f673224
change name of DataSegmentReceiver
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
28
diff
changeset
|
23 public Command(CommandType cmdType, Receiver receiver, String key, Value val, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) { |
13 | 24 this.type = cmdType; |
18
72dd27d952b0
change InputDataSegment API
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
16
diff
changeset
|
25 this.receiver = receiver; |
16 | 26 this.key = key; |
3 | 27 this.val = val; |
28 this.index = index; | |
29 this.seq = seq; | |
13 | 30 this.replyQueue = replyQueue; |
7 | 31 this.cs = cs; |
28
98ab26e09a98
Configuration Manager work and implements reverseKey
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents:
18
diff
changeset
|
32 this.reverseKey = reverseKey; |
3 | 33 } |
190 | 34 public Command(CommandType cmdType, Receiver receiver, String key, Object obj, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) { |
35 this.type = cmdType; | |
36 this.receiver = receiver; | |
37 this.key = key; | |
38 this.obj = obj; | |
39 this.index = index; | |
40 this.seq = seq; | |
41 this.replyQueue = replyQueue; | |
42 this.cs = cs; | |
43 this.reverseKey = reverseKey; | |
44 } | |
45 | |
46 public Command(CommandType cmdType, Receiver receiver, String key, Value val, Object obj, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) { | |
47 this.type = cmdType; | |
48 this.receiver = receiver; | |
49 this.key = key; | |
50 this.val = val; | |
191 | 51 this.obj = obj; |
190 | 52 this.index = index; |
53 this.seq = seq; | |
54 this.replyQueue = replyQueue; | |
55 this.cs = cs; | |
56 this.reverseKey = reverseKey; | |
57 } | |
58 | |
39 | 59 public String getCommandString() { |
60 String csName = "null"; | |
61 if (cs != null) { | |
62 csName = cs.toString(); | |
63 } | |
40 | 64 return this.type + "\t" + key + "\t" + val + "\tindex=" + index + "\tcs=" + csName; |
39 | 65 } |
250 | 66 public CommandMessage convert() { |
67 if (val==null&&obj!=null){ | |
68 try { | |
69 this.val = SingletonMessage.getInstance().unconvert(obj); | |
70 } catch (IOException e) { | |
71 e.printStackTrace(); | |
72 } | |
73 } | |
74 return new CommandMessage(type.id, index, seq, key, val); | |
75 } | |
39 | 76 |
3 | 77 } |