changeset 554:1dc473a637c6 dispose

add setter/getter to setTime of ReceivedData
author Nozomi Teruya <e125769@ie.u-ryukyu.ac.jp>
date Tue, 17 Nov 2015 00:53:02 +0900
parents 5a9b83c64ddf
children 2af387211a85
files .hgignore src/main/java/alice/daemon/IncomingTcpConnection.java src/main/java/alice/datasegment/Command.java src/main/java/alice/datasegment/ReceiveData.java
diffstat 4 files changed, 30 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Mon Nov 16 23:30:03 2015 +0900
+++ b/.hgignore	Tue Nov 17 00:53:02 2015 +0900
@@ -7,4 +7,8 @@
 ^Alice\.jar$
 syntax: regexp
 syntax: glob
-.classpath
\ No newline at end of file
+.classpath
+
+build
+.gradle
+.idea
--- a/src/main/java/alice/daemon/IncomingTcpConnection.java	Mon Nov 16 23:30:03 2015 +0900
+++ b/src/main/java/alice/daemon/IncomingTcpConnection.java	Tue Nov 17 00:53:02 2015 +0900
@@ -66,9 +66,7 @@
                     }
 
                     if (msg.setTime) {
-                        rData.setTime = true;
-                        rData.time = msg.time;
-                        rData.depth = msg.depth;
+                        rData.setTimes(msg.time, true, msg.depth);
                     }
 
                     cmd = new Command(type, null, null, rData, 0, 0, null, null, reverseKey);
--- a/src/main/java/alice/datasegment/Command.java	Mon Nov 16 23:30:03 2015 +0900
+++ b/src/main/java/alice/datasegment/Command.java	Tue Nov 17 00:53:02 2015 +0900
@@ -104,10 +104,10 @@
                     }
 
                     CommandMessage cm = new CommandMessage(type.id, index, seq, key, false, serialized, compressed, rData.getDataSize());
-                    if (rData.setTime) {
+                    if (rData.getSetTime()) {
                         cm.setTime = true;
-                        cm.time = rData.time;
-                        cm.depth = rData.depth + 1;
+                        cm.time = rData.getTime();
+                        cm.depth = rData.getDepth() + 1;
                     }
 
                     header = packer.write(cm);
--- a/src/main/java/alice/datasegment/ReceiveData.java	Mon Nov 16 23:30:03 2015 +0900
+++ b/src/main/java/alice/datasegment/ReceiveData.java	Tue Nov 17 00:53:02 2015 +0900
@@ -19,9 +19,9 @@
     private int dataSize;
     private Class<?> clazz;
 
-    public long time;//測定用
-    public boolean setTime = false;
-    public int depth = 1;
+    private long time;//測定用
+    private boolean setTime = false;
+    private int depth = 1;
 
     private static final MessagePack packer = new MessagePack();
 
@@ -244,4 +244,22 @@
         this.dataSize = datasize;
     }
 
+    public void setTimes(long time, boolean setTime, int depth){
+        this.time = time;
+        this.setTime = setTime;
+        this.depth = depth;
+    }
+
+    public long getTime(){
+        return this.time;
+    }
+
+    public boolean getSetTime(){
+        return this.setTime;
+    }
+
+    public  int getDepth(){
+        return this.depth;
+    }
+
 }