changeset 631:ffaacab84d1a

Merge dispose
author Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
date Thu, 30 Nov 2017 19:42:31 +0900
parents 1fad28f44fec (current diff) 77adeb85c4d0 (diff)
children 746447b7c3e0
files .classpath .project .settings/org.eclipse.jdt.core.prefs LICENSE lib/msgpack-0.6.12-SNAPSHOT-sources.jar lib/msgpack-0.6.12-SNAPSHOT.jar scripts/aquariumfx.sh src/main/java/alice/codesegment/SingletonMessage.java src/main/java/alice/datasegment/ReceiveLocalData.java src/main/java/alice/datasegment/ReceiveRemoteData.java src/main/java/alice/datasegment/ReceiverData.java src/main/java/alice/test/topology/aquarium/FishMovementConfig.java src/main/java/alice/topology/manager/ConfigWaiter.java src/main/java/alice/topology/manager/IncomingHosts.java src/main/java/alice/topology/manager/StartTopologyManager.java src/main/java/alice/topology/manager/createABSIPList.java src/main/java/alice/topology/manager/keeparive/CheckExistTask.java src/main/java/alice/topology/manager/keeparive/CreateSchedule.java src/main/java/alice/topology/manager/reconnection/CheckABSName.java src/main/java/alice/topology/manager/reconnection/CheckConnectionList.java src/main/java/alice/topology/manager/reconnection/ReceiveError.java src/main/java/alice/topology/manager/reconnection/ReceiveReconnectData.java src/main/java/alice/topology/manager/reconnection/SendError.java src/main/java/alice/topology/node/TopologyNodeConfig.java src/main/resources/TUNA src/main/resources/image/image1.jpg
diffstat 242 files changed, 209469 insertions(+), 12521 deletions(-) [+]
line wrap: on
line diff
--- a/.classpath	Wed Apr 19 19:19:27 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="output" path="bin"/>
-	<classpathentry kind="src" path="src/main/java"/>
-	<classpathentry kind="src" path="src/main/resources"/>
-	<classpathentry kind="src" path="src/test/java"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/>
-	<classpathentry kind="lib" path="/Users/kono/src/workspace/Alice/lib/com.alexmerz.graphviz.jar" exported="true"/>
-	<classpathentry kind="lib" path="/Users/kono/src/workspace/Alice/lib/javassist.jar" exported="true"/>
-	<classpathentry kind="lib" path="/Users/kono/src/workspace/Alice/lib/log4j-1.2.16.jar" exported="true"/>
-	<classpathentry kind="lib" path="/Users/kono/src/workspace/Alice/lib/msgpack-0.6.12-SNAPSHOT-sources.jar" exported="true"/>
-	<classpathentry kind="lib" path="/Users/kono/src/workspace/Alice/lib/msgpack-0.6.12-SNAPSHOT.jar" exported="true"/>
-	<classpathentry kind="lib" path="/Users/kono/src/workspace/Alice/lib/slf4j-api-1.6.1-sources.jar" exported="true"/>
-	<classpathentry kind="lib" path="/Users/kono/src/workspace/Alice/lib/slf4j-api-1.6.1.jar" exported="true"/>
-	<classpathentry kind="lib" path="/Users/kono/src/workspace/Alice/lib/slf4j-log4j12-1.6.1-sources.jar" exported="true"/>
-	<classpathentry kind="lib" path="/Users/kono/src/workspace/Alice/lib/slf4j-log4j12-1.6.1.jar" exported="true"/>
-</classpath>
--- a/.hgignore	Wed Apr 19 19:19:27 2017 +0900
+++ b/.hgignore	Thu Nov 30 19:42:31 2017 +0900
@@ -1,6 +1,14 @@
+syntax: glob
+.classpath
 
 syntax: regexp
 ^classes$
 syntax: regexp
 ^Alice\.jar$
 syntax: regexp
+syntax: glob
+.classpath
+
+build
+.gradle
+.idea
--- a/.hgtags	Wed Apr 19 19:19:27 2017 +0900
+++ b/.hgtags	Thu Nov 30 19:42:31 2017 +0900
@@ -1,2 +1,4 @@
 d7a3ecc8c4a193008f48513e24d8bd50481f0cc2 working
 d5d9ca4cbe87215b6a6e97e141b3cf98e095687d fish-example-worked
+924e5f52a61f58687719fe36f8d5e4a76472d180 before-multi-topology-manager
+4027e55df60de71456b4383f82284c73cc3add9a current-release
--- a/.project	Wed Apr 19 19:19:27 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>Alice</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.springsource.ide.eclipse.gradle.core.nature</nature>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-	</natures>
-</projectDescription>
--- a/.settings/org.eclipse.jdt.core.prefs	Wed Apr 19 19:19:27 2017 +0900
+++ b/.settings/org.eclipse.jdt.core.prefs	Thu Nov 30 19:42:31 2017 +0900
@@ -1,13 +1,13 @@
 #
-#Sat Jul 12 15:49:30 JST 2014
+#Tue Nov 04 13:35:00 JST 2014
 org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.compliance=1.8
 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
 org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 org.eclipse.jdt.core.compiler.debug.lineNumber=generate
 eclipse.preferences.version=1
 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.8
 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Alice.iml	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,362 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module external.linked.project.id="Alice" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="cr.ie.u_ryukyu.ac.jp" external.system.module.version="1.1" type="JAVA_MODULE" version="4">
+  <component name="NewModuleRootManager" inherit-compiler-output="false">
+    <output url="file://$MODULE_DIR$/build/classes/main" />
+    <output-test url="file://$MODULE_DIR$/build/classes/test" />
+    <exclude-output />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
+      <excludeFolder url="file://$MODULE_DIR$/.gradle" />
+      <excludeFolder url="file://$MODULE_DIR$/build" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module-library">
+      <library name="Gradle: com.alexmerz.graphviz">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/com.alexmerz.graphviz.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: commons-lang3-3.3.2">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/commons-lang3-3.3.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: j3dcore">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/j3dcore.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: j3dutils">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/j3dutils.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: javassist">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/javassist.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: jimColModelImporterJFX">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jimColModelImporterJFX.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: jimObjModelImporterJFX">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/jimObjModelImporterJFX.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: log4j-1.2.16">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/log4j-1.2.16.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: msgpack-0.6.13-SNAPSHOT-sources">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/msgpack-0.6.13-SNAPSHOT-sources.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: msgpack-0.6.13-SNAPSHOT">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/msgpack-0.6.13-SNAPSHOT.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: slf4j-api-1.6.1-sources">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/slf4j-api-1.6.1-sources.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: slf4j-api-1.6.1">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/slf4j-api-1.6.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: slf4j-log4j12-1.6.1-sources">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/slf4j-log4j12-1.6.1-sources.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: slf4j-log4j12-1.6.1">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/slf4j-log4j12-1.6.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: vecmath">
+        <CLASSES>
+          <root url="jar://$MODULE_DIR$/lib/vecmath.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES />
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: com.massisframework.j3d:java3d-core:1.6.0">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.massisframework.j3d/java3d-core/1.6.0/c8a1cba5eede24ab84f0d6f56f6a31ed53fcc6d3/java3d-core-1.6.0.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.massisframework.j3d/java3d-core/1.6.0/58b98bae3ad674b95a3e71567578276afaa46f7d/java3d-core-1.6.0-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: com.massisframework.j3d:vecmath:1.6.0.1">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.massisframework.j3d/vecmath/1.6.0.1/84e7e3805868372eb0c4a28dda21232b49f354e9/vecmath-1.6.0.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.massisframework.j3d/vecmath/1.6.0.1/1fe6123b11f21fe1deb95076c52f2adc9512fefe/vecmath-1.6.0.1-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.msgpack:msgpack:0.6.12">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.msgpack/msgpack/0.6.12/6a0c88fe022993c490011c3dce7127b29f9a9b3b/msgpack-0.6.12.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.msgpack/msgpack/0.6.12/d884987a52e47f566c6356ce948edbf546616072/msgpack-0.6.12-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/99e0f64bb8882f054825ae4a8a527a17b544a0b5/jogl-all-2.3.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-android-aarch64">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/166147f43cf7419c4d858cd31f4b5922d6d10c81/jogl-all-2.3.2-natives-android-aarch64.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-android-armv6">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/ab2c18b8a1327255cc354c19c720807d262baa75/jogl-all-2.3.2-natives-android-armv6.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-linux-amd64">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/ffd1c6bd5f6fb088df6cad25e25721eb55ad2228/jogl-all-2.3.2-natives-linux-amd64.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-linux-armv6">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/6d14f46336be9e2dc5f85d5df17490cee5d09a90/jogl-all-2.3.2-natives-linux-armv6.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-linux-armv6hf">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/2c434c560dbd821b0ed569e44d3d441727491dac/jogl-all-2.3.2-natives-linux-armv6hf.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-linux-i586">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/59b7a336c0ee54161e33662d2ca8ac9d8f6c476d/jogl-all-2.3.2-natives-linux-i586.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-macosx-universal">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/2da2215dbe1091c54cb83cf2484f8a54a4d0cf7a/jogl-all-2.3.2-natives-macosx-universal.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-solaris-amd64">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/bde11ff064181af9c307180d8f3f1744b7bdc11d/jogl-all-2.3.2-natives-solaris-amd64.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-solaris-i586">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/94d1ed501fe53b7f75eab0f712f39802390d0f5b/jogl-all-2.3.2-natives-solaris-i586.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-windows-amd64">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/becd519b1f741176561d93645abd90971ca0dca0/jogl-all-2.3.2-natives-windows-amd64.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all:2.3.2:natives-windows-i586">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/5db8db5eca6b4445db6cd14f68938736630ae976/jogl-all-2.3.2-natives-windows-i586.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all/2.3.2/677f26584c8860b8ac2091a09b08b5facedc6d68/jogl-all-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.jogl:jogl-all-main:2.3.2">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all-main/2.3.2/6a86a9ce357c085e3052efcf639447f9957b82b8/jogl-all-main-2.3.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.jogl/jogl-all-main/2.3.2/6a86a9ce357c085e3052efcf639447f9957b82b8/jogl-all-main-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.jogamp.gluegen:gluegen:2.3.2">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.gluegen/gluegen/2.3.2/4380476a44397a70b2e4dadd9336cf914f724fac/gluegen-2.3.2.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.jogamp.gluegen/gluegen/2.3.2/1e6c7836f978e8c96734b12600f800dff20c628b/gluegen-2.3.2-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: com.googlecode.json-simple:json-simple:1.1.1">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.googlecode.json-simple/json-simple/1.1.1/c9ad4a0850ab676c5c64461a05ca524cdfff59f1/json-simple-1.1.1.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/com.googlecode.json-simple/json-simple/1.1.1/15bba08e3a239d54b68209c001f9c911559d2fed/json-simple-1.1.1-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+    <orderEntry type="module-library">
+      <library name="Gradle: org.javassist:javassist:3.18.1-GA">
+        <CLASSES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.18.1-GA/d9a09f7732226af26bf99f19e2cffe0ae219db5b/javassist-3.18.1-GA.jar!/" />
+        </CLASSES>
+        <JAVADOC />
+        <SOURCES>
+          <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/org.javassist/javassist/3.18.1-GA/d8d089f3a8845cce22d3006e02ab1403dd73b5b6/javassist-3.18.1-GA-sources.jar!/" />
+        </SOURCES>
+      </library>
+    </orderEntry>
+  </component>
+</module>
\ No newline at end of file
--- a/LICENSE	Wed Apr 19 19:19:27 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-Copyright (c) 2014-2014 Shinji KONO, Kazuki Akamine, Shoshi Tamaki, Nobuyasu Ohoshiro, Yu Sugimoto, Tatsuki Kanagawa
-   Information Engineeering, University of the Ryukyus
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
--- a/build.gradle	Wed Apr 19 19:19:27 2017 +0900
+++ b/build.gradle	Thu Nov 30 19:42:31 2017 +0900
@@ -1,20 +1,57 @@
 apply plugin: 'java'
 apply plugin: 'eclipse'
+apply plugin: 'maven'
 
-sourceCompatibility = 1.6
-targetCompatibility = 1.6
+sourceCompatibility = 1.8
+targetCompatibility = 1.8
 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
-version = '1.0'
+
+group = 'cr.ie.u_ryukyu.ac.jp'
+version = '1.1'
+
+repositories {
+    mavenCentral()
+    maven { url "http://www.cr.ie.u-ryukyu.ac.jp/maven"}
+}
 
 dependencies {
-   	compile fileTree(dir: 'lib', include: '*.jar')
+    compile fileTree(dir: 'lib', include: '*.jar')
+    compile group: 'com.massisframework.j3d', name: 'java3d-core', version: '1.6.0'
+    compile group: 'com.massisframework.j3d', name: 'vecmath', version: '1.6.0.1'
+    compile group: 'org.msgpack', name: 'msgpack', version: '0.6.12'
 }
 
 jar {
+    exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
     manifest {
         attributes 'Implementation-Title': 'Gradle Quickstart', 'Implementation-Version': version
     }
     from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
-	archiveName = 'Alice.jar'
+    archiveName = 'Alice.jar'
+}
+
+ext {
+  mavenRepository = System.getenv()['CRMAVEN']+'/maven'
 }
 
+uploadArchives {
+    repositories {
+        mavenDeployer {
+            repository(url: uri(mavenRepository))
+        }
+    }
+}
+task AliceTopologyManager(type: Jar) {
+    exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
+    baseName = "aliceTopologyManager"
+    manifest {
+        attributes 'Main-Class': 'alice.topology.manager.TopologyManager',
+                'Implementation-Title': 'TopologyManager',
+                'Implementation-Description': 'Quickstart',
+                'Implementation-Version': version,
+                'Assembly-Date': new java.util.Date().toString()
+
+    }
+    from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
+    with jar
+}
\ No newline at end of file
Binary file lib/commons-lang3-3.3.2.jar has changed
Binary file lib/j3dcore.jar has changed
Binary file lib/j3dutils.jar has changed
Binary file lib/jimColModelImporterJFX.jar has changed
Binary file lib/jimObjModelImporterJFX.jar has changed
Binary file lib/msgpack-0.6.12-SNAPSHOT-sources.jar has changed
Binary file lib/msgpack-0.6.12-SNAPSHOT.jar has changed
Binary file lib/msgpack-0.6.13-SNAPSHOT-sources.jar has changed
Binary file lib/msgpack-0.6.13-SNAPSHOT.jar has changed
Binary file lib/vecmath.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/aquariumfx.sh	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,26 @@
+#!/bin/bash
+if [ $# -ne 2 ]; then 
+    echo "Usage: ./aquarium.sh NODENUM CHILDLENNUM"
+    exit 1
+fi
+max=$1
+child_num=$2
+jar_path=../build/libs/Alice.jar
+if [ ! -e $java ]; then
+    echo "$java not found."
+    exit 1
+fi
+
+ruby ./topology/treen.rb $1 $2 > ./topology/tree.dot
+dot -Tpng ./topology/tree.dot > ./topology/tree.png
+#open ./topology/tree.png
+java -version
+java -cp $jar_path alice.topology.manager.TopologyManager -p 10000 -conf ./topology/tree.dot -log ./output/manager.log -level fatal > ./output/std_manager.log &
+
+cnt=0
+while [ $cnt -lt $max ]
+do
+    java -cp $jar_path alice.test.topology.aquarium.fx.StartAquariumFX -host `hostname` -port 10000 -p `expr 20000 + $cnt` -log ./output/aquariumfx${cnt}.log -level fatal > ./output/std_aquariumfx${cnt}.log &
+    cnt=`expr $cnt + 1`
+done
+wait
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/Annotation/AliceAnnotation.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,56 @@
+package alice.Annotation;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+import com.sun.org.apache.bcel.internal.classfile.Code;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+
+import static javafx.scene.input.KeyCode.T;
+
+/**
+ * Created by e125769 on 10/15/17.
+ */
+public class AliceAnnotation extends CodeSegment{
+
+    //Receiver piyo = ids.create(CommandType.TAKE);
+
+    @Take("hoge")
+    StringData stringData;
+
+    @Take("huga")
+    StringData stringData2;
+
+    //@TakeRemote(dsm = "remote", key = "piyo")
+
+    public class StringData{public String[] data = {"hoge", "huga", "piyo"};}
+
+
+    @Override
+    public void run() {
+        System.out.println("in run!!!!");
+    }
+
+
+    public AliceAnnotation() {
+        //piyo.setKey("piyo");
+        ods.put("hoge", 0);
+        ods.put("huga", 1);
+        ods.put("piyo", "piyopiyo");
+    }
+
+    public static void main(String[] args){
+        AliceAnnotation alice = new AliceAnnotation();
+        alice.test();
+    }
+
+    public void test(){
+
+    }
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/Annotation/AliceAnnotationTest.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,36 @@
+package alice.Annotation;
+
+import alice.codesegment.InputDataSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Array;
+import java.lang.reflect.Method;
+
+/**
+ * Created by e125769 on 11/14/17.
+ */
+public class AliceAnnotationTest {
+    public static void main(String[] args){
+        AliceAnnotation alice = new AliceAnnotation();
+        AliceAnnotationTest aliceTest = new AliceAnnotationTest();
+        aliceTest.test(alice);
+    }
+
+    public void test(AliceAnnotation alice){
+        Class<AliceAnnotation> aliceAnnotationClass = AliceAnnotation.class;
+
+        /*for (Field field : aliceAnnotationClass.getDeclaredFields()) {
+            if (field.isAnnotationPresent(Take.class)){
+                System.out.println(field.getName());
+                System.out.println(field.getType());
+                Take i = field.getAnnotation(Take.class);
+                System.out.println(i.value());
+                Receiver receiver = ids.create(CommandType.TAKE);
+                receiver.setKey(i.value());
+            }
+        }*/
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/Annotation/CS.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,30 @@
+package alice.Annotation;
+
+import alice.codesegment.InputDataSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+import java.util.ArrayList;
+
+/**
+ * Created by e125769 on 11/19/17.
+ */
+public abstract class CS {
+
+    public ArrayList input = new ArrayList<InputData>();
+    public Receiver[] receivers;
+    public InputDataSegment ids;
+
+    public void setInput(String[] datas){
+        System.out.println("in CS!!");
+        receivers = new Receiver[datas.length];
+        for(int i = 0; i < datas.length; i++){
+            receivers[i] = ids.create(CommandType.TAKE);
+            receivers[i].setKey(datas[i]);
+        }
+    }
+
+    public void setInput(ArrayList input) {
+        this.input = input;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/Annotation/InputData.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,19 @@
+package alice.Annotation;
+
+/**
+ * Created by e125769 on 11/15/17.
+ */
+public class InputData<T> {
+
+    private T value;
+    private String key;
+
+    public InputData(T value){
+        this.value = value;
+    }
+
+    public T getValue() {
+        return value;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/Annotation/InputProcesser.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,30 @@
+package alice.Annotation;
+
+
+import javax.annotation.processing.*;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.TypeElement;
+import javax.tools.Diagnostic.Kind;
+import java.util.Set;
+
+/**
+ * Created by e125769 on 10/16/17.
+ */
+@SupportedAnnotationTypes("alice.Annotation.Input")
+public class InputProcesser extends AbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> typeElements, RoundEnvironment roundEnv) {
+
+        /*for (TypeElement typeElement : typeElements) {
+            Set<? extends Element> elements = roundEnv.getElementsAnnotatedWith(typeElement);
+            for (Element element : elements) {
+                Input in = element.getAnnotation(Input.class);
+                System.out. println("@input" + in.input());
+            }
+        }*/
+
+        return true;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/Annotation/Take.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,15 @@
+package alice.Annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface Take {
+    String value();
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/Annotation/TakeRemote.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,17 @@
+package alice.Annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Type;
+
+/**
+ * Created by e125769 on 11/15/17.
+ */
+@Target(ElementType.FIELD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface TakeRemote {
+    String dsm();
+    String key();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/codesegment/CloseEventCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,15 @@
+package alice.codesegment;
+
+import alice.daemon.ConnectionInfo;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public abstract class CloseEventCodeSegment extends CodeSegment {
+
+    public Receiver metaInfo = ids.create(CommandType.PEEK);
+
+    public ConnectionInfo getConnectionInfo() {
+        return metaInfo.asClass(ConnectionInfo.class);
+    }
+
+}
--- a/src/main/java/alice/codesegment/CodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/codesegment/CodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,26 +1,88 @@
 package alice.codesegment;
 
+import java.io.IOException;
+import java.lang.reflect.*;
 import java.util.ArrayList;
 
+import alice.Annotation.Take;
 import alice.codesegment.InputDataSegment;
+import alice.datasegment.CommandType;
 import alice.datasegment.Receiver;
+import javassist.*;
+import javassist.tools.reflect.Sample;
+import sun.jvm.hotspot.oops.Instance;
 
 public abstract class CodeSegment implements Runnable {
-	
-	public InputDataSegment ids = new InputDataSegment(this);
-	public OutputDataSegment ods = new OutputDataSegment();
-	public ArrayList<Receiver> list = new ArrayList<Receiver>();
-	
-	public void execute() {
-		ids.receive();
-	}
-	
-	public void recycle(){
-		ids.init();
-		ids.setCounter(list.size());
-		for (Receiver receiver : list) {
-			ids.recommand(receiver);
-		}
-	}
+
+    public InputDataSegment ids = new InputDataSegment(this);
+    public OutputDataSegment ods = new OutputDataSegment();
+    private ArrayList<Receiver> list = new ArrayList<Receiver>();
+    private int priority = Thread.NORM_PRIORITY;//?
+
+    public CodeSegment(){
+        for (Field field : this.getClass().getDeclaredFields()) {
+            if (field.isAnnotationPresent(Take.class)){
+                System.out.println(field.getName());
+                System.out.println(field.getType());
+                Take ano = field.getAnnotation(Take.class);
+                System.out.println(ano.value());
+
+                //Receiver receiver = new Receiver(ids, CommandType.TAKE);
+                //receiver.setKey(ano.value());
+
+
+                ClassPool cp = ClassPool.getDefault();
+                try {
+                    CtClass cc = cp.get(this.getClass().getName());
+
+                    try {
+                        CtField cf = CtField.make("alice.datasegment.Receiver " + ano.value() + " = ids.create(CommandType.TAKE);",cc);
+                        cc.addField(cf);
+                        CtConstructor[] ctConstructors = cc.getConstructors();
+                        ctConstructors[0].setBody(ano.value() + ".setKey(\"" +ano.value() + "\");");
+                        cc.setModifiers(cc.getModifiers());
+                    } catch (CannotCompileException e) {
+                        e.printStackTrace();
+                    }
 
-}
+                    try {
+                        Class c = cc.toClass(ClassLoader.getSystemClassLoader(), Sample.class.getProtectionDomain());
+                        //c.newInstance();
+                    } catch (CannotCompileException e) {
+                        e.printStackTrace();
+                    }
+
+                } catch (NotFoundException e) {
+                    e.printStackTrace();
+                }
+
+            }
+        }
+    }
+
+    public void execute() {
+        ids.receive();
+    }
+
+    public void register(Receiver receiver) {
+        list.add(receiver);
+    }//Receiverを作成?
+
+    public void recycle(){//idsのリセット
+        ids.init();
+        ids.setCounter(list.size());
+        for (Receiver receiver : list) {
+            receiver.index = 0;
+            ids.recommand(receiver);
+        }
+    }
+
+    public int getPriority() {
+        return priority;
+    }
+
+    public void setPriority(int priority) {
+        this.priority = priority;
+    }
+
+}
\ No newline at end of file
--- a/src/main/java/alice/codesegment/CodeSegmentManager.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/codesegment/CodeSegmentManager.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,6 +1,7 @@
 package alice.codesegment;
 
 import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
@@ -8,24 +9,53 @@
 
 public class CodeSegmentManager {
 
-	private static CodeSegmentManager instance = new CodeSegmentManager();
-	private ThreadPoolExecutor codeSegmentExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), // initial number of threads
-				                                Runtime.getRuntime().availableProcessors(),
-												Integer.MAX_VALUE, // keepAliveTime
-												TimeUnit.SECONDS,
-												new LinkedBlockingQueue<Runnable>());
-	private Logger logger = Logger.getLogger(CodeSegmentManager.class);
+    private static CodeSegmentManager instance = new CodeSegmentManager();
+    private ThreadPoolExecutor codeSegmentExecutor;
+
+    private ThreadFactory maxPriority;
+    private ThreadFactory minPriority;
+    private ThreadFactory normalPriority;
+
+    private Logger logger = Logger.getLogger(CodeSegmentManager.class);
+
+    private CodeSegmentManager() {
+        codeSegmentExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), // initial number of threads
+                Runtime.getRuntime().availableProcessors(),
+                Integer.MAX_VALUE, // keepAliveTime
+                TimeUnit.SECONDS,
+                new LinkedBlockingQueue<Runnable>());
+        normalPriority = codeSegmentExecutor.getThreadFactory();
+        maxPriority = makeThreadFactory(Thread.MAX_PRIORITY);
+        minPriority = makeThreadFactory(Thread.MIN_PRIORITY);
+    }
+
+    public static CodeSegmentManager get() {
+        return instance;
+    }
 
-	public static CodeSegmentManager get() {
-		return instance;
-	}
+    public static void submit(CodeSegment cs) {
+        CodeSegmentManager csManager = CodeSegmentManager.get();
+        if (cs.getPriority() < Thread.NORM_PRIORITY) {
+            csManager.codeSegmentExecutor.setThreadFactory(csManager.minPriority);
+        } else if (cs.getPriority() < Thread.MAX_PRIORITY) {
+            csManager.codeSegmentExecutor.setThreadFactory(csManager.normalPriority);
+        } else {
+            csManager.codeSegmentExecutor.setThreadFactory(csManager.maxPriority);
+        }
+        csManager.codeSegmentExecutor.execute(cs);
+        if (csManager.logger.isDebugEnabled()) {
+            csManager.logger.debug(cs.getClass().getName());
+        }
+    }
 
-	public static void submit(CodeSegment cs) {
-		CodeSegmentManager csManager = CodeSegmentManager.get();
-		csManager.codeSegmentExecutor.execute(cs);
-		if (csManager.logger.isDebugEnabled()) {
-			csManager.logger.debug(cs.getClass().getName());
-		}
-	}
-	
+    private ThreadFactory makeThreadFactory(final int priority) {
+        return new ThreadFactory() {
+            @Override
+            public Thread newThread(Runnable r) {
+                Thread thread = new Thread(r);
+                thread.setPriority(priority);
+                return thread;
+            }
+        };
+    }
 }
--- a/src/main/java/alice/codesegment/InputDataSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/codesegment/InputDataSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,112 +5,91 @@
 import alice.datasegment.Command;
 import alice.datasegment.CommandType;
 import alice.datasegment.DataSegment;
-import alice.datasegment.ReceiveLocalData;
-import alice.datasegment.ReceiveRemoteData;
 import alice.datasegment.Receiver;
+import alice.datasegment.SendOption;
 
 /**
+ * RemoteかLocalかで分けて処理する。ここに圧縮DSMへ投げる処理を追加。
  * InputDataSegment Manager
  * 			keep tracking unbound/bound count
  * @author kazz
  *
  */
 public class InputDataSegment {
-	
-	public CodeSegment cs;
-	private AtomicInteger count = new AtomicInteger(1); // 1 for no input data segments
-	private AtomicInteger keyCount = new AtomicInteger(0); // number of DataSegments
-	public InputDataSegment(CodeSegment cs) {
-		this.cs = cs;
-	}
-	
-	public void init(){
-		count = new AtomicInteger(1);
-		keyCount = new AtomicInteger(0);
-	}
-	
-	public void quickPeek(Receiver receiver) {
-		cs.list.add(receiver);
-		if (receiver.managerKey==null){
-			DataSegment.getLocal().peek(receiver, cs);
-		} else {
-			DataSegment.get(receiver.managerKey).quickPeek(receiver ,cs);
-		}
-	}
-	
-	public void quickTake(Receiver receiver) {
-		cs.list.add(receiver);
-		if (receiver.managerKey==null){
-			DataSegment.getLocal().quickTake(receiver, cs);
-		} else {
-			DataSegment.get(receiver.managerKey).quickTake(receiver ,cs);
-		}
-	}
-	
-	public void peek(Receiver receiver) {
-		cs.list.add(receiver);
-		if (receiver.managerKey==null){
-			DataSegment.getLocal().peek(receiver, cs);
-		} else {
-			DataSegment.get(receiver.managerKey).peek(receiver, cs);
-		}
-	}
+
+    public CodeSegment cs;
+    private AtomicInteger count = new AtomicInteger(1); // 1 for no input data segments
+    private AtomicInteger keyCount = new AtomicInteger(0); // number of DataSegments
+
+    public InputDataSegment(CodeSegment cs) {
+        this.cs = cs;
+    }
+
+    public void init(){
+        count = new AtomicInteger(1);
+        keyCount = new AtomicInteger(0);
+    }
+
+    public void quickPeek(Receiver receiver) {//SEDAで実行
+        cs.register(receiver);
+        DataSegment.get(receiver.managerKey).peek(receiver, cs, true);
+    }
+
+
+    public void peek(Receiver receiver) {
+        cs.register(receiver);
+        DataSegment.get(receiver.managerKey).peek(receiver, cs, false);
+    }
+
+    public void quickTake(Receiver receiver) {
+        cs.register(receiver);
+        DataSegment.get(receiver.managerKey).take(receiver, cs, true);
+    }
+
+    public void take(Receiver receiver) {
+        cs.register(receiver);
+        DataSegment.get(receiver.managerKey).take(receiver, cs, false);
+    }
 
-	
-	public void take(Receiver receiver) {
-		cs.list.add(receiver);
-		if (receiver.managerKey==null){
-			DataSegment.getLocal().take(receiver, cs);
-		} else {
-			DataSegment.get(receiver.managerKey).take(receiver, cs);
-		}
-	}
+    public void reply(Receiver receiver, Command reply) {
+        receiver.index = reply.index;
+        receiver.from = reply.reverseKey;
+        receiver.setData(reply.rData);
+        receive();
+    }
 
-	public void reply(Receiver receiver, Command reply) {
-		receiver.index = reply.index;
-		receiver.from = reply.reverseKey;
-		if (reply.reverseKey==null){
-			receiver.setData(new ReceiveRemoteData(reply.val));
-		} else if (!reply.reverseKey.equals("local")) {
-			receiver.setData(new ReceiveRemoteData(reply.val));
-		} else {
-			receiver.setData(new ReceiveLocalData(reply.obj));			
-		}
-		receive();
-	}
+    public void register() {
+        count.getAndIncrement();
+        keyCount.getAndIncrement();
+    }
+
+    public void setKey() {
+        if (keyCount.decrementAndGet() == 0) {
+            receive();
+        }
+    }
 
-	public void register() {
-		count.getAndIncrement();
-		keyCount.getAndIncrement();
-	}
-	
-	public void setKey() {
-		if (keyCount.decrementAndGet() == 0) {
-			receive();
-		}
-	}
-	
-	public void receive() {
-		if (count.decrementAndGet() == 0) {
-			CodeSegmentManager.submit(cs);
-		}
-	}
-	
-	/**
-	 * InputDataSegment factory
-	 * @param type PEEK or TAKE
-	 * @return Receiver of DataSegment reply 
-	 */
-	public Receiver create(CommandType type) {
-		return new Receiver(this, type);
-	}
+    public void receive() {
+        if (count.decrementAndGet() == 0) {
+            CodeSegmentManager.submit(cs);
+        }
+    }
 
-	public void recommand(Receiver receiver) {
-		// TODO why only local?
-		DataSegment.getLocal().recommand(receiver, cs);
-	}
-	
-	public void setCounter(int cnt){
-		count.set(cnt);
-	}
+    /**
+     * InputDataSegment factory
+     * @param type PEEK or TAKE
+     * @return Receiver of DataSegment reply
+     */
+    public Receiver create(CommandType type) {
+        return new Receiver(this, type);
+    }//Receiverを作成
+
+    public void recommand(Receiver receiver) {
+        // TODO why only local?
+        DataSegment.getLocal().recommand(receiver, cs);
+    }
+
+    public void setCounter(int cnt){
+        count.set(cnt);
+    }
 }
--- a/src/main/java/alice/codesegment/OutputDataSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/codesegment/OutputDataSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,108 +1,144 @@
 package alice.codesegment;
 
+import alice.datasegment.CommandType;
 import alice.datasegment.DataSegment;
+import alice.datasegment.ReceiveData;
 import alice.datasegment.Receiver;
+import alice.datasegment.SendOption;
 
 public class OutputDataSegment {
 
-	/**
-	 * for local
-	 */
-
-	public void flip(Receiver receiver) {
-		receiver.managerKey=null;
-		DataSegment.getLocal().put(receiver.key, receiver.getObj());
-	}
+    /**
+     * for local
+     */
 
-	public void put(String key, Object val) {
-		DataSegment.getLocal().put(key, val);
-	}
+    /**
+     * input→ds変更→outputのときコピーを防ぐ
+     */
+    public void flip(Receiver receiver) {
+        if (receiver.isCompressed()){
+            DataSegment.getCompressedLocal().put(receiver.key, receiver.getReceiveData(), false);
+        } else {
+            DataSegment.getLocal().put(receiver.key, receiver.getReceiveData(), false);
+        }
+    }
 
-	public void quickPut(String key, Object val) {
-		put(key, val);
-	}
+    public void flip(String managerKey, String key, Receiver receiver){
+        if (receiver.isCompressed()){
+            DataSegment.get("compressed" + managerKey).put(key, receiver.getReceiveData(), false);
+        } else {
+            DataSegment.get(managerKey).put(key, receiver.getReceiveData(), false);
+        }
 
-	public void update(String key, Object val) {
-		DataSegment.getLocal().update(key, val);
-	}
+    }
 
-	public void quickuUpdate(String key, Object val) {
-		update(key, val);
-	}
+    public void flip(Receiver receiver, CommandType type) {
+        switch (type) {
+            case PUT:
+                if (receiver.isCompressed()){
+                    DataSegment.getCompressedLocal().put(receiver.key, receiver.getReceiveData(), false);//localなら全部false。
+                } else {
+                    DataSegment.getLocal().put(receiver.key, receiver.getReceiveData(), false);
+                }
+                break;
+            case UPDATE:
+                if (receiver.isCompressed()){
+                    DataSegment.getCompressedLocal().update(receiver.key, receiver.getReceiveData(), false);
+                } else {
+                    DataSegment.getLocal().update(receiver.key, receiver.getReceiveData(), false);
+                }
 
-	/**
-	 * for remote
-	 */
-	public void put(String managerKey, String key, Object val) {
-		if (!managerKey.equals("local")){
-			DataSegment.get(managerKey).put(key,val);
-		} else {
-			put(key, val);
-		}
-	}
+                break;
+            default:
+                break;
+        }
+    }
+
+    public void put(String key, ReceiveData rData) {
+        DataSegment.getLocal().put(key, rData, false);
+    }
 
-	public void quickPut(String managerKey, String key, Object val) {
-		if (!managerKey.equals("local")){
-			DataSegment.get(managerKey).quickPut(key, val);
-		} else {
-			put(key, val);
-		}
-	}
+    public void put(String key, Object val) {
+        ReceiveData rData = new ReceiveData(val);
+        DataSegment.getLocal().put(key, rData, false);
+    }
+
+    public void update(String key, Object val) {
+        ReceiveData rData = new ReceiveData(val);
+        DataSegment.getLocal().update(key, rData, false);
+    }
+
+    /**
+     * for remote
+     */
+    public void put(String managerKey, String key, ReceiveData rData) {
+        DataSegment.get(managerKey).put(key, rData, false);
+    }
 
-	public void update(String managerKey, String key, Object val) {
-		if (!managerKey.equals("local")){
-			DataSegment.get(managerKey).update(key, val);
-		} else {
-			update(key, val);
-		}
-	}
+    public void put(String managerKey, String key, Object val) {//追加
+        ReceiveData rData = new ReceiveData(val);
+        DataSegment.get(managerKey).put(key, rData, false);
+    }
+
+    public void quickPut(String managerKey, String key, ReceiveData rData) {
+        DataSegment.get(managerKey).put(key, rData, true);
+    }
+
+    public void quickPut(String managerKey, String key, Object val) {
+        ReceiveData rData = new ReceiveData(val);
+        DataSegment.get(managerKey).put(key, rData, true);
+    }
 
-	public void quickUpdate(String managerKey, String key, Object val) {
-		if (!managerKey.equals("local")){
-			DataSegment.get(managerKey).update(key, val);
-		} else {
-			update(key, val);
-		}
-	}
+    public void update(String managerKey, String key, ReceiveData rData) {
+        DataSegment.get(managerKey).update(key, rData, false);
+    }
+
+    public void update(String managerKey, String key, Object val) {
+        ReceiveData rData = new ReceiveData(val);
+        DataSegment.get(managerKey).update(key, rData, false);
+    }
 
-	/**
-	 * kill the Alice process after send other messages.
-	 * 
-	 * @param managerKey
-	 */
+    public void quickUpdate(String managerKey, String key, ReceiveData rData) {
+        DataSegment.get(managerKey).update(key, rData, true);
+    }
 
-	public void finish(String managerKey) {
-		DataSegment.get(managerKey).finish();
-	}
+    public void quickUpdate(String managerKey, String key, Object val, boolean cFlag) {
+        ReceiveData rData = new ReceiveData(val);
+        DataSegment.get(managerKey).update(key, rData, true);
+    }
 
-	/**
-	 * close socket for RemoteDataSegment after send other messages.
-	 * 
-	 * @param managerKey
-	 */
+    /**
+     * kill the Alice process after send other messages.
+     *
+     * @param managerKey
+     */
 
-	public void close(String managerKey) {
-		DataSegment.get(managerKey).close();
-	}
+    public void finish(String managerKey) {
+        if (DataSegment.contains(managerKey))
+            DataSegment.get(managerKey).finish();
+    }
+
+    /**
+     * close socket for RemoteDataSegment after send other messages.
+     *
+     * @param managerKey
+     */
 
-	/**
-	 * "key" is not remote DataSegment's key.
-	 * "Ping Response" return in this "key" 
-	 * 
-	 * @param managerKey
-	 * @param key
-	 */
-	public void ping(String managerKey, String returnKey) {
-		DataSegment.get(managerKey).ping(returnKey);
-	}
-	
-	/**
-	 * this method is to forcibly close socket
-	 * 
-	 * @param managerKey
-	 */
+    public void close(String managerKey) {
+        if (DataSegment.contains(managerKey))
+            DataSegment.get(managerKey).close();
+    }
 
-	public void shutdown(String managerKey){
-		DataSegment.get(managerKey).shutdown();
-	}
+    /**
+     * "key" is not remote DataSegment's key.
+     * "Ping Response" return in this "key"
+     *
+     * @param managerKey
+     * @param returnKey
+     */
+    public void ping(String managerKey, String returnKey) {
+        if (DataSegment.contains(managerKey))
+            DataSegment.get(managerKey).ping(returnKey);
+    }
+
 }
--- a/src/main/java/alice/codesegment/SingletonMessage.java	Wed Apr 19 19:19:27 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-package alice.codesegment;
-
-import org.msgpack.MessagePack;
-
-public class SingletonMessage {
-	
-	private static final MessagePack instance = new MessagePack(); 
-	
-	public static MessagePack getInstance(){
-		return instance;
-	}
-
-}
--- a/src/main/java/alice/daemon/AcceptThread.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/daemon/AcceptThread.java	Thu Nov 30 19:42:31 2017 +0900
@@ -10,34 +10,37 @@
 
 public class AcceptThread extends Thread {
 
-	private ServerSocket ss;
-	private Logger log = Logger.getLogger(AcceptThread.class);
-	public int counter = 0;
+    private ServerSocket ss;
+    private Logger log = Logger.getLogger(AcceptThread.class);
+    public int counter = 0;
+
+    public AcceptThread(ServerSocket ss, String name) {
+        super(name);
+        this.ss = ss;
+    }
 
-	public AcceptThread(ServerSocket ss, String name) {
-		super(name);
-		this.ss = ss;
-	}
-	
-	@Override
-	public void run() {
-		while (true) {
-			try {
-				Socket socket = ss.accept();
-				socket.setTcpNoDelay(true);
-				log.info("Accept " + socket.getInetAddress().getHostName() + ":" + socket.getPort());
-				Connection connection = new Connection(socket);
-				String key = "accept" + counter;
-				IncomingTcpConnection incoming =
-						new IncomingTcpConnection(connection, DataSegment.get("local"), key);
-				incoming.start();
-				DataSegment.setAccept(key, incoming);
-				new OutboundTcpConnection(connection).start();
-				counter++;
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-	}
+    @Override
+    public void run() {
+        while (true) {
+            try {
+                Socket socket = ss.accept();
+                socket.setTcpNoDelay(true);
+                log.info("Accept " + socket.getInetAddress().getHostName() + ":" + socket.getPort());
+                Connection connection = new Connection(socket);
+                String key = "accept" + counter;
+                IncomingTcpConnection in =
+                        new IncomingTcpConnection(connection, DataSegment.get("local"), key);
+                in.setName(connection.getInfoString()+"-IncomingTcp");
+                in.start();
+                DataSegment.setAccept(key, in);
+                OutboundTcpConnection out = new OutboundTcpConnection(connection);
+                out.setName(connection.getInfoString()+"-OutboundTcp");
+                out.start();
+                counter++;
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 
 }
--- a/src/main/java/alice/daemon/AliceDaemon.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/daemon/AliceDaemon.java	Thu Nov 30 19:42:31 2017 +0900
@@ -7,55 +7,56 @@
 import java.net.ServerSocket;
 import java.nio.channels.ServerSocketChannel;
 
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.apache.log4j.WriterAppender;
+//import org.apache.log4j.Logger;
+//import org.apache.log4j.PatternLayout;
+//import org.apache.log4j.WriterAppender;
 
 public class AliceDaemon {
-	
-	private Config conf;
-	private AcceptThread acceptThread;
-	private Logger log = Logger.getLogger(AliceDaemon.class);
-	
-	public AliceDaemon(Config conf) {
-		this.conf = conf;
-		setLogger();
-	}
-	
-	private void setLogger() {
-		Logger root = Logger.getRootLogger();
-		if (conf.level != null)
-			root.setLevel(conf.level);
-		if (conf.logFile == null)
-			return;
-		PatternLayout layout = new PatternLayout();
-		layout.setConversionPattern("%d %-5p %c - %m [%t] (%F:%L)%n");
-		try {
-			FileWriter writer = new FileWriter(conf.logFile);
-			WriterAppender writerAppender = new WriterAppender(layout, writer);
-			root.removeAllAppenders();
-			root.addAppender(writerAppender);
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		log.info("configured");
-	}
-	
-	public void listen() {
-		try {
-			ServerSocketChannel ssChannel = ServerSocketChannel.open();
-			ServerSocket ss = ssChannel.socket();
-			ss.setReuseAddress(true);
-			
-            //InetSocketAddress a = new InetSocketAddress("::", conf.localPort);
-            InetSocketAddress a = new InetSocketAddress(InetAddress.getLocalHost(), conf.localPort);
-            //System.out.println(a);
+
+    private Config conf;
+    private AcceptThread acceptThread;
+    //private Logger log = Logger.getLogger(AliceDaemon.class);
+
+    public AliceDaemon(Config conf) {
+        this.conf = conf;
+        //setLogger();
+    }
+
+//    private void setLogger() {
+//        Logger root = Logger.getRootLogger();
+//        if (conf.level != null)
+//            root.setLevel(conf.level);
+//        if (conf.logFile == null)
+//            return;
+//        PatternLayout layout = new PatternLayout();
+//        layout.setConversionPattern("%d %-5p %c - %m [%t] (%F:%L)%n");
+//        try {
+//            FileWriter writer = new FileWriter(conf.logFile);
+//            WriterAppender writerAppender = new WriterAppender(layout, writer);
+//            root.removeAllAppenders();
+//            root.addAppender(writerAppender);
+//        } catch (IOException e) {
+//            e.printStackTrace();
+//        }
+//        log.info("configured");
+//    }
+
+    public void listen() {
+        try {
+            ServerSocketChannel ssChannel = ServerSocketChannel.open();
+            ServerSocket ss = ssChannel.socket();
+            ss.setReuseAddress(true);
+
+            // listen on any address ipv4/ipv6
+            InetSocketAddress a = new InetSocketAddress("::", conf.localPort);
+
+            System.out.println("AliceDaemon.listen: bind to " + a);
             ss.bind(a);
-			acceptThread = new AcceptThread(ss, "ACCEPT" + conf.localPort);
-			acceptThread.start();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		
-	}
+            acceptThread = new AcceptThread(ss, "ACCEPT" + conf.localPort);
+            acceptThread.start();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
 }
--- a/src/main/java/alice/daemon/CommandMessage.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/daemon/CommandMessage.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,25 +1,38 @@
 package alice.daemon;
 
 import org.msgpack.annotation.Message;
-import org.msgpack.type.Value;
 
+/**
+ * DSのヘッダー
+ */
 @Message
 public class CommandMessage {
-	public int type;
-	public int index;
-	public int seq;
-	public String key;
-	public Value val;
-	public boolean flag;
-	
-	public CommandMessage() {}
-	
-	public CommandMessage(int type, int index, int seq, String key, Value val, boolean flag) {
-		this.type = type;
-		this.index = index;
-		this.seq = seq;
-		this.key = key;
-		this.val = val;
-		this.flag = flag;
-	}
+    public int type;//PUT, PEEKなどのコマンドタイプ
+    public int index;//キューの中でのDSの位置?
+    public int seq;//DSの待ち合わせを行っているCSを表すunique number
+    public String key;//DS key
+    public boolean quickFlag = false;//SEDAを挟まずに処理を行うかどうか
+    public boolean compressed = false;//圧縮されているかどうか
+    public int dataSize = 0;//圧縮前のサイズ
+
+    //計測用
+    public boolean setTime = false;
+    public long time;
+    public int depth;
+    public boolean setZepped = false;
+    public int zippedDataSize;//圧縮後のサイズ
+
+    public CommandMessage() {}
+
+    public CommandMessage(int type, int index, int seq, String key
+            , boolean qFlag, boolean cFlag, int datasize) {
+        this.type = type;
+        this.index = index;
+        this.seq = seq;
+        this.key = key;
+        this.quickFlag = qFlag;
+        this.compressed = cFlag;
+        this.dataSize = datasize;
+    }
+
 }
--- a/src/main/java/alice/daemon/Config.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/daemon/Config.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,32 +4,41 @@
 
 public class Config {
 
-	public int localPort = 10000;
-	public String logFile = null;
-	public Level level = null;
-	
-	public Config(String[] args) {
-		for (int i = 0; i< args.length; i++) {
-			if ("-p".equals(args[i])) {
-				localPort = Integer.parseInt(args[++i]);
-			} else if ("-log".equals(args[i])) {
-				logFile = args[++i];
-			} else if ("-level".equals(args[i])) {
-				String levelStr = args[++i];
-				if (levelStr.equals("fatal")) {
-					level = Level.FATAL;
-				} else if (levelStr.equals("error")) {
-					level = Level.ERROR;
-				} else if (levelStr.equals("warn")) {
-					level = Level.WARN;
-				} else if (levelStr.equals("info")) {
-					level = Level.INFO;
-				} else if (levelStr.equals("debug")) {
-					level = Level.DEBUG;
-				}
-			}
-		}
+    public int localPort = 10000;
+    public String logFile = null;
+    public Level level = Level.FATAL;
+    public String MCSTADDR = "224.0.0.1";
+    public String nis = "en1";
+    public boolean useKeepAlive = true;
 
-	}
+    public Config(String[] args) {
+        for (int i = 0; i< args.length; i++) {
+            if ("-p".equals(args[i])) {
+                localPort = Integer.parseInt(args[++i]);
+            } else if ("-log".equals(args[i])) {
+                logFile = args[++i];
+            } else if ("-n".equals(args[i])) {
+                nis = args[++i];
+            } else if ("--noKeepAlive".equals(args[i])) {
+                useKeepAlive = false;
+            } else if ("-a".equals(args[i])) {
+                MCSTADDR = args[++i];
+            } else if ("-level".equals(args[i])) {
+                String levelStr = args[++i];
+                if (levelStr.equals("fatal")) {
+                    level = Level.FATAL;
+                } else if (levelStr.equals("error")) {
+                    level = Level.ERROR;
+                } else if (levelStr.equals("warn")) {
+                    level = Level.WARN;
+                } else if (levelStr.equals("info")) {
+                    level = Level.INFO;
+                } else if (levelStr.equals("debug")) {
+                    level = Level.DEBUG;
+                }
+            }
+        }
+
+    }
 
 }
--- a/src/main/java/alice/daemon/Connection.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/daemon/Connection.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,58 +1,70 @@
 package alice.daemon;
 
-import java.io.IOException;
 import java.net.Socket;
 import java.nio.ByteBuffer;
 import java.util.concurrent.LinkedBlockingQueue;
 
-import alice.codesegment.SingletonMessage;
 import alice.datasegment.Command;
+import alice.datasegment.DataSegment;
+import alice.datasegment.ReceiveData;
+import alice.datasegment.SendOption;
 
 public class Connection {
 
-	public Socket socket;
-	public LinkedBlockingQueue<Command> sendQueue = new LinkedBlockingQueue<Command>();
+    public Socket socket;
+    public String name;
+    public LinkedBlockingQueue<Command> sendQueue = new LinkedBlockingQueue<Command>();
+    public boolean sendManager = true;
 
-	public Connection(Socket socket) {
-		this.socket = socket;
-	}
-	
-	public Connection() {}
+    public Connection(Socket socket) {
+        this.socket = socket;
+    }
+
+    public Connection() {}
 
-	public void sendCommand(Command cmd) {
-		try {
-			sendQueue.put(cmd);
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-	}
-	
-	public String getInfoString() {
-		return socket.getInetAddress().getHostName()
-			   + ":" + socket.getPort();
-	}
+    public void sendCommand(Command cmd) {
+        try {
+            sendQueue.put(cmd);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public String getInfoString() {
+        return socket.getInetAddress().getHostName()
+                + ":" + socket.getPort();
+    }
 
-	public synchronized void write(Command cmd) {	
-		CommandMessage cmdMsg = cmd.convert();
-		ByteBuffer buffer;
-		try {
-			buffer = ByteBuffer.wrap(SingletonMessage.getInstance().write(cmdMsg));
-			while (buffer.hasRemaining()) {
-				socket.getChannel().write(buffer);
-			}
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-	}
-	
-	public void close(){
-		try {
-			socket.shutdownOutput();
-			socket.shutdownInput();
-			socket.close();
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		
-	}
+    public synchronized void write(Command cmd) {
+        ByteBuffer buffer = cmd.convert();
+        try {
+            while (buffer.hasRemaining()) {
+                socket.getChannel().write(buffer);
+            }
+        } catch (Exception e) {
+        }
+    }
+
+    public void close(){
+        try {
+            socket.shutdownOutput();
+            socket.shutdownInput();
+            socket.close();
+        } catch (Exception e) { }
+        putConnectionInfo();
+
+    }
+
+    public void putConnectionInfo() {
+        if (name!=null){
+            ConnectionInfo c = new ConnectionInfo(name, socket);
+            ReceiveData rData = new ReceiveData(c);
+            DataSegment.getLocal().put("_DISCONNECT", rData, false);
+            if (sendManager) {
+                DataSegment.get("manager").put("_DISCONNECTNODE", rData, false);
+                sendManager = false;
+            }
+        }
+
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/daemon/ConnectionInfo.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,23 @@
+package alice.daemon;
+
+import java.net.Socket;
+
+import org.msgpack.annotation.Message;
+
+@Message
+public class ConnectionInfo {
+    public String nodeName;
+    public String hostname;
+    public String addr;
+    public int port;
+
+    public ConnectionInfo() {/*messagePack need no arguments constructor*/}
+
+    public ConnectionInfo(String name, Socket socket){
+        this.nodeName = name;
+        this.hostname = socket.getInetAddress().getHostAddress();
+        this.addr = socket.getInetAddress().getHostAddress();
+        this.port = socket.getPort();
+    }
+
+}
--- a/src/main/java/alice/daemon/IncomingTcpConnection.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/daemon/IncomingTcpConnection.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,98 +4,142 @@
 import java.io.IOException;
 import java.nio.channels.ClosedChannelException;
 
+import alice.datasegment.*;
+import org.msgpack.MessagePack;
 import org.msgpack.unpacker.Unpacker;
 
-import alice.codesegment.SingletonMessage;
-import alice.datasegment.Command;
-import alice.datasegment.CommandType;
-import alice.datasegment.DataSegment;
-import alice.datasegment.DataSegmentKey;
-import alice.datasegment.DataSegmentManager;
-import alice.datasegment.LocalDataSegmentManager;
-import alice.topology.HostMessage;
 import alice.topology.manager.keeparive.RespondData;
-import alice.topology.manager.reconnection.SendError;
 
 public class IncomingTcpConnection extends Thread {
-	
-	public Connection connection;
-	public DataSegmentManager manager;
-	public String reverseKey;
-	private LocalDataSegmentManager lmanager = DataSegment.getLocal();
+
+    private Connection connection;
+    protected DataSegmentManager manager;
+    protected String reverseKey;
+    private LocalDataSegmentManager lmanager = DataSegment.getLocal();
+    private CompressedLocalDataSegmentManager compressedlmanager = DataSegment.getCompressedLocal();
+    private static final MessagePack packer = new MessagePack();
+
+    public IncomingTcpConnection(DataSegmentManager manager) {
+        this.manager = manager;
+    }
+
+    public IncomingTcpConnection(Connection connection, DataSegmentManager manager, String reverseKey) {
+        this.manager = manager;
+        this.connection = connection;
+        this.reverseKey = reverseKey;
+    }
+
+    public LocalDataSegmentManager getLocalDataSegmentManager(){
+        return lmanager;
+    }
+
+    public CompressedLocalDataSegmentManager getCompressedLocalDataSegmentManager(){
+        return compressedlmanager;
+    }
+
+    /**
+     * pipeline thread for receiving
+     */
+    public void run() {
+        Unpacker unpacker = null;
+        try {
+            unpacker = packer.createUnpacker(connection.socket.getInputStream());
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        if (unpacker == null) {
+            return;
+        }
+        while (true) {
+            try {
+                Command cmd = null;
+                ReceiveData rData = null;
+                CommandMessage msg = unpacker.read(CommandMessage.class);///read header
+                CommandType type = CommandType.getCommandTypeFromId(msg.type);
+                int dataSize = unpacker.readInt();
+                byte[] data = new byte[dataSize];
+                switch (type) {
+                case UPDATE:
+                case PUT:
+                    connection.socket.getInputStream().read(data);
+                    rData = new ReceiveData(data, msg.compressed, msg.dataSize);
+
+                    /*
+                    rData = new ReceiveData(new byte[dataSize], msg.compressed, msg.dataSize);
+                    try {
+                        unpacker.readPayload(rData.getMessagePack());
+                    } catch ( );
+                      */
+
 
-	public IncomingTcpConnection(Connection connection, DataSegmentManager manager, String reverseKey) {
-		this.manager = manager;
-		this.connection = connection;
-		this.reverseKey = reverseKey;
-	}
-	
-	/**
-	 * pipeline thread for receiving
-	 */
-	public void run() {
-		Unpacker unpacker = this.getUnpacker();
-		if (unpacker == null) {
-			return;
-		}
-		while (true) {
-			try {
-				CommandMessage msg = unpacker.read(CommandMessage.class);
-				CommandType type = CommandType.getCommandTypeFromId(msg.type);
-				switch (type) {
-				case UPDATE:
-					getDataSegmentKey(msg).runCommand(new Command(type, null, null, msg.val, 0, 0, null, null, reverseKey));
-					break;
-				case PUT:
-					getDataSegmentKey(msg).runCommand(new Command(type, null, null, msg.val, 0, 0, null, null, reverseKey));
-					break;
-				case PEEK:
-					getDataSegmentKey(msg).runCommand(new Command(type, null, null, null, msg.index, msg.seq, connection, null, null, msg.flag));
-					break;
-				case TAKE:
-					getDataSegmentKey(msg).runCommand(new Command(type, null, null, null, msg.index, msg.seq, connection, null, null, msg.flag));
-					break;	
-				case REMOVE:
-					getDataSegmentKey(msg).runCommand(new Command(type, null, null, null, 0, 0, null, null, null));
-					break;
-				case REPLY:
-					Command cmd = manager.getAndRemoveCmd(msg.seq);
-					cmd.cs.ids.reply(cmd.receiver, new Command(type, null, null, msg.val, msg.index, msg.seq, null, null, null));
-					cmd=null;
-					break;
-				case PING:
-					DataSegment.get(reverseKey).response(msg.key);
-					break;
-				case RESPONSE:
-					DataSegment.getLocal().put(msg.key, new RespondData(reverseKey, System.currentTimeMillis()));
-					break;
-				default:
-					break;
-				}
-			} catch (ClosedChannelException e) {
-				connection.sendCommand(new Command(CommandType.CLOSE, null, null, null, 0, 0, null, null, null));
-				return;
-			} catch (EOFException e) {
-				new SendError(new HostMessage(connection.socket.getInetAddress().getHostName(), connection.socket.getPort())).execute();
-				connection.sendCommand(new Command(CommandType.CLOSE, null, null, null, 0, 0, null, null, null));
-				return;
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-	}
+                    if (msg.setTime) {
+                        rData.setTimes(msg.time, true, msg.depth);
+                    }
+                    if (msg.setZepped){
+                        rData.setZipped(msg.zippedDataSize, true);
+                    } else {
+                        rData.setZipped(dataSize, true);
+                    }
+
+                    cmd = new Command(type, null, null, rData, 0, 0, null, null, reverseKey);
+                    cmd.setCompressFlag(msg.compressed);
+
+                    if (rData.compressed()){
+                        compressedlmanager.getDataSegmentKey(msg.key).runCommand(cmd);
+                    } else {
+                        lmanager.getDataSegmentKey(msg.key).runCommand(cmd);
+                    }
+
+                    break;
+                case PEEK:
+                case TAKE:
+                    cmd = new Command(type, null, null, null, msg.index, msg.seq, null, null, connection);
+                    cmd.setCompressFlag(msg.compressed);
+
+                    if (msg.compressed){
+                        compressedlmanager.getDataSegmentKey(msg.key).runCommand(cmd);
+                    } else {
+                        lmanager.getDataSegmentKey(msg.key).runCommand(cmd);
+                    }
 
-	private Unpacker getUnpacker() {
-		Unpacker unpacker = null;
-		try {
-			unpacker = SingletonMessage.getInstance().createUnpacker(connection.socket.getInputStream());
-		} catch (IOException e2) {
-			e2.printStackTrace();
-		}
-		return unpacker;
-	}
+                    break;
+                case REMOVE:
+                    cmd = new Command(type, null, null, null, 0, 0, null, null, "");
+                    lmanager.getDataSegmentKey(msg.key).runCommand(cmd);//ToDo:fix
+                    break;
+                case REPLY:
+                    cmd = manager.getAndRemoveCmd(msg.seq);
+
+                    connection.socket.getInputStream().read(data);
+                    rData = new ReceiveData(data, msg.compressed, msg.dataSize);
 
-	private DataSegmentKey getDataSegmentKey(CommandMessage msg) {
-		return lmanager.getDataSegmentKey(msg.key);
-	}
+                    Command rCmd = new Command(type, null, null, rData, msg.index, msg.seq, null, null, "");
+                    cmd.setCompressFlag(msg.compressed);
+                    cmd.cs.ids.reply(cmd.receiver, rCmd);
+                    break;
+                case PING:
+                    if (DataSegment.contains(reverseKey))
+                        DataSegment.get(reverseKey).response(msg.key);
+                    break;
+                case RESPONSE:
+                    rData = new ReceiveData(new RespondData(reverseKey, System.currentTimeMillis()));
+                    DataSegment.getLocal().put(msg.key, rData, false);
+                    break;
+                default:
+                    break;
+                }
+            } catch (ClosedChannelException e) {
+                return;
+            } catch (EOFException e) {
+                return;
+            } catch (IOException e) {
+                return;
+            }
+        }
+    }
+
+    public void setReverseKey(String name) {
+        this.reverseKey = name;
+        setName(name+"-IncomingTcp");
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/daemon/IncomingUdpConnection.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,108 @@
+package alice.daemon;
+
+import java.io.EOFException;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
+
+import org.msgpack.MessagePack;
+import org.msgpack.unpacker.Unpacker;
+
+import alice.datasegment.Command;
+import alice.datasegment.CommandType;
+import alice.datasegment.DataSegment;
+import alice.datasegment.DataSegmentManager;
+import alice.datasegment.ReceiveData;
+import alice.topology.manager.keeparive.RespondData;
+
+public class IncomingUdpConnection extends IncomingTcpConnection {
+    // receive Data set into LocalDataSegment now but need to set into MulticastDataSegment.
+    // and this implement has problem. If over 65507 data receive, can not read.
+    // but  Max data length is 65507 because of the max length of UDP payload
+
+    public MulticastConnection receiver;
+    public MulticastConnection sender;
+    private static final MessagePack packer = new MessagePack();
+
+    public IncomingUdpConnection(MulticastConnection s, MulticastConnection r, DataSegmentManager manager) {
+        super(manager);
+        receiver = r;
+        sender = s;
+        reverseKey = "multicast";
+    }
+
+    @Override
+    public void run() {
+        while (true){
+            try {
+                Command cmd = null;
+                ReceiveData rData = null;
+                // Max data length is 65507 because of the max length of UDP payload
+                ByteBuffer receive = ByteBuffer.allocate(65507);
+                receiver.receive(receive);
+                Unpacker unpacker = packer.createBufferUnpacker(receive);
+                receive.flip();
+                CommandMessage msg = unpacker.read(CommandMessage.class);
+                CommandType type = CommandType.getCommandTypeFromId(msg.type);
+                int dataSize = unpacker.readInt();
+                byte [] data = new byte[dataSize];
+                switch (type) {
+                case UPDATE:
+                case PUT:
+                    receive.get(data);
+                    rData = new ReceiveData(data);
+                    cmd = new Command(type, null, null, rData, 0, 0, null, null, reverseKey);
+
+                    if (msg.compressed){
+                        getCompressedLocalDataSegmentManager().getDataSegmentKey(msg.key).runCommand(cmd);
+                    } else {
+                        getLocalDataSegmentManager().getDataSegmentKey(msg.key).runCommand(cmd);
+                    }
+                    break;
+                case PEEK:
+                case TAKE:
+                    cmd = new Command(type, null, null, null, msg.index, msg.seq, null, null ,sender);
+                    cmd.setQuickFlag(msg.quickFlag);
+                    cmd.setCompressFlag(msg.compressed);
+
+                    if (msg.compressed) {
+                        getCompressedLocalDataSegmentManager().getDataSegmentKey(msg.key).runCommand(cmd);
+                    } else {
+                        getLocalDataSegmentManager().getDataSegmentKey(msg.key).runCommand(cmd);
+                    }
+                    break;
+                case REMOVE:
+                    cmd = new Command(type, null, null, null, 0, 0, null, null, "");
+                    getLocalDataSegmentManager().getDataSegmentKey(msg.key).runCommand(cmd);
+                    break;
+                case REPLY:
+                    cmd = manager.getAndRemoveCmd(msg.seq);
+                    receive.get(data);
+                    rData = new ReceiveData(data);
+
+                    Command rCmd = new Command(type, null, null, rData, msg.index, msg.seq, null, null, "");
+                    cmd.cs.ids.reply(cmd.receiver, rCmd);
+                    break;
+                case PING:
+                    if (DataSegment.contains(reverseKey))
+                        DataSegment.get(reverseKey).response(msg.key);
+                    break;
+                case RESPONSE:
+                    rData = new ReceiveData(new RespondData(reverseKey, System.currentTimeMillis()));
+                    DataSegment.getLocal().put(msg.key, rData, false);
+                    break;
+                default:
+                    break;
+                }
+
+            } catch (ClosedChannelException e) {
+                return;
+            } catch (EOFException e) {
+                return;
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/daemon/MulticastConnection.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,50 @@
+package alice.daemon;
+
+import java.io.IOException;
+import java.net.SocketAddress;
+import java.nio.ByteBuffer;
+import java.nio.channels.DatagramChannel;
+
+import alice.datasegment.Command;
+
+public class MulticastConnection extends Connection {
+    private DatagramChannel dc;
+    private SocketAddress sAddr;
+
+    public MulticastConnection(DatagramChannel d, SocketAddress s) {
+        dc = d;
+        sAddr = s;
+    }
+
+    // may need to add infomation who send on ds.
+    @Override
+    public synchronized void write(Command cmd){
+        ByteBuffer buffer = cmd.convert();
+        try {
+            while (buffer.hasRemaining()){
+                dc.send(buffer, sAddr);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    @Override
+    public void close(){
+        try {
+            dc.close();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void receive(ByteBuffer receiveData){
+        try {
+            dc.receive(receiveData);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+}
--- a/src/main/java/alice/daemon/OutboundTcpConnection.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/daemon/OutboundTcpConnection.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,42 +1,37 @@
 package alice.daemon;
 
-import java.io.IOException;
 import alice.datasegment.Command;
 
 public class OutboundTcpConnection extends Thread {
-	
-	public Connection connection;
-	
-	public OutboundTcpConnection(Connection connection) {
-		this.connection = connection;
-	}
-	
-	
-	
-	/**
-	 * pipeline thread for transmission
-	 */
-	public void run() {
-		while (true) {
-			try {
-				Command cmd = connection.sendQueue.take();
-				switch (cmd.type) {
-				case CLOSE:
-					connection.socket.close();
-					return;
-				case FINISH:
-					System.exit(0);
-					return;
-				default:
-					break;
-				}
-				connection.write(cmd);
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-	}
-	
+
+    public Connection connection;
+
+    public OutboundTcpConnection(Connection connection) {
+        this.connection = connection;
+    }
+
+    /**
+     * pipeline thread for transmission
+     */
+    public void run() {
+        while (true) {
+            try {
+                Command cmd = connection.sendQueue.take();
+                switch (cmd.type) {
+                case CLOSE:
+                    connection.close();
+                    return;
+                case FINISH:
+                    System.exit(0);
+                    return;
+                default:
+                    break;
+                }
+                connection.write(cmd);//ここでconvert()がよばれてる
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
 }
--- a/src/main/java/alice/datasegment/Command.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/datasegment/Command.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,110 +1,167 @@
 package alice.datasegment;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.concurrent.BlockingQueue;
-import org.msgpack.type.Value;
+
+import org.msgpack.MessagePack;
 
 import alice.codesegment.CodeSegment;
-import alice.codesegment.SingletonMessage;
 import alice.daemon.CommandMessage;
 import alice.daemon.Connection;
 
+/**
+ * DSMで使われる各コマンドのセット(ReceiveDataからのDSの読み込み)
+ */
 public class Command {
-	public CommandType type;
-	public String key;
-	public Receiver receiver;
-	public Value val;
-	public int index;
-	public int seq;
-	public Connection connection; // for remote
-	public BlockingQueue<Command> replyQueue;
-	public CodeSegment cs;
-	public String reverseKey;
-	public Object obj;
-	public boolean flag;
+    public CommandType type;//PEEK, PUTなどのコマンドタイプ
+    public String key;
+    public Receiver receiver;
+    public ReceiveData rData;
+    public int index;//使ってない。アクセス用のindex。負の遺産。
+    public int seq;//DSの待ち合わせを行っているCSを表すunique number。リモート用。対応コマンドを表す。
+    public Connection connection; // for remote
+    public BlockingQueue<Command> replyQueue;//PEEK/TAKE必要な返り値?
+    public CodeSegment cs;
+    public String reverseKey;//どこからput/updateされたか
+    private boolean quickFlag = false;//SEDAを挟まずに処理を行うかどうか。trueだとリモート
+    private boolean compressFlag = false;//trueだったら圧縮する必要がある
+
+    private static final MessagePack packer = new MessagePack();
+
+    /**
+     * for PEEK/TAKE
+     */
+    public Command(CommandType cmdType, Receiver receiver, String key, ReceiveData rData, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) {
+        this.type = cmdType;
+        this.receiver = receiver;
+        this.key = key;
+        this.rData = rData;
+        this.index = index;
+        this.seq = seq;
+        this.replyQueue = replyQueue;
+        this.cs = cs;
+        this.reverseKey = reverseKey;
+    }
+
+    /**
+     * for PUT/UPDATE/REPLY/PING/RESPONSE
+     */
+    public Command(CommandType cmdType, Receiver receiver, String key, ReceiveData rData, int index, int seq, CodeSegment cs, String reverseKey, Connection connection) {
+        this.type = cmdType;
+        this.receiver = receiver;
+        this.key = key;
+        this.rData = rData;
+        this.index = index;
+        this.seq = seq;
+        this.connection = connection;
+        this.cs = cs;
+        this.reverseKey = reverseKey;
+    }
+
+    /**
+     * String型でコマンドを取得するメソッド。たぶんログ表示用。
+     * @return
+     */
+    public String getCommandString() {
+        String csName = "null";
+        if (cs != null) {
+            csName = cs.toString();
+        }
+        return this.type + "\t" + key + "\t" + rData + "\tindex=" + index + "\tcs=" + csName;
+    }
+    /**
+     * @return serialized ByteBuffer
+     */
+    public ByteBuffer convert() {
+        ByteBuffer buf = null;
 
-	public Command(CommandType cmdType, Receiver receiver, String key, Value val, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) {
-		this.type = cmdType;
-		this.receiver = receiver;
-		this.key = key;
-		this.val = val;
-		this.index = index;
-		this.seq = seq;
-		this.replyQueue = replyQueue;
-		this.cs = cs;
-		this.reverseKey = reverseKey;
-		this.flag = false;
-	}
-	
-	public Command(CommandType cmdType, Receiver receiver, String key, Value val, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey, boolean flag) {
-		this.type = cmdType;
-		this.receiver = receiver;
-		this.key = key;
-		this.val = val;
-		this.index = index;
-		this.seq = seq;
-		this.replyQueue = replyQueue;
-		this.cs = cs;
-		this.reverseKey = reverseKey;
-		this.flag = flag;
-	}
-	
-	public Command(CommandType cmdType, Receiver receiver, String key, Value val, int index, int seq, Connection connection, CodeSegment cs, String reverseKey, boolean flag) {
-		this.type = cmdType;
-		this.receiver = receiver;
-		this.key = key;
-		this.val = val;
-		this.index = index;
-		this.seq = seq;
-		this.connection = connection;
-		this.cs = cs;
-		this.reverseKey = reverseKey;
-		this.flag = flag;
-	}
-	
-	public Command(CommandType cmdType, Receiver receiver, String key, Object obj, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) {
-		this.type = cmdType;
-		this.receiver = receiver;
-		this.key = key;
-		this.obj = obj;
-		this.index = index;
-		this.seq = seq;
-		this.replyQueue = replyQueue;
-		this.cs = cs;
-		this.reverseKey = reverseKey;
-		this.flag = false;
-	}
-	
-	public Command(CommandType cmdType, Receiver receiver, String key, Value val, Object obj, int index, int seq, BlockingQueue<Command> replyQueue, CodeSegment cs, String reverseKey) {
-		this.type = cmdType;
-		this.receiver = receiver;
-		this.key = key;
-		this.val = val;
-		this.obj = obj;
-		this.index = index;
-		this.seq = seq;
-		this.replyQueue = replyQueue;
-		this.cs = cs;
-		this.reverseKey = reverseKey;
-		this.flag = false;
-	}
-	
-	public String getCommandString() {
-		String csName = "null";
-		if (cs != null) {
-			csName = cs.toString();
-		}
-		return this.type + "\t" + key + "\t" + val + "\tindex=" + index + "\tcs=" + csName;
-	}
-	public CommandMessage convert() {
-		if (val==null&&obj!=null){
-			try {
-				this.val = SingletonMessage.getInstance().unconvert(obj);
-			} catch (IOException e) {
-				e.printStackTrace();
-			}
-		}
-		return new CommandMessage(type.id, index, seq, key, val, flag);
-	}
-	
+        try {
+            byte[] header = null;
+            byte[] data = null;
+            byte[] dataSize = null;
+            switch (type) {
+        /*
+         * UPDATE, PUT, REPLY need send DataSegment to RemoteDataSegment
+         * case UPDATE and PUT
+         * compress and serialize flag are selected by user, so if true, need convert.
+         * case REPLY
+         * these flags represent DataSegment status.
+         * for example, serializeFlag is true. DataSegment had already converted, so no need convert.
+         */
+                case UPDATE:
+                case PUT:
+                case REPLY:
+                    if(compressFlag){
+                        data = rData.getZMessagePack();
+                    } else {
+                        data = rData.getMessagePack();
+                    }
+
+                    CommandMessage cm = new CommandMessage(type.id, index, seq, key, false, compressFlag, rData.getDataSize());
+                    if (rData.getSetTime()) {
+                        cm.setTime = true;
+                        cm.time = rData.getTime();
+                        cm.depth = rData.getDepth() + 1;
+                    }
+
+                    if (rData.getSetZipped()){
+                        cm.setZepped = true;
+                        cm.zippedDataSize = rData.getZippedDataSize();
+                    }
+
+                    header = packer.write(cm);
+                    dataSize = packer.write(data.length);
+                    buf = ByteBuffer.allocate(header.length+dataSize.length+data.length);
+                    buf.put(header);
+                    buf.put(dataSize);
+                    buf.put(data);
+                    break;
+                default:
+                    header = packer.write(new CommandMessage(type.id, index, seq, key, quickFlag, compressFlag, 0));
+                    buf = ByteBuffer.allocate(header.length);
+                    buf.put(header);
+                    break;
+            }
+
+            buf.flip();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return buf;
+    }
+
+    /**
+     * If this flag is true, command isn't send queue.
+     * command is executed right now.
+     *
+     * @param flag
+     */
+
+    public void setQuickFlag(boolean flag){
+        quickFlag = flag;
+    }
+
+    public boolean getQuickFlag(){
+        return quickFlag;
+    }
+
+    /**
+     * Before sending Remote DataSegment, DataSegment type is ByteArray.
+     * If this flag true, ByteArray is compressed with ZRLEE(ZRIB) algorithm
+     *
+     * @param flag
+     */
+
+    public void setCompressFlag(boolean flag){
+        compressFlag = flag;
+    }
+
+    public boolean getCompressFlag(){
+        return compressFlag;
+    }
+
+    public void setSeq(int seq) {
+        this.seq = seq;
+    }
 }
--- a/src/main/java/alice/datasegment/CommandType.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/datasegment/CommandType.java	Thu Nov 30 19:42:31 2017 +0900
@@ -3,46 +3,46 @@
 import java.util.HashMap;
 
 public enum CommandType {
-	PUT,
-	UPDATE, // remove a DataSegment value and put
-	PEEK,
-	TAKE,
-	REMOVE,
-	REPLY,
-	CLOSE,
-	FINISH, 
-	PING,
-	RESPONSE;
-	
-	public int id;
-	public static HashMap<Integer, CommandType> hash = new HashMap<Integer, CommandType>();
-	private static int lastId = 0;
-	
-	private CommandType(int id) {
-		this.id = id;
-		setLastId(id);
-	}
-	
-	private CommandType() {
-		this.id = incrementLastId();
-	}
-	
-	private void setLastId(int id) {
-		lastId =id;
-	}
-	
-	private int incrementLastId() {
-		return ++lastId;
-	}
-	
-	public static CommandType getCommandTypeFromId(int id) {
-		return hash.get(id);
-	}
-	
-	static {
-		for (CommandType type : CommandType.values()) {
-			hash.put(type.id, type);
-		}
-	}
-	
+    PUT,
+    UPDATE, // remove a DataSegment value and put
+    PEEK,
+    TAKE,
+    REMOVE,//keyごと消すかもしれない
+    REPLY,//PEEK/TAKEに対応
+    CLOSE,
+    FINISH,
+    PING,//heart beat 用
+    RESPONSE;//heart beat 用
+
+    public int id;//コマンドのid
+    public static HashMap<Integer, CommandType> hash = new HashMap<Integer, CommandType>();//コマンド対応表
+    private static int lastId = 0;//コマンドの総数
+
+    private CommandType(int id) {
+        this.id = id;
+        setLastId(id);
+    }
+
+    private CommandType() {
+        this.id = incrementLastId();
+    }
+
+    private void setLastId(int id) {
+        lastId =id;
+    }
+
+    private int incrementLastId() {
+        return ++lastId;
+    }
+
+    public static CommandType getCommandTypeFromId(int id) {
+        return hash.get(id);
+    }
+
+    static {
+        for (CommandType type : CommandType.values()) {
+            hash.put(type.id, type);
+        }
+    }
+
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/datasegment/CompressedLocalDataSegmentManager.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,128 @@
+package alice.datasegment;
+
+import java.io.IOException;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.log4j.Logger;
+
+import alice.codesegment.CodeSegment;
+
+public class CompressedLocalDataSegmentManager extends DataSegmentManager {
+
+    LocalDataSegmentManager manager;
+    private String reverseKey = "compressedlocal";
+
+    public CompressedLocalDataSegmentManager(LocalDataSegmentManager manager) {
+        this.manager = manager;
+    }
+
+    public void setReverseKey(String s){
+        reverseKey = s;
+    }
+
+    public void submitCommand(DataSegmentKey key, Command cmd) {
+        manager.submitCommand(key, cmd);
+    }
+
+    public DataSegmentKey getDataSegmentKey(String key) {
+        return manager.getDataSegmentKey(key);
+    }
+
+    public void removeDataSegmentKey(String key) {
+        manager.removeDataSegmentKey(key);
+    }
+
+    @Override
+    public void put(String key, ReceiveData rData, boolean quickFlag) {
+        if (!rData.compressed()){
+            try {
+                rData.zip();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        Command cmd = new Command(CommandType.PUT, null, key, rData, 0, 0, null, null, reverseKey);
+        cmd.setCompressFlag(true);
+
+        manager.put1(key, cmd);
+    }
+
+    /**
+     * Enqueue update command to the queue of each DataSegment key
+     */
+
+    @Override
+    public void update(String key, ReceiveData rData, boolean quickFlag) {
+
+        if (!rData.compressed()){
+            try {
+                rData.zip();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+
+        Command cmd = new Command(CommandType.UPDATE, null, key, rData, 0, 0, null, null, reverseKey);
+        cmd.setCompressFlag(true);
+
+        manager.put1(key, cmd);
+    }
+
+    @Override
+    public void take(Receiver receiver, CodeSegment cs, boolean quickFlag) {
+        Command cmd = new Command(CommandType.TAKE, receiver, receiver.key, null, receiver.index, 0, replyQueue, cs, null);
+        cmd.setCompressFlag(true);
+
+        manager.take1(receiver, cmd);
+    }
+
+    @Override
+    public void peek(Receiver receiver, CodeSegment cs, boolean quickFlag) {
+        Command cmd = new Command(CommandType.PEEK, receiver, receiver.key, null, receiver.index, 0, replyQueue, cs, null);
+        cmd.setCompressFlag(true);
+
+        manager.take1(receiver, cmd);
+    }
+
+    @Override
+    public void remove(String key) {
+        manager.remove(key);
+    }
+
+    @Override public void finish() {
+        manager.finish();
+    }
+
+    @Override
+    public void close() {
+
+    }
+
+    public void recommand(Receiver receiver, CodeSegment cs) {
+        manager.recommand(receiver, cs);
+    }
+
+    @Override
+    public void ping(String returnKey) {
+
+    }
+
+    @Override
+    public void response(String returnKey) {
+
+    }
+
+    @Override
+    public void shutdown() {
+
+    }
+
+    @Override
+    public void setSendError(boolean b) {
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/datasegment/CompressedRemoteDataSegmentManager.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,106 @@
+package alice.datasegment;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.nio.channels.SocketChannel;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.log4j.Logger;
+
+import alice.codesegment.CodeSegment;
+import alice.daemon.Connection;
+import alice.daemon.IncomingTcpConnection;
+import alice.daemon.OutboundTcpConnection;
+
+public class CompressedRemoteDataSegmentManager extends DataSegmentManager {
+    RemoteDataSegmentManager manager;
+
+    public CompressedRemoteDataSegmentManager(RemoteDataSegmentManager manager) {
+        this.manager = manager;
+    }
+
+    /**
+     * send put command to target DataSegment
+     */
+    @Override
+    public void put(String key, ReceiveData rData, boolean quickFlag) {
+        if (!rData.compressed()){
+            try {
+                rData.zip();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        Command cmd = new Command(CommandType.PUT, null, key, rData, 0, 0, null, null, "");
+        cmd.setCompressFlag(true);
+
+        manager.put1(quickFlag, cmd);
+    }
+
+    @Override
+    public void update(String key, ReceiveData rData, boolean quickFlag) {
+        if (!rData.compressed()){
+            try {
+                rData.zip();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        Command cmd = new Command(CommandType.UPDATE, null, key, rData, 0, 0, null, null, "");
+        cmd.setCompressFlag(true);
+
+        manager.put1(quickFlag, cmd);
+    }
+
+    @Override
+    public void take(Receiver receiver, CodeSegment cs, boolean quickFlag) {
+        Command cmd = new Command(CommandType.TAKE, receiver, receiver.key, null, receiver.index, 0, replyQueue, cs, null);
+        cmd.setCompressFlag(true);
+
+        manager.take1(quickFlag, cmd);
+    }
+
+    @Override
+    public void peek(Receiver receiver, CodeSegment cs, boolean quickFlag) {
+        Command cmd = new Command(CommandType.PEEK, receiver, receiver.key, null, receiver.index, 0, replyQueue, cs, null);
+        cmd.setCompressFlag(true);
+
+        manager.take1(quickFlag, cmd);
+    }
+
+    @Override
+    public void remove(String key) {
+        manager.remove(key);
+    }
+
+    @Override
+    public void finish() {
+        manager.finish();
+    }
+
+    @Override
+    public void ping(String returnKey) {
+        manager.ping(returnKey);
+    }
+
+    @Override
+    public void response(String returnKey) {
+        manager.response(returnKey);
+    }
+
+    @Override
+    public void close() {
+        manager.close();
+    }
+
+    @Override
+    public void shutdown() {
+        manager.shutdown();
+    }
+
+    @Override
+    public void setSendError(boolean b) {
+        manager.setSendError(b);
+    }
+
+}
--- a/src/main/java/alice/datasegment/DataSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/datasegment/DataSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -3,46 +3,78 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import alice.daemon.IncomingTcpConnection;
+import alice.datasegment.MulticastDataSegmentManager.SocketType;
+import org.apache.log4j.Logger;
 
 public class DataSegment {
-	
-	private static DataSegment dataSegment = new DataSegment();
-	private LocalDataSegmentManager local = new LocalDataSegmentManager();
-	private ConcurrentHashMap<String, DataSegmentManager> dataSegmentManagers = new ConcurrentHashMap<String, DataSegmentManager>(); //TODO Over Head
-	private ConcurrentHashMap<String, IncomingTcpConnection> acceptHash = new ConcurrentHashMap<String, IncomingTcpConnection>();
-	
-	private DataSegment() {
-		dataSegmentManagers.put("local", local);
-	}
-	
-	public static DataSegmentManager get(String key) {
-		return dataSegment.dataSegmentManagers.get(key);
-	}
+
+    private static DataSegment dataSegment = new DataSegment();
+    private LocalDataSegmentManager local = new LocalDataSegmentManager();
+    private CompressedLocalDataSegmentManager compressedLocal = new CompressedLocalDataSegmentManager(local);//追加
+    private ConcurrentHashMap<String, DataSegmentManager> dataSegmentManagers = new ConcurrentHashMap<String, DataSegmentManager>(); //TODO Over Head
+    private ConcurrentHashMap<String, IncomingTcpConnection> acceptHash = new ConcurrentHashMap<String, IncomingTcpConnection>();
+
+    private DataSegment() {
+        dataSegmentManagers.put("local", local);
+        dataSegmentManagers.put("compressedlocal", compressedLocal);
+    }
+
+    public static DataSegmentManager get(String key) {
+        if (key == null){
+            return dataSegment.dataSegmentManagers.get("local");
+        } else {
+            return dataSegment.dataSegmentManagers.get(key);
+        }
+    }
+
+    public static LocalDataSegmentManager getLocal() {
+        return dataSegment.local;
+    }
+
+    public static CompressedLocalDataSegmentManager getCompressedLocal() {//追加
+        return dataSegment.compressedLocal;
+    }
+
+    public static void register(String key, DataSegmentManager manager) {
+        dataSegment.dataSegmentManagers.put(key, manager);
+    }
 
-	public static LocalDataSegmentManager getLocal() {
-		return dataSegment.local;
-	}
-	
-	public static void register(String key, DataSegmentManager manager) {
-		dataSegment.dataSegmentManagers.put(key, manager);
-	}
-	
-	public static RemoteDataSegmentManager connect(String connectionKey, String reverseKey, String hostName, int port, boolean rFlag) {
-		RemoteDataSegmentManager manager = new RemoteDataSegmentManager(connectionKey, reverseKey, hostName, port, rFlag);
-		register(connectionKey, manager);
-		return manager;
-	}
-	
-	public static void setAccept(String key, IncomingTcpConnection incoming) {
-		dataSegment.acceptHash.put(key, incoming);
-	}
-	
-	public static IncomingTcpConnection getAccept(String key) {
-		return dataSegment.acceptHash.get(key);
-	}
-	
-	public static void remove(String key){
-		dataSegment.dataSegmentManagers.remove(key);
-	}
-	
+    public static RemoteDataSegmentManager connect(String connectionKey, String reverseKey, String hostName, int port) {
+        if (connectionKey.startsWith("compressed")){//compressedが含まれていたらエラーを返して終了
+            System.out.println("You can't use 'compressed' for DataSegmentManager name.");
+            System.exit(0);
+        }
+        RemoteDataSegmentManager manager = new RemoteDataSegmentManager(connectionKey, reverseKey, hostName, port);
+        CompressedRemoteDataSegmentManager compressedManager = new CompressedRemoteDataSegmentManager(manager);
+
+        register(connectionKey, manager);
+        register("compressed" + connectionKey, compressedManager);
+
+        System.out.println("connected to " + hostName + " DSMkey: " + connectionKey);
+
+        return manager;
+    }
+
+    public static MulticastDataSegmentManager connectMulticast(String connectionKey ,String MCSTADDR, int port, String nis, SocketType type){
+        MulticastDataSegmentManager manager = new MulticastDataSegmentManager(connectionKey ,MCSTADDR,  port, nis, type);
+        if (type!=SocketType.Receiver)
+            register(connectionKey, manager);
+        return manager;
+    }
+
+    public static void setAccept(String key, IncomingTcpConnection incoming) {
+        dataSegment.acceptHash.put(key, incoming);
+    }
+
+    public static IncomingTcpConnection getAccept(String key) {
+        return dataSegment.acceptHash.get(key);
+    }
+
+    public static void remove(String key){
+        dataSegment.dataSegmentManagers.remove(key);
+    }
+
+    public static boolean contains(String key){
+        return dataSegment.dataSegmentManagers.containsKey(key);
+    }
 }
--- a/src/main/java/alice/datasegment/DataSegmentKey.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/datasegment/DataSegmentKey.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,103 +1,115 @@
 package alice.datasegment;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Iterator;
 
-import alice.datasegment.Command; 
+import alice.datasegment.Command;
 
 /**
+ * ここがコマンドの中身部分
+ *
  * Synchronized DataSegment for each DataSegment key
  * @author kazz
  *
  */
 public class DataSegmentKey {
-	
-	private ArrayList<DataSegmentValue> dataList = new ArrayList<DataSegmentValue>();
-	private ArrayList<Command> waitList = new ArrayList<Command>();
-	private int tailIndex = 1;
-	
-	public synchronized void runCommand(Command cmd) {
-		switch (cmd.type) {
-		case UPDATE:
-			if (dataList.size() != 0) {
-				dataList.remove(0);
-			}
-		case PUT:
-			int index = tailIndex;
-			tailIndex++;
-			DataSegmentValue dsv = new DataSegmentValue(index, cmd.val, cmd.obj, cmd.reverseKey); 
-			dataList.add(dsv);
-			// Process waiting peek and take commands
-			for (Iterator<Command> iter = waitList.iterator(); iter.hasNext(); ) {
-				Command waitCmd = iter.next();
-				if (waitCmd.index < index) {
-					replyValue(waitCmd ,dsv);
-					iter.remove();
-					if (waitCmd.type == CommandType.TAKE) { // someone is waiting for this put or update command
-						dataList.remove(dsv);
-						break;
-					}
-				}
-			}
-			break;
-		case PEEK:
-			if (cmd.index >= tailIndex) {
-				waitList.add(cmd);
-				break;
-			}
-			boolean waitFlag2 = true;
-			for (DataSegmentValue data : dataList) {
-				if (data.index > cmd.index) {
-					replyValue(cmd ,data);
-					waitFlag2 = false;
-					break;
-				}
-			}
-			if (waitFlag2)
-				waitList.add(cmd);
-			break;
-		case TAKE:
-			if (cmd.index >= tailIndex) {
-				waitList.add(cmd);
-				break;
-			}
-			boolean waitFlag = true;
-			for (Iterator<DataSegmentValue> iter = dataList.iterator(); iter.hasNext(); ) {
-				DataSegmentValue data = iter.next();
-				if (data.index > cmd.index) {
-					replyValue(cmd ,data);
-					iter.remove();
-					waitFlag = false;
-					break;
-				}
-			}
-			if (waitFlag)
-				waitList.add(cmd);
-			break;
-		case REMOVE:
-			// TODO: implements later
-			break;
-		default:
-		}
+
+    private ArrayList<DataSegmentValue> dataList = new ArrayList<DataSegmentValue>();
+    private ArrayList<Command> waitList = new ArrayList<Command>();
+    private int tailIndex = 1;
 
-	}
-	
-	public void replyValue(Command cmd, DataSegmentValue data){
-		if (cmd.cs!=null){ // if cmd has cs-instance, it means Command from local.
-			cmd.cs.ids.reply(cmd.receiver, new Command(CommandType.REPLY, null, null, data.val, data.obj, data.index, cmd.seq, null, null, data.from));
-		} else {
-			try {
-				if (!cmd.flag){ 
-					cmd.connection.sendQueue.put(new Command(CommandType.REPLY, null, null, data.val, data.obj, data.index, cmd.seq, null, null, data.from));
-				}
-				else {
-					cmd.connection.write(new Command(CommandType.REPLY, null, null, data.val, data.obj, data.index, cmd.seq, null, null, data.from));
-				}
-				
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-		}
-	}
-	
+    public synchronized void runCommand(Command cmd) {
+        switch (cmd.type) {
+        case UPDATE:
+            if (dataList.size() != 0) {
+                dataList.remove(0);
+            }
+        case PUT:
+            int index = tailIndex;
+            tailIndex++;
+            DataSegmentValue dsv = new DataSegmentValue(index, cmd.rData, cmd.reverseKey);
+            dataList.add(dsv);
+            // Process waiting peek and take commands
+            for (Iterator<Command> iter = waitList.iterator(); iter.hasNext(); ) {
+                Command waitCmd = iter.next();
+                if (waitCmd.index < index) {
+                    replyValue(waitCmd, dsv, cmd.getCompressFlag());
+                    iter.remove();
+                    if (waitCmd.type == CommandType.TAKE) { // someone is waiting for this put or update command
+                        dataList.remove(dsv);
+                        break;
+                    }
+                }
+            }
+            break;
+        case PEEK:
+            if (cmd.index >= tailIndex) {
+                waitList.add(cmd);
+                break;
+            }
+            boolean waitFlag2 = true;
+            for (DataSegmentValue data : dataList) {
+                if (data.index > cmd.index) {
+                    replyValue(cmd, data, cmd.getCompressFlag());
+                    waitFlag2 = false;
+                    break;
+                }
+            }
+            if (waitFlag2)
+                waitList.add(cmd);
+            break;
+        case TAKE:
+            if (cmd.index >= tailIndex) {
+                waitList.add(cmd);
+                break;
+            }
+            boolean waitFlag = true;
+            for (Iterator<DataSegmentValue> iter = dataList.iterator(); iter.hasNext(); ) {
+                DataSegmentValue data = iter.next();
+                if (data.index > cmd.index) {
+                    replyValue(cmd, data, cmd.getCompressFlag());
+                    iter.remove();
+                    waitFlag = false;
+                    break;
+                }
+            }
+            if (waitFlag)
+                waitList.add(cmd);
+            break;
+        case REMOVE:
+            // TODO: implements later
+            break;
+        default:
+        }
+
+    }
+
+    public void replyValue(Command cmd, DataSegmentValue data, boolean cFlag){
+        if (cFlag && !data.rData.compressed()){
+            try {
+                data.rData.zip();
+                System.out.println("in reply zip");
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        Command rCmd = new Command(CommandType.REPLY, null, null, data.rData, data.index, cmd.seq, null, null, data.from);
+        rCmd.setCompressFlag(cFlag);
+
+        if (cmd.cs!=null){ // if cmd has cs-instance, it means Command from local.
+            cmd.cs.ids.reply(cmd.receiver, rCmd);
+        } else {
+            try {
+                if (!cmd.getQuickFlag()) {
+                    cmd.connection.sendQueue.put(rCmd);
+                } else {
+                    cmd.connection.write(rCmd);
+                }
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
 }
--- a/src/main/java/alice/datasegment/DataSegmentManager.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/datasegment/DataSegmentManager.java	Thu Nov 30 19:42:31 2017 +0900
@@ -9,63 +9,62 @@
 import alice.codesegment.CodeSegment;
 
 public abstract class DataSegmentManager {
-	
-	protected ConcurrentHashMap<Integer, Command> seqHash = new ConcurrentHashMap<Integer, Command>();
-	protected LinkedBlockingQueue<Command> replyQueue = new LinkedBlockingQueue<Command>();
-	protected AtomicInteger seq = new AtomicInteger(1); // waiting for PUT or UPDATE at unique sequence number
-														// but it doesn't need for Local
-	
-	protected Runnable replyThread = new Runnable() {
-		Logger logger = Logger.getLogger("reply");
-		@Override
-		public void run() {
-			while (true) {
-				try {
-					Command reply = replyQueue.take();
-					Command cmd = getAndRemoveCmd(reply.seq);
-					if (cmd == null) {
-						logger.warn("conflict sequence number");
-						continue;
-					}
-					cmd.cs.ids.reply(cmd.receiver, reply);
-					if (logger.isDebugEnabled())
-						logger.debug(reply.getCommandString() + " " + cmd.getCommandString());
-				} catch (InterruptedException e) {
-					e.printStackTrace();
-				}
-			}
-		}
-		
-	};
-	
-	public Command getAndRemoveCmd(int index){
-		return seqHash.remove(index);
-	}
-	
-	public void addReplyCommand(Command cmd) {
-		try {
-			replyQueue.put(cmd);
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-	}
-		
-	public abstract void put(String key, Object val);
-	public abstract void update(String key, Object val);
-	public abstract void take(Receiver receiver, CodeSegment cs);
-	public abstract void peek(Receiver receiver, CodeSegment cs);
-	
-	public abstract void quickPut(String key, Object val);
-	public abstract void quickUpdate(String key, Object val);
-	public abstract void quickPeek(Receiver receiver, CodeSegment cs);
-	public abstract void quickTake(Receiver receiver, CodeSegment cs);
+
+    protected ConcurrentHashMap<Integer, Command> seqHash = new ConcurrentHashMap<Integer, Command>();
+    protected LinkedBlockingQueue<Command> replyQueue = new LinkedBlockingQueue<Command>();
+    protected AtomicInteger seq = new AtomicInteger(1); // waiting for PUT or UPDATE at unique sequence number
+                                                        // but it doesn't need for Local
+
+    protected Runnable replyThread = new Runnable() {
+        Logger logger = Logger.getLogger("reply");
+        @Override
+        public void run() {//SEDAのREPLYスレッドのなごり。消してもいい。
+            while (true) {
+                try {
+                    Command reply = replyQueue.take();
+                    Command cmd = getAndRemoveCmd(reply.seq);
+                    if (cmd == null) {
+                        logger.warn("conflict sequence number");
+                        continue;
+                    }
+                    cmd.cs.ids.reply(cmd.receiver, reply);
+                    if (logger.isDebugEnabled())
+                        logger.debug(reply.getCommandString() + " " + cmd.getCommandString());
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+    };
 
-	public abstract void remove(String key);
-	public abstract void shutdown();
-	public abstract void close();
-	public abstract void finish();
-	
-	public abstract void ping(String returnKey);
-	public abstract void response(String returnKey);
-		
+    public Command getAndRemoveCmd(int index){
+        //System.err.println("DSM getAndRemoveCmd seq : " + index);
+        return seqHash.remove(index);
+    }
+
+    public void addReplyCommand(Command cmd) {
+        try {
+            replyQueue.put(cmd);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    //各コマンドの抽象クラス
+    public abstract void put(String key, ReceiveData rData, boolean quickFlag);
+    public abstract void update(String key, ReceiveData rData, boolean quickFlag);
+    public abstract void peek(Receiver receiver, CodeSegment cs, boolean quickFlag);
+    public abstract void take(Receiver receiver, CodeSegment cs, boolean quickFlag);
+
+    public abstract void remove(String key);
+    public abstract void shutdown();
+    public abstract void close();
+    public abstract void finish();
+
+    public abstract void ping(String returnKey);
+    public abstract void response(String returnKey);
+
+    public abstract void setSendError(boolean b);
+
 }
--- a/src/main/java/alice/datasegment/DataSegmentValue.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/datasegment/DataSegmentValue.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,25 +1,15 @@
 package alice.datasegment;
 
-import org.msgpack.type.Value;
-
 public class DataSegmentValue {
 
-	public int index;
-	public Value val;
-	public String from;
-	public Object obj;
-	
-	public DataSegmentValue(int index, Value val, Object obj,String reverseKey) {
-		this.index = index;
-		this.val = val;
-		this.from = reverseKey;
-		this.obj = obj;
-	}
-	
-	public DataSegmentValue(int index, Value val,String reverseKey) {
-		this.index = index;
-		this.val = val;
-		this.from = reverseKey;
-	}
-	
+    public int index;
+    public ReceiveData rData;
+    public String from;
+
+    public DataSegmentValue(int index, ReceiveData rData, String reverseKey) {
+        this.index = index;
+        this.rData = rData;
+        this.from = reverseKey;
+    }
+
 }
--- a/src/main/java/alice/datasegment/LocalDataSegmentManager.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/datasegment/LocalDataSegmentManager.java	Thu Nov 30 19:42:31 2017 +0900
@@ -10,163 +10,155 @@
 import alice.codesegment.CodeSegment;
 
 public class LocalDataSegmentManager extends DataSegmentManager {
-	
-	private String reverseKey = "local";
-	private ConcurrentHashMap<String, DataSegmentKey> dataSegments = new ConcurrentHashMap<String, DataSegmentKey>();
-	private Logger logger = Logger.getLogger("local");
+
+    private String reverseKey = "local";
+    private ConcurrentHashMap<String, DataSegmentKey> dataSegments = new ConcurrentHashMap<String, DataSegmentKey>();
+    private Logger logger = Logger.getLogger("local");
+
+    private ThreadPoolExecutor dataSegmentExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), // initial number of threads
+            Runtime.getRuntime().availableProcessors(),
+            Integer.MAX_VALUE, // keepAliveTime
+            TimeUnit.SECONDS,
+            new LinkedBlockingQueue<Runnable>());
+
+    public LocalDataSegmentManager() {
+        new Thread(replyThread, "LocalDataSegmentManager-replyCommand").start();
+    }
+
+    public void setReverseKey(String s){
+        reverseKey = s;
+    }
+
+    private class RunCommand implements Runnable {
+
+        DataSegmentKey key;
+        Command cmd;
+
+        public RunCommand(DataSegmentKey key, Command cmd) {
+            this.key = key;
+            this.cmd = cmd;
+        }
+
+        @Override
+        public void run() {
+            key.runCommand(cmd);
+        }
+
+    }
 
-	private ThreadPoolExecutor dataSegmentExecutor = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), // initial number of threads
-			Runtime.getRuntime().availableProcessors(),
-			Integer.MAX_VALUE, // keepAliveTime
-			TimeUnit.SECONDS,
-			new LinkedBlockingQueue<Runnable>());
-	
-	public LocalDataSegmentManager() {
-		new Thread(replyThread, "LocalDataSegmentManager-replyCommand").start();
-	}
+    public void submitCommand(DataSegmentKey key, Command cmd) {
+        dataSegmentExecutor.execute(new RunCommand(key, cmd));
+    }
+
+    public DataSegmentKey getDataSegmentKey(String key) {
+        DataSegmentKey dsKey = dataSegments.get(key);
+        if (dsKey != null)
+            return dsKey;
+        if (key == null)
+            return null;
+        DataSegmentKey newDataSegmentKey = new DataSegmentKey();
+        DataSegmentKey dataSegmentKey = dataSegments.putIfAbsent(key, newDataSegmentKey);
+        if (dataSegmentKey == null) {
+            dataSegmentKey = newDataSegmentKey;
+        }
+        return dataSegmentKey;
+    }
+
+    public void removeDataSegmentKey(String key) {
+        if (key!=null)
+            dataSegments.remove(key);
+    }
+
+    @Override
+    public void put(String key, ReceiveData rData, boolean quickFlag) {
+        Command cmd = new Command(CommandType.PUT, null, key, rData, 0, 0, null, null, reverseKey);
+        put1(key, cmd);
+    }
+
+    public void put1(String key, Command cmd) {
+        DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
+        dataSegmentKey.runCommand(cmd);
+        if (logger.isDebugEnabled())
+            logger.debug(cmd.getCommandString());
+    }
+
+    /**
+     * Enqueue update command to the queue of each DataSegment key
+     */
 
-	private class RunCommand implements Runnable {
-		
-		DataSegmentKey key;
-		Command cmd;
-		
-		public RunCommand(DataSegmentKey key, Command cmd) {
-			this.key = key;
-			this.cmd = cmd;
-		}
-		
-		@Override
-		public void run() {
-			key.runCommand(cmd);
-		}
-		
-	}
-	
-	public void submitCommand(DataSegmentKey key, Command cmd) {
-		dataSegmentExecutor.execute(new RunCommand(key, cmd));
-	}
-	
-	public DataSegmentKey getDataSegmentKey(String key) {
-		DataSegmentKey dsKey = dataSegments.get(key);
-		if (dsKey != null)
-			return dsKey;
-		if (key == null)
-			return null;
-		DataSegmentKey newDataSegmentKey = new DataSegmentKey();
-		DataSegmentKey dataSegmentKey = dataSegments.putIfAbsent(key, newDataSegmentKey);
-		if (dataSegmentKey == null) {
-			dataSegmentKey = newDataSegmentKey;
-		}
-		return dataSegmentKey;
-	}
-	
-	@Override
-	public void put(String key, Object val) {
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, null, reverseKey);
-		dataSegmentKey.runCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	@Override
-	public void quickPut(String key, Object val) {
-		put(key, val);
-	}
-	
-	/**
-	 * Enqueue update command to the queue of each DataSegment key
-	 */
-	
-	@Override
-	public void update(String key, Object val) {
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, reverseKey);
-		dataSegmentKey.runCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	
-	@Override
-	public void quickUpdate(String key, Object val) {
-		update(key, val);
-	}
+    @Override
+    public void update(String key, ReceiveData rData, boolean quickFlag) {
+        Command cmd = new Command(CommandType.UPDATE, null, key, rData, 0, 0, null, null, reverseKey);
+        put1(key, cmd);
+    }
+
+    @Override
+    public void take(Receiver receiver, CodeSegment cs, boolean quickFlag) {
+
+        Command cmd = new Command(CommandType.TAKE, receiver, receiver.key, null, receiver.index, 0, replyQueue, cs, null);
+        take1(receiver, cmd);
+    }
+
+    public void take1(Receiver receiver, Command cmd) {
+        int seq = this.seq.getAndIncrement();
+        cmd.setSeq(seq);
+        //seqHash.put(seq, cmd);
+        DataSegmentKey dataSegmentKey = getDataSegmentKey(receiver.key);
+        dataSegmentKey.runCommand(cmd);
+        if (logger.isDebugEnabled())
+            logger.debug(cmd.getCommandString());
+    }
+
+    @Override
+    public void peek(Receiver receiver, CodeSegment cs, boolean quickFlag) {
+        Command cmd = new Command(CommandType.PEEK, receiver, receiver.key, null, receiver.index, 0, replyQueue, cs, null);
+        take1(receiver, cmd);
+    }
+
+    @Override
+    public void remove(String key) {
+        DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
+        Command cmd = new Command(CommandType.REMOVE, null, key, null, 0, 0, replyQueue, null, null);
+        dataSegmentKey.runCommand(cmd);
+        if (logger.isDebugEnabled())
+            logger.debug(cmd.getCommandString());
+    }
 
-	
-	
-	@Override
-	public void take(Receiver receiver, CodeSegment cs) {
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(receiver.key);
-		int seq = this.seq.getAndIncrement();
-		Command cmd = new Command(CommandType.TAKE, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null);
-		dataSegmentKey.runCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
+    @Override public void finish() {
+        System.exit(0);
+    }
+
+    @Override
+    public void close() {
+
+    }
 
-	@Override
-	public void quickTake(Receiver receiver, CodeSegment cs) {
-		take(receiver, cs);		
-	}
-	
-	@Override
-	public void peek(Receiver receiver, CodeSegment cs) {
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(receiver.key);
-		int seq = this.seq.getAndIncrement();
-		Command cmd = new Command(CommandType.PEEK, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null);
-		dataSegmentKey.runCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	@Override
-	public void quickPeek(Receiver receiver, CodeSegment cs) {
-		peek(receiver, cs);
-	}
-
+    public void recommand(Receiver receiver, CodeSegment cs) {
+        DataSegmentKey dataSegmentKey = getDataSegmentKey(receiver.key);
+        int seq = this.seq.getAndIncrement();
+        Command cmd = new Command(receiver.type, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null);
+        dataSegmentKey.runCommand(cmd);
+        if (logger.isDebugEnabled())
+            logger.debug(cmd.getCommandString());
+    }
 
-	@Override
-	public void remove(String key) {
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
-		Command cmd = new Command(CommandType.REMOVE, null, key, null, 0, 0, replyQueue, null, null);
-		dataSegmentKey.runCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	@Override public void finish() {
-		System.exit(0);
-	}
+    @Override
+    public void ping(String returnKey) {
+
+    }
 
-	@Override
-	public void close() {
-		
-	}
+    @Override
+    public void response(String returnKey) {
+
+    }
 
-	public void recommand(Receiver receiver, CodeSegment cs) {
-		DataSegmentKey dataSegmentKey = getDataSegmentKey(receiver.key);
-		int seq = this.seq.getAndIncrement();
-		Command cmd = new Command(receiver.type, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null);
-		dataSegmentKey.runCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-		
-	}
+    @Override
+    public void shutdown() {
+
+    }
 
-	@Override
-	public void ping(String returnKey) {
-		
-	}
+    @Override
+    public void setSendError(boolean b) {
 
-	@Override
-	public void response(String returnKey) {
-				
-	}
-
-	@Override
-	public void shutdown() {
-		
-	}
-
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/datasegment/MulticastDataSegmentManager.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,76 @@
+package alice.datasegment;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.NetworkInterface;
+import java.net.SocketAddress;
+import java.net.StandardProtocolFamily;
+import java.net.StandardSocketOptions;
+import java.nio.channels.DatagramChannel;
+
+import org.apache.log4j.Logger;
+
+import alice.daemon.IncomingUdpConnection;
+import alice.daemon.MulticastConnection;
+import alice.daemon.OutboundTcpConnection;
+
+public class MulticastDataSegmentManager extends RemoteDataSegmentManager {
+
+    public enum SocketType{Sender, Receiver, Both};
+    public MulticastDataSegmentManager(String connectionKey ,final String MCASTADDR, final int port, final String nis, SocketType type) {
+        logger = Logger.getLogger(connectionKey);
+        InetAddress mAddr;
+        try {
+            mAddr = InetAddress.getByName(MCASTADDR);
+
+            DatagramChannel dcr =  createDatagramChannel(mAddr, port, nis);
+            dcr.bind(new InetSocketAddress(port));
+            SocketAddress sAddrr = new InetSocketAddress(mAddr,port);
+            MulticastConnection receiver = new MulticastConnection(dcr, sAddrr);
+
+            DatagramChannel dcs =  createDatagramChannel(mAddr, port, nis);
+            SocketAddress sAddrs = new InetSocketAddress(mAddr,port);
+            connection = new MulticastConnection(dcs, sAddrs); // sender
+
+            if (type !=SocketType.Sender) {
+                IncomingUdpConnection in = new IncomingUdpConnection((MulticastConnection) connection, receiver, this);
+                in.setName("multicast-IncomingUdp");
+                in.start();
+                DataSegment.setAccept(connectionKey, in);
+            }
+            if (type !=SocketType.Receiver) {
+                OutboundTcpConnection out = new OutboundTcpConnection(connection); // OutboundUdpConnection sender
+                out.setName(connectionKey+"OutboundUdp");
+                out.start();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    private DatagramChannel createDatagramChannel(InetAddress group, int port, String nis) {
+        DatagramChannel dc = null;
+        NetworkInterface ni;
+        try {
+            ni = NetworkInterface.getByName(nis);
+            if (ni==null) {
+                System.err.println("Can't open network interface "+nis);
+                throw new IOException();
+            }
+            if (!ni.supportsMulticast()) {
+                System.err.println("Network interface does not support multicast"+nis);
+                throw new IOException();
+            }
+
+            dc = DatagramChannel.open(StandardProtocolFamily.INET);
+            dc.setOption(StandardSocketOptions.SO_REUSEADDR, true);
+            dc.setOption(StandardSocketOptions.IP_MULTICAST_IF, ni);
+            dc.join(group, ni);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dc;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/datasegment/ReceiveData.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,280 @@
+package alice.datasegment;
+
+import java.io.*;
+import java.nio.ByteBuffer;
+import java.util.LinkedList;
+import java.util.zip.*;
+
+import org.msgpack.MessagePack;
+import org.msgpack.type.Value;
+
+
+/**
+ * 送られてきたDSを一時的に取っておくクラス。inputでも使用。
+ */
+public class ReceiveData {
+    private Object val;//for Object DS
+    private byte[] messagePack;//for byteArray(serialized) DS
+    private byte[] zMessagePack;//for byteArray(compressed) DS
+    private int dataSize;//圧縮前(MessagePack)のデータサイズ
+    private Class<?> clazz;
+
+    private long time;//測定用
+    private boolean setTime = false;
+    private int depth = 1;
+    private boolean setZepped = false;
+    private int zippedDataSize;//圧縮後のデータサイズ
+
+    private static final MessagePack packer = new MessagePack();
+
+    /**
+     * コンストラクタ。Object型のDSと圧縮のメタ情報を受け取る。
+     * put/update/reply用?
+     * @param obj DS本体(Object)
+     */
+    public ReceiveData(Object obj) {
+        clazz = obj.getClass();
+        val = obj;
+    }
+
+    /**
+     * コンストラクタ。byteArray型のDSと圧縮のメタ情報を受け取り、byteArrayフラグを立てる。
+     *
+     * @param messagePack DS本体(byteArray)
+     */
+    public ReceiveData(byte[] messagePack, boolean compressed, int datasize) {
+        this.dataSize = datasize;
+        if (compressed){
+            this.zMessagePack = messagePack;
+        } else {
+            this.messagePack = messagePack;
+        }
+    }
+
+    public boolean isByteArray(){
+        return messagePack != null | zMessagePack != null;
+    }
+
+    public boolean compressed(){
+        return zMessagePack != null;
+    }
+
+    public boolean serialized(){
+        return val == null;
+    }
+
+    public Object getObj(){
+        return asClass(Object.class);
+    }
+
+    public String asString(){
+        return asClass(String.class);
+    }
+
+    public int asInteger() {
+        return asClass(Integer.class);
+    }
+
+    public Float asFloat() {
+        return asClass(Float.class);
+    }
+
+    public Value getVal(){///get DS as Value type
+        if (val == null){///val != null
+            return asClass(Value.class);
+        } else {
+            try {
+                return packer.unconvert(val);///convert to Value type by MassagePack
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            return null;
+        }
+    }
+
+    /**
+     * DSを任意の型で取得するメソッド。
+     * DSがbyteArrayでなければ指定された型に変換して返す。
+     * DSがbyteArrayなら解凍状態にして指定された型に変換して返す。
+     *
+     * @param clazz
+     * @param <T>
+     * @return
+     */
+    public <T> T asClass(Class<T> clazz) {///javasist
+
+        try {
+            if (val != null) {
+                return (T) val;
+            }
+
+            if (zMessagePack != null && messagePack == null) {
+                messagePack = unzip(zMessagePack, dataSize);
+            }
+
+            return packer.read(messagePack, clazz);
+
+        } catch (IOException e) {// | DataFormatException e
+            e.printStackTrace();
+            return null;
+        }
+    }
+
+    public byte[] getMessagePack(){
+        if (messagePack != null){
+            return messagePack;
+        } else {
+            try {
+                messagePack = packer.write(val);
+                setDataSize(messagePack.length);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+            return messagePack;
+        }
+    }
+
+    public byte[] getZMessagePack(){
+        if (zMessagePack != null){
+            return zMessagePack;
+        } else {
+            try {
+                zip();
+
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+
+            return zMessagePack;
+        }
+    }
+
+    public void zip() throws IOException {
+        LinkedList<ByteBuffer> inputs = new LinkedList<ByteBuffer>();
+        int inputIndex = 0;
+        LinkedList<ByteBuffer> outputs = new LinkedList<ByteBuffer>();
+        Deflater deflater = new Deflater();
+
+        inputs.add(ByteBuffer.wrap(getMessagePack()));
+        int len = 0;
+        int INFLATE_BUFSIZE = 1024 * 100;//ToDo:fix
+        ByteBuffer c1 = allocate(INFLATE_BUFSIZE);//for output
+
+        while (inputIndex < inputs.size()) {
+            ByteBuffer b1 = inputs.get(inputIndex++);
+            deflater.setInput(b1.array(), b1.position(), b1.remaining());
+            
+            if (inputIndex == inputs.size()){
+                deflater.finish();
+            }
+
+            int len1 = 0;
+            do {
+                len1 = deflater.deflate(c1.array(), c1.position(), c1.remaining());
+                if (len1 > 0) {
+                    len += len1;
+                    c1.position(c1.position() + len1);
+                    if (c1.remaining() == 0) {
+                        c1.flip();
+                        outputs.addLast(c1);
+                        c1 = allocate(INFLATE_BUFSIZE);
+                    }
+                }
+            } while (len1 > 0 || !deflater.needsInput());
+        }
+        if (c1.position() != 0) {
+            c1.flip();
+            outputs.addLast(c1);
+        }
+
+        deflater.reset();
+
+        zMessagePack = new byte[len];
+        int tmp = 0;
+        for (int i = 0; i < outputs.size(); i++){
+            System.arraycopy(outputs.get(i).array(), 0, zMessagePack, 0 + tmp, outputs.get(i).limit());//limit? remaining?
+            tmp += outputs.get(i).limit();
+        }
+    }
+
+    protected byte[] unzip(byte[] input, int dataSize) {///read header & unzip
+        int length = input.length;
+        Inflater inflater = new Inflater();
+
+        byte [] output = new byte [dataSize];///byteArray for unziped data
+        inflater.setInput(input, 0, length);///set unzip data without header
+
+        try {
+            inflater.inflate(output, 0, dataSize);///unzip
+        } catch (DataFormatException e) {
+            e.printStackTrace();
+        }
+
+        inflater.reset();
+
+        return output;
+ 	}
+
+
+    public ByteBuffer allocate(int size)
+    {
+        ByteBuffer b = null;
+        while(true){
+            try {
+                b = ByteBuffer.allocate(size);
+            } catch (OutOfMemoryError e) {
+                b = null;
+            }
+            if (b!=null) {
+                break;
+            }
+            try {
+                wait();
+            } catch (InterruptedException e) {
+            }
+        }
+        return b;
+    }
+
+
+    public int getDataSize(){
+        return this.dataSize;
+    }
+
+    public void setDataSize(int datasize){
+        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;
+    }
+
+    public  void setZipped(int zippedDataSize, boolean setZepped){
+        this.zippedDataSize = zippedDataSize;
+        this.setZepped = setZepped;
+    }
+
+    public  int getZippedDataSize(){
+        return this.zippedDataSize;
+    }
+
+    public boolean getSetZipped(){
+        return this.setZepped;
+    }
+
+}
--- a/src/main/java/alice/datasegment/ReceiveLocalData.java	Wed Apr 19 19:19:27 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-package alice.datasegment;
-
-import java.io.IOException;
-
-import org.msgpack.type.ArrayValue;
-import org.msgpack.type.Value;
-
-import alice.codesegment.SingletonMessage;
-import alice.datasegment.ReceiverData;
-
-public class ReceiveLocalData implements ReceiverData {
-	private Object obj;
-
-	public ReceiveLocalData(Object obj2) {
-		this.obj = obj2;
-	}
-
-	public String asString() {
-		return (String) obj;
-	}
-
-	public int asInteger() {
-		return (Integer) obj;
-	}
-
-	public Float asFloat() {
-		return (Float) obj;
-	}
-
-	public ArrayValue asArray(){
-		return (ArrayValue) obj;
-	}
-	
-	@SuppressWarnings("unchecked")
-	public <T> T asClass(Class<T> clazz) {
-		return (T) obj;
-
-	}
-
-	@Override
-	public Value getVal() {
-		try {
-			return SingletonMessage.getInstance().unconvert(obj);
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		return null;
-	}
-
-	@Override
-	public Object getObj() {
-		return obj;
-	}
-
-}
--- a/src/main/java/alice/datasegment/ReceiveRemoteData.java	Wed Apr 19 19:19:27 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-package alice.datasegment;
-
-import java.io.IOException;
-
-import org.msgpack.type.ArrayValue;
-import org.msgpack.type.Value;
-import org.msgpack.type.ValueType;
-
-import alice.codesegment.SingletonMessage;
-
-public class ReceiveRemoteData implements ReceiverData {
-	public Value val;
-
-	public ReceiveRemoteData() {
-	}
-
-	public ReceiveRemoteData(Value val2) {
-		this.val = val2;
-	}
-
-	public String asString() {
-		if (val.getType() == ValueType.RAW) {
-			return val.asRawValue().getString();
-		}
-		return null;
-	}
-
-	public int asInteger() {
-		if (val.getType() == ValueType.INTEGER) {
-			return val.asIntegerValue().getInt();
-		}
-		return 0;
-	}
-
-	public Float asFloat() {
-		if (val.getType() == ValueType.FLOAT) {
-			return val.asFloatValue().getFloat();
-		}
-		return 0.0f;
-	}
-
-	public ArrayValue asArray(){
-		if (val.getType() == ValueType.ARRAY){
-			return val.asArrayValue();
-		}
-		return null;
-	}
-	
-	public <T> T asClass(Class<T> clazz) {
-		try {
-			return SingletonMessage.getInstance().convert(val, clazz);
-		} catch (IOException e) {
-			e.printStackTrace();
-		}
-		return null;
-
-	}
-
-	@Override
-	public Value getVal() {
-		return val;
-	}
-
-	@Override
-	public Object getObj() {
-		return val;
-	}
-	
-}
\ No newline at end of file
--- a/src/main/java/alice/datasegment/Receiver.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/datasegment/Receiver.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,109 +4,125 @@
 import alice.codesegment.InputDataSegment;
 
 /**
+ * idsコマンド(create, setKey)の処理をする。コマンドの定義はids/LDSM内にある。
  * MessagePack implementation and DataSegment Receiver
  * @author kazz
  *
  */
 public class Receiver {
-	private ReceiverData data = new ReceiveRemoteData();
-	public InputDataSegment ids;
-	public int index;
-	public String from;
-	public CommandType type;
-	public String managerKey;
-	public String key;
+    private ReceiveData data;
+    public InputDataSegment ids;
+    public int index;
+    public String from;
+    public CommandType type;
+    public String managerKey;//DSMを一意に特定。localかremoteか、どのremoteからか。
+    public String key;
+    public boolean compressedFlag = false;
+
+    public Receiver(InputDataSegment ids, CommandType type) {
+        this.ids = ids;
+        this.type = type;
+        ids.register();
+    }
+
+    public Receiver(InputDataSegment ids, CommandType type, boolean compressedFlag) {
+        this.ids = ids;
+        this.type = type;
+        ids.register();
+        this.compressedFlag = compressedFlag;
+    }
 
-	public Receiver(InputDataSegment ids, CommandType type) {
-		this.ids = ids;
-		this.type = type;
-		ids.register();
-		
-	}
-	
-	public void setQuickKey(String managerKey, String key){
-		setQuickKey(managerKey, key, 0);
-	}
-	
-	public void setQuickKey(String managerKey, String key, int index) {
-		this.managerKey = managerKey;
-		this.key = key;
-		switch (type) {
-		case PEEK:
-			ids.quickPeek(this);
-			break;
-		case TAKE:
-			ids.quickTake(this);
-			break;
-		default:
-			break;
-		}
-		ids.setKey();
-	}
-	
-	public void setKey(String managerKey, String key) {
-		setKey(managerKey, key, 0);
-	}
+    public void setQuickKey(String managerKey, String key){
+        setQuickKey(managerKey, key, 0);
+    }//?
+
+    public void setQuickKey(String managerKey, String key, int index) {
+        this.managerKey = managerKey;
+        this.key = key;
+        switch (type) {
+        case PEEK:
+            ids.quickPeek(this);
+            break;
+        case TAKE:
+            ids.quickTake(this);
+            break;
+        default:
+            break;
+        }
+        ids.setKey();
+    }
+
+    public void setKey(String managerKey, String key) {
+        setKey(managerKey, key, 0);
+    }
 
-	public void setKey(String managerKey, String key, int index) {
-		this.managerKey = managerKey;
-		this.key = key;
-		this.index = index;
-		switch (type) {
-		case PEEK:
-			ids.peek(this);
-			break;
-		case TAKE:
-			ids.take(this);
-			break;
-		default:
-			break;
-		}
-		ids.setKey();
-	}
-	
-	public void setKey(String key) {
-		setKey(key, 0);
-	}
+    public void setKey(String managerKey, String key, int index) {
+        this.managerKey = managerKey;
+        this.key = key;
+        this.index = index;
+        switch (type) {
+        case PEEK:
+            ids.peek(this);
+            break;
+        case TAKE:
+            ids.take(this);
+            break;
+        default:
+            break;
+        }
+        ids.setKey();
+    }
+
+    public void setKey(String key) {
+        setKey(key, 0);
+    }
 
-	public void setKey(String key, int index) {
-		this.key = key;
-		this.index = index;
-		switch (type) {
-		case PEEK:
-			ids.peek(this);
-			break;
-		case TAKE:
-			ids.take(this);
-			break;
-		default:
-			break;
-		}
-		ids.setKey();
-	}
+    public void setKey(String key, int index) {
+        this.key = key;
+        this.index = index;
+        switch (type) {
+        case PEEK:
+            ids.peek(this);
+            break;
+        case TAKE:
+            ids.take(this);
+            break;
+        default:
+            break;
+        }
+        ids.setKey();
+    }
 
-	public void setData(ReceiverData r) {
-		data = r;
-	}
+    //以下各型でDS本体を受け取る
+    public void setData(ReceiveData r) {
+        data = r;
+    }
+
+    public int asInteger() {
+        return data.asInteger();
+    }
 
-	public int asInteger() {
-		return data.asInteger();
-	}
+    public String asString() {
+        return data.asString();
+    }
+
+    public <T> T asClass(Class<T> clazz) {
+        return data.asClass(clazz);
+    }
+
+    public Object getObj() {
+        return data.getObj();
+    }
 
-	public String asString() {
-		return data.asString();
-	}
-	
-	public <T> T asClass(Class<T> clazz) {
-		return data.asClass(clazz);
-	}
-	
-	public Object getObj() {
-		return data.getObj();
-	}
+    public Object getVal() {
+        return data.getVal();
+    }
 
-	public Object getVal() {
-		return data.getVal();
-	}
-	
+    public ReceiveData getReceiveData() {
+        return data;
+    }
+
+    public boolean isCompressed(){
+        return data.compressed();
+    }
 }
--- a/src/main/java/alice/datasegment/ReceiverData.java	Wed Apr 19 19:19:27 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-package alice.datasegment;
-
-import org.msgpack.type.ArrayValue;
-import org.msgpack.type.Value;
-
-public interface ReceiverData {
-
-	public String asString();
-	public int asInteger();
-	public Float asFloat() ;
-	public ArrayValue asArray();
-	public <T> T asClass(Class<T> clazz);
-	public Value getVal();
-	public Object getObj();
-	
-}
\ No newline at end of file
--- a/src/main/java/alice/datasegment/RemoteDataSegmentManager.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/datasegment/RemoteDataSegmentManager.java	Thu Nov 30 19:42:31 2017 +0900
@@ -3,6 +3,7 @@
 import java.io.IOException;
 import java.net.InetSocketAddress;
 import java.nio.channels.SocketChannel;
+import java.util.concurrent.LinkedBlockingQueue;
 
 import org.apache.log4j.Logger;
 
@@ -10,157 +11,149 @@
 import alice.daemon.Connection;
 import alice.daemon.IncomingTcpConnection;
 import alice.daemon.OutboundTcpConnection;
-import alice.topology.HostMessage;
-import alice.topology.manager.reconnection.SendError;
 
 public class RemoteDataSegmentManager extends DataSegmentManager {
-	
-	Connection connection;
-	Logger logger;
-	
-	public RemoteDataSegmentManager(String connectionKey, final String reverseKey, final String hostName, final int port, final boolean rFlag) {
-		logger = Logger.getLogger(connectionKey);
-		connection = new Connection();
-		final RemoteDataSegmentManager manager = this;
-		new Thread(replyThread, "RemoteDataSegmentManager-" + connectionKey).start();
-		new Thread("Connect-" + connectionKey) {
-			public void run() {
-				boolean connect = true;
-				do {
-					try {
-						SocketChannel sc = SocketChannel.open(new InetSocketAddress(hostName, port));
-						connection.socket = sc.socket();
-						connection.socket.setTcpNoDelay(true);
-						connect = false;
-						logger.info("Connect to " + connection.getInfoString());
-					} catch (IOException e) {
-						try {
-							Thread.sleep(50);
-						} catch (InterruptedException e1) {
-							e1.printStackTrace();
-						}
-					}
-				} while (connect&&!rFlag);
-				new IncomingTcpConnection(connection, manager, reverseKey).start();
-				new OutboundTcpConnection(connection).start();
-				// if connection failed need to stop these thread 
-				if (connect){
-					new SendError(new HostMessage(hostName, port)).execute();
-				}
-			}
-		}.start();
-	}
-	
-	/**
-	 * send put command to target DataSegment
-	 */
-	@Override
-	public void put(String key, Object val) {
-		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, null, null);
-		connection.sendCommand(cmd); // put command on the transmission thread
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	@Override
-	public void quickPut(String key, Object val) {
-		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, null, null, null);
-		connection.write(cmd); // put command is executed right now
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	@Override
-	public void update(String key, Object val) {
-		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, null);
-		connection.sendCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	@Override
-	public void quickUpdate(String key, Object val) {
-		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, null);
-		connection.write(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
+    protected Connection connection;
+    protected Logger logger;
+
+    public RemoteDataSegmentManager(){}
+
+    public RemoteDataSegmentManager(final String connectionKey, final String reverseKey, final String hostName, final int port) {
+        logger = Logger.getLogger(connectionKey);
+        connection = new Connection();
+        connection.name = connectionKey;
+        final RemoteDataSegmentManager manager = this;
+        //new Thread(replyThread, "RemoteDataSegmentManager-" + connectionKey).start();
+        new Thread("Connect-" + connectionKey) {
+            public void run() {
+                boolean connect = true;
+                do {
+                    try {
+                        //System.out.println("RemoteDSM connect hostname:" + hostName + " port:" + port);
+                        SocketChannel sc = SocketChannel.open(new InetSocketAddress(hostName, port));
+                        connection.socket = sc.socket();
+                        connection.socket.setTcpNoDelay(true);
+                        connect = false;
+                        logger.info("Connect to " + connection.getInfoString());
+                    } catch (IOException e) {
+                        //System.err.println("Can not connect" + e);
+                        try {
+                            Thread.sleep(50);
+                        } catch (InterruptedException e1) {
+                            e1.printStackTrace();
+                        }
+                    }
+                } while (connect);
+                IncomingTcpConnection in = new IncomingTcpConnection(connection, manager, reverseKey);
+                in.setName(reverseKey+"-IncomingTcp");
+                in.setPriority(MAX_PRIORITY);
+                in.start();
+                OutboundTcpConnection out = new OutboundTcpConnection(connection);
+                out.setName(connectionKey + "-OutboundTcp");
+                out.setPriority(MAX_PRIORITY);
+                out.start();
+            }
+        }.start();
+    }
+
+    /**
+     * send put command to target DataSegment
+     */
+    @Override
+    public void put(String key, ReceiveData rData, boolean quickFlag) {
+        Command cmd = new Command(CommandType.PUT, null, key, rData, 0, 0, null, null, "");
+
+        put1(quickFlag, cmd);
+    }
+
+    public void put1(boolean quickFlag, Command cmd) {
+        if (quickFlag){
+            connection.write(cmd); // put command is executed right now
+        } else {
+            connection.sendCommand(cmd); // put command on the transmission thread
+        }
+        if (logger.isDebugEnabled())
+            logger.debug(cmd.getCommandString());
+    }
+
+    @Override
+    public void update(String key, ReceiveData rData, boolean quickFlag) {
+        Command cmd = new Command(CommandType.UPDATE, null, key, rData, 0, 0, null, null, "");
+
+        put1(quickFlag, cmd);
+    }
 
-	@Override
-	public void take(Receiver receiver, CodeSegment cs) {
-		int seq = this.seq.getAndIncrement();
-		Command cmd = new Command(CommandType.TAKE, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null);
-		seqHash.put(seq, cmd);
-		connection.sendCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	public void quickTake(Receiver receiver, CodeSegment cs) {
-		int seq = this.seq.getAndIncrement();
-		Command cmd = new Command(CommandType.TAKE, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null, true);
-		seqHash.put(seq, cmd);
-		connection.write(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
+    @Override
+    public void take(Receiver receiver, CodeSegment cs, boolean quickFlag) {
+
+        Command cmd = new Command(CommandType.TAKE, receiver, receiver.key, null, receiver.index, 0, replyQueue, cs, null);
+        take1(quickFlag, cmd);
+    }
+
+    public void take1(boolean quickFlag, Command cmd) {
+        int seq = this.seq.getAndIncrement();
+        //System.err.println("DataSegment take seq :" + seq);
+        cmd.setSeq(seq);
+        seqHash.put(seq, cmd);
+        cmd.setQuickFlag(quickFlag);
+        if (quickFlag){
+            connection.write(cmd);
+        } else {
+            connection.sendCommand(cmd);
+        }
+        if (logger.isDebugEnabled())
+            logger.debug(cmd.getCommandString());
+    }
+
+    @Override
+    public void peek(Receiver receiver, CodeSegment cs, boolean quickFlag) {
+        Command cmd = new Command(CommandType.PEEK, receiver, receiver.key, null, receiver.index, 0, replyQueue, cs, null);
+        take1(quickFlag, cmd);
+    }
+
+    @Override
+    public void remove(String key) {
+        Command cmd = new Command(CommandType.REMOVE, null, key, null, 0, 0, null, null, "");
+        connection.sendCommand(cmd);
+        if (logger.isDebugEnabled())
+            logger.debug(cmd.getCommandString());
+    }
 
-	@Override
-	public void peek(Receiver receiver, CodeSegment cs) {
-		int seq = this.seq.getAndIncrement();
-		Command cmd = new Command(CommandType.PEEK, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null);
-		seqHash.put(seq, cmd);
-		connection.sendCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
-	
-	public void quickPeek(Receiver receiver, CodeSegment cs) {
-		int seq = this.seq.getAndIncrement();
-		Command cmd = new Command(CommandType.PEEK, receiver, receiver.key, null, receiver.index, seq, replyQueue, cs, null, true);
-		seqHash.put(seq, cmd);
-		connection.write(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-		
-	}
+    @Override
+    public void finish() {
+        Command cmd = new Command(CommandType.FINISH, null, null, null, 0, 0, null, null, "");
+        connection.sendCommand(cmd);
+    }
 
-	@Override
-	public void remove(String key) {
-		Command cmd = new Command(CommandType.REMOVE, null, key, null, 0, 0, null, null, null);
-		connection.sendCommand(cmd);
-		if (logger.isDebugEnabled())
-			logger.debug(cmd.getCommandString());
-	}
+    @Override
+    public void ping(String returnKey) {
+        Command cmd = new Command(CommandType.PING, null, returnKey, null, 0, 0, null, null, "");
+        connection.write(cmd);
+    }
+
+    @Override
+    public void response(String returnKey) {
+        Command cmd = new Command(CommandType.RESPONSE, null, returnKey, null, 0, 0, null, null, "");
+        connection.write(cmd);
+    }
 
-	@Override
-	public void finish() {
-		Command cmd = new Command(CommandType.FINISH, null, null, null, 0, 0, null, null, null);
-		connection.sendCommand(cmd);
-	}
+    @Override
+    public void close() {
+        Command cmd = new Command(CommandType.CLOSE, null, null, null, 0, 0, null, null, "");
+        connection.sendManager = false;
+        connection.sendCommand(cmd);
+    }
 
-	@Override
-	public void ping(String returnKey) {
-		Command cmd = new Command(CommandType.PING, null, returnKey, null, 0, 0, null, null, null);
-		connection.write(cmd);
-	}
-	
-	@Override
-	public void response(String returnKey) {
-		Command cmd = new Command(CommandType.RESPONSE, null, returnKey, null, 0, 0, null, null, null);
-		connection.write(cmd);
-	}
+    @Override
+    public void shutdown() {
+        connection.close();
+        LinkedBlockingQueue<Command> queue = connection.sendQueue;
+        if (!queue.isEmpty()) queue.clear();
+    }
 
-	@Override
-	public void close() {
-		Command cmd = new Command(CommandType.CLOSE, null, null, null, 0, 0, null, null, null);
-		connection.sendCommand(cmd);
-	}
-	
-	@Override
-	public void shutdown() {
-		connection.close();
-	}
-
+    @Override
+    public void setSendError(boolean b) {
+        connection.sendManager = b;
+    }
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/datasegment/SendOption.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,27 @@
+package alice.datasegment;
+
+public class SendOption {
+    private boolean quick = false;
+    private boolean compress = false;
+
+    public SendOption(boolean qFlag, boolean cFlag) {
+        quick = qFlag;
+        compress = cFlag;
+    }
+
+    public boolean isQuick() {
+        return quick;
+    }
+
+    public void setQuick(boolean quick) {
+        this.quick = quick;
+    }
+
+    public boolean isCompress() {
+        return compress;
+    }
+
+    public void setCompress(boolean compress) {
+        this.compress = compress;
+    }
+}
--- a/src/main/java/alice/test/codesegment/api/FlipCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/api/FlipCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -3,19 +3,19 @@
 import alice.codesegment.CodeSegment;
 
 public class FlipCodeSegment extends CodeSegment{
-	
-	private String key;
-	public FlipCodeSegment(String _key){
-		this.key = _key;
-	}
-	
-	@Override
-	public void run() {
-		Integer num = 0;
-		ods.put(key, num);
-		
-		//System.out.println("Key is " +key);
-		new FlipTest(key);
-	}
-	
+
+    private String key;
+    public FlipCodeSegment(String _key){
+        this.key = _key;
+    }
+
+    @Override
+    public void run() {
+        Integer num = 0;
+        ods.put(key, num);
+
+        //System.out.println("Key is " +key);
+        new FlipTest(key);
+    }
+
 }
--- a/src/main/java/alice/test/codesegment/api/FlipTest.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/api/FlipTest.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,34 +5,34 @@
 import alice.datasegment.Receiver;
 
 public class FlipTest extends CodeSegment{
-	
-	private Receiver arg1 = ids.create(CommandType.PEEK);
-	public static long t = 0;
-	public static boolean flag = false;
-	public static int count = 10000;
-	public FlipTest(String key){
-		arg1.setKey(key);
-	}
-	
-	public FlipTest(String key, int index){
-		arg1.setKey(key, index);
-	}
+
+    private Receiver arg1 = ids.create(CommandType.PEEK);
+    public static long t = 0;
+    public static boolean flag = false;
+    public static int count = 10000;
+    public FlipTest(String key){
+        arg1.setKey(key);
+    }
+
+    public FlipTest(String key, int index){
+        arg1.setKey(key, index);
+    }
 
-	@Override
-	public void run() {
-		if(flag){
-			System.out.println(System.currentTimeMillis() - t +" ms");
-			System.exit(0);
-		}
-		t = System.currentTimeMillis();
-		for (int i=0;i<count;i++)
-			ods.flip(arg1);
-			//ods.put(arg1.key ,arg1.getObj());
-		flag=true;
+    @Override
+    public void run() {
+        if(flag){
+            System.out.println(System.currentTimeMillis() - t +" ms");
+            System.exit(0);
+        }
+        t = System.currentTimeMillis();
+        for (int i=0;i<count;i++)
+            ods.flip(arg1);
+            //ods.put(arg1.key ,arg1.getObj());
+        flag=true;
 
-		new FlipTest(arg1.key,count);
-				
-	}
+        new FlipTest(arg1.key,count);
+
+    }
 
 
 }
--- a/src/main/java/alice/test/codesegment/api/PeekCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/api/PeekCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,25 +5,25 @@
 import alice.datasegment.Receiver;
 
 public class PeekCodeSegment extends CodeSegment{
-	private Receiver info0 = ids.create(CommandType.PEEK);
-	public PeekCodeSegment(String key) {
-		info0.setKey(key);
-	}
+    private Receiver info0 = ids.create(CommandType.PEEK);
+    public PeekCodeSegment(String key) {
+        info0.setKey(key);
+    }
 
-	@Override
-	public void run() {
-		if (StartCodeSegment.count>10000){
-			System.out.println(System.currentTimeMillis()-StartCodeSegment.t +" ms");
-			StartCodeSegment.count = 0;
-			
-			if (++StartCodeSegment.cnt>100){
-				System.exit(0);
-			}
-		} else {
-			if(StartCodeSegment.count==1)StartCodeSegment.t = System.currentTimeMillis();
-			StartCodeSegment.count++;
-		}
-		new PeekCodeSegment(info0.key);
-	}
+    @Override
+    public void run() {
+        if (StartCodeSegment.count>10000){
+            System.out.println(System.currentTimeMillis()-StartCodeSegment.t +" ms");
+            StartCodeSegment.count = 0;
+
+            if (++StartCodeSegment.cnt>100){
+                System.exit(0);
+            }
+        } else {
+            if(StartCodeSegment.count==1)StartCodeSegment.t = System.currentTimeMillis();
+            StartCodeSegment.count++;
+        }
+        new PeekCodeSegment(info0.key);
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/api/PutCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/api/PutCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -3,30 +3,30 @@
 import alice.codesegment.CodeSegment;
 
 public class PutCodeSegment extends CodeSegment{
-	
-	private static int count = 0;
-	
-	@Override
-	public synchronized void run() {
-		
-		int[] array = new int[1000];
-		for (int i = 0;i< 999; i++)
-			array[i] = i;
-		
-		if (count % 10 == 0)
-			System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024 + "MB");
-		if (count >= 10000000) {
-			System.exit(0);
-		}
-		ods.put("local", "num", array);
-		count++;
-		try {
-			wait(100);
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-		new PutCodeSegment().execute();
-	}
-	
+
+    private static int count = 0;
+
+    @Override
+    public synchronized void run() {
+
+        int[] array = new int[1000];
+        for (int i = 0;i< 999; i++)
+            array[i] = i;
+
+        if (count % 10 == 0)
+            System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024 + "MB");
+        if (count >= 10000000) {
+            System.exit(0);
+        }
+        ods.put("local", "num", array);
+        count++;
+        try {
+            wait(100);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        new PutCodeSegment().execute();
+    }
+
 
 }
--- a/src/main/java/alice/test/codesegment/api/StartCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/api/StartCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,49 +6,49 @@
 import alice.test.codesegment.local.bitonicsort.DataList;
 
 public class StartCodeSegment extends CodeSegment {
-	String[] args;
-	public static int count = 1;
-	public static int cnt = 1;
-	public static long t = 0;
-	
-	
-	public StartCodeSegment(String[] args){
-		this.args = args;
-	}
+    String[] args;
+    public static int count = 1;
+    public static int cnt = 1;
+    public static long t = 0;
+
+
+    public StartCodeSegment(String[] args){
+        this.args = args;
+    }
 
-	@Override
-	public void run() {
-		for (String arg : args) {
-			if ("-update".equals(arg)) {
-				UpdateCodeSegment cs1 = new UpdateCodeSegment();
-				cs1.ds1.setKey("key");
-				int[] array = new int[65536];
-				array[0] = 0;
-				ods.update("local", "key", array);
+    @Override
+    public void run() {
+        for (String arg : args) {
+            if ("-update".equals(arg)) {
+                UpdateCodeSegment cs1 = new UpdateCodeSegment();
+                cs1.ds1.setKey("key");
+                int[] array = new int[65536];
+                array[0] = 0;
+                ods.update("local", "key", array);
 
-			} else if ("-put".equals(arg)) {
-				new PutCodeSegment().execute();
+            } else if ("-put".equals(arg)) {
+                new PutCodeSegment().execute();
 
-			} else if ("-take".equals(arg)) {
-				new PutCodeSegment().execute();
-				new TakeCodeSegment("num");
+            } else if ("-take".equals(arg)) {
+                new PutCodeSegment().execute();
+                new TakeCodeSegment("num");
 
-			} else if ("-flip".equals(arg)) {
-				new FlipCodeSegment("key").execute();
-			} else if ("-peek".equals(arg)) {
-				System.out.println("start peek Test");
-				String key = "peek";
-				int size = 100000;
-				DataList list = new DataList(size);
-				Random rnd = new Random();
-				for (int cnt = 0; cnt < size; cnt++) {
-					list.table[cnt] = rnd.nextInt(100000) + 10;
-				}
-				ods.put(key, list);
-				new PeekCodeSegment(key);
-			}
-		}
-		 
-	}
+            } else if ("-flip".equals(arg)) {
+                new FlipCodeSegment("key").execute();
+            } else if ("-peek".equals(arg)) {
+                System.out.println("start peek Test");
+                String key = "peek";
+                int size = 100000;
+                DataList list = new DataList(size);
+                Random rnd = new Random();
+                for (int cnt = 0; cnt < size; cnt++) {
+                    list.table[cnt] = rnd.nextInt(100000) + 10;
+                }
+                ods.put(key, list);
+                new PeekCodeSegment(key);
+            }
+        }
+
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/api/TakeCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/api/TakeCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,15 +5,15 @@
 import alice.datasegment.Receiver;
 
 public class TakeCodeSegment extends CodeSegment {
-	
-	Receiver ds1 = ids.create(CommandType.TAKE);
-	
-	public TakeCodeSegment(String key){
-		this.ds1.setKey(key);
-	}	
-	@Override
-	public void run() {
-		new TakeCodeSegment(ds1.key);
-		
-	}
+
+    Receiver ds1 = ids.create(CommandType.TAKE);
+
+    public TakeCodeSegment(String key){
+        this.ds1.setKey(key);
+    }
+    @Override
+    public void run() {
+        new TakeCodeSegment(ds1.key);
+
+    }
 }
--- a/src/main/java/alice/test/codesegment/api/TestApiAlice.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/api/TestApiAlice.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,12 +5,12 @@
 
 public class TestApiAlice {
 
-	/**
-	 * @param args
-	 */
-	public static void main(String[] args) {
-		new AliceDaemon(new Config(args)).listen();
-		new StartCodeSegment(args).execute();
-	}
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        new AliceDaemon(new Config(args)).listen();
+        new StartCodeSegment(args).execute();
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/api/UpdateCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/api/UpdateCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -8,21 +8,21 @@
 import alice.datasegment.Receiver;
 
 public class UpdateCodeSegment extends CodeSegment {
-	Receiver ds1 = ids.create(CommandType.PEEK);
+    Receiver ds1 = ids.create(CommandType.PEEK);
 
-	@Override
-	public void run() {
-		UpdateCodeSegment cs1 = new UpdateCodeSegment();
-		cs1.ds1.setKey("key", ds1.index);
-		Value[] array = ((Value)ds1.getVal()).asArrayValue().getElementArray();
-		int val = array[0].asIntegerValue().getInt();
-		if (val % 10 == 0)
-			System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024 + "MB");
-		if (val >= 10000000) {
-			System.exit(0);
-		}
-		array[0] = ValueFactory.createIntegerValue(val + 1);
-		ods.update("local", "key", array);
-	}
+    @Override
+    public void run() {
+        UpdateCodeSegment cs1 = new UpdateCodeSegment();
+        cs1.ds1.setKey("key", ds1.index);
+        Value[] array = ((Value)ds1.getVal()).asArrayValue().getElementArray();
+        int val = array[0].asIntegerValue().getInt();
+        if (val % 10 == 0)
+            System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024 + "MB");
+        if (val >= 10000000) {
+            System.exit(0);
+        }
+        array[0] = ValueFactory.createIntegerValue(val + 1);
+        ods.update("local", "key", array);
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/SingletonTestCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/SingletonTestCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -7,28 +7,28 @@
 import alice.datasegment.Receiver;
 
 public class SingletonTestCodeSegment extends CodeSegment {
-	Receiver arg1 = ids.create(CommandType.PEEK);
-	private static SingletonTestCodeSegment instance = new SingletonTestCodeSegment();
-	private SingletonTestCodeSegment(){}
-	
-	public static SingletonTestCodeSegment getInstance(){
-		return instance;
-	}
-	
-	@Override
-	public void run() {
-		System.out.println("type = " + arg1.type);
-		System.out.println("index = " + arg1.index);
-		System.out.println("data = " + arg1.getVal());
-		System.out.println(((Value)arg1.getVal()).getType());
-		
-		if (arg1.index == 10) {
-			System.exit(0);
-			return;
-		}
-		
-		this.recycle();
-		ods.update("local", "key2", "String data");
-	}
+    Receiver arg1 = ids.create(CommandType.PEEK);
+    private static SingletonTestCodeSegment instance = new SingletonTestCodeSegment();
+    private SingletonTestCodeSegment(){}
+
+    public static SingletonTestCodeSegment getInstance(){
+        return instance;
+    }
+
+    @Override
+    public void run() {
+        System.out.println("type = " + arg1.type);
+        System.out.println("index = " + arg1.index);
+        System.out.println("data = " + arg1.getVal());
+        System.out.println(((Value)arg1.getVal()).getType());
+
+        if (arg1.index == 10) {
+            System.exit(0);
+            return;
+        }
+
+        this.recycle();
+        ods.update("local", "key2", "String data");
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/StartCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/StartCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,17 +4,17 @@
 
 public class StartCodeSegment extends CodeSegment {
 
-	@Override
-	public void run() {
-		System.out.println("run StartCodeSegment");
-		
-		TestCodeSegment cs = new TestCodeSegment();
-		cs.arg1.setKey("key1"); // unbound datasegment key1 is created and connect to cs.
-								// cs is waiting for local.key1
-		System.out.println("create TestCodeSegment");
-		
-		ods.update("local", "key1", "String data"); // bind string data to datasegment local.key1
-													// this startup TestCodeSegment.
- 	}
+    @Override
+    public void run() {
+        System.out.println("run StartCodeSegment");
+
+        TestCodeSegment cs = new TestCodeSegment();
+        cs.arg1.setKey("key1"); // unbound datasegment key1 is created and connect to cs.
+                                // cs is waiting for local.key1
+        System.out.println("create TestCodeSegment");
+
+        ods.update("local", "key1", "String data"); // bind string data to datasegment local.key1
+                                                    // this startup TestCodeSegment.
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/TestCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/TestCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,27 +6,27 @@
 import org.msgpack.type.Value;
 
 public class TestCodeSegment extends CodeSegment {
-	
-	// create input datasegment arg1
-	Receiver arg1 = ids.create(CommandType.PEEK);
-	
-	@Override
-	public void run() {
-		System.out.println("type = " + arg1.type);
-		System.out.println("index = " + arg1.index);
-		System.out.println("data = " + arg1.getVal());
-		System.out.println(((Value)arg1.getVal()).getType());
-		
-		if (arg1.index == 10) {
-			System.exit(0);
-			return;
-		}
-		
-		TestCodeSegment cs = new TestCodeSegment();
-		cs.arg1.setKey("key1", arg1.index);
-		
-		// DataSegment.get("local").update
-		ods.update("local", "key1", "String data");
-	}
+
+    // create input datasegment arg1
+    Receiver arg1 = ids.create(CommandType.PEEK);//peek用Receiverを生成
+
+    @Override
+    public void run() {
+        System.out.println("type = " + arg1.type);
+        System.out.println("index = " + arg1.index);
+        System.out.println("data = " + arg1.getVal());
+        System.out.println(((Value)arg1.getVal()).getType());//←伝統。なくてもいい。
+
+        if (arg1.index == 10) {
+            System.exit(0);
+            return;
+        }
+
+        TestCodeSegment cs = new TestCodeSegment();
+        cs.arg1.setKey("key1", arg1.index);//Receiverに値をpeekしてくる
+
+        // DataSegment.get("local").update
+        ods.update("local", "key1", "String data");
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/TestLocalAlice.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/TestLocalAlice.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,9 +4,9 @@
 import alice.daemon.Config;
 
 public class TestLocalAlice {
-	public static void main(String args[]) {
-		new AliceDaemon(new Config(args)).listen(); // logger off
-		new StartCodeSegment().execute();
-	}
-	
+    public static void main(String args[]) {
+        new AliceDaemon(new Config(args)).listen(); // logger off
+        new StartCodeSegment().execute();
+    }
+
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/DataInfo.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/DataInfo.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,13 +4,13 @@
 
 @Message
 public class DataInfo {
-	public int index;
-	public int ptr;
-	
-	public DataInfo(){}
-	
-	public DataInfo(int _index, int _ptr){
-		index = _index;
-		ptr = _ptr;
-	}
+    public int index;
+    public int ptr;
+
+    public DataInfo(){}
+
+    public DataInfo(int _index, int _ptr){
+        index = _index;
+        ptr = _ptr;
+    }
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/DataList.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/DataList.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,71 +5,71 @@
 @Message
 public class DataList {
 
-	public int[] table;
-	
-	public DataList(int size){
-		table = new int[size];
-	}
-	
-	public DataList(int[] numbers){
-		table = numbers;
-	}
-	
-	public DataList createDataList(int start, int size){
-		int[] table2 = new int[size];
-		int end = start+size;
-		for (int i=start,j=0;i<end;i++,j++){
-			table2[j] = table[i];
-		}
-		return new DataList(table2);
-	}
-	
-	public void swap(int i, int j){
-		int tmp = table[i]; 
-		table[i] = table[j];
-		table[j] = tmp;
-	}
-	
-	public void showData(){
-		for (int aTable : table) {
-			System.out.print(aTable + " ");
-		}
-		System.out.println();
-	}
-	
-	public void showData(int range){
-		for(int i = 0;i<range;i++){
-			System.out.print(table[i]+ " ");
-			
-		}
-		System.out.println();
-	}
-	
-	public void showSize(){
-		System.out.print("size is "+this.table.length+". ");
-	}
-	
-	public int getSize(){
-		return this.table.length;
-	}
+    public int[] table;
+
+    public DataList(int size){
+        table = new int[size];
+    }
+
+    public DataList(int[] numbers){
+        table = numbers;
+    }
+
+    public DataList createDataList(int start, int size){
+        int[] table2 = new int[size];
+        int end = start+size;
+        for (int i=start,j=0;i<end;i++,j++){
+            table2[j] = table[i];
+        }
+        return new DataList(table2);
+    }
+
+    public void swap(int i, int j){
+        int tmp = table[i];
+        table[i] = table[j];
+        table[j] = tmp;
+    }
 
-	public static void merge(DataList list1, DataList list2) {
-		int[] t1 = list1.table; 
-		int[] t2 = list2.table; 
-		int[] t0 = list1.table.clone(); // copy to avoid destroy t1
-		int i = 0, j= 0,n=0;
+    public void showData(){
+        for (int aTable : table) {
+            System.out.print(aTable + " ");
+        }
+        System.out.println();
+    }
+
+    public void showData(int range){
+        for(int i = 0;i<range;i++){
+            System.out.print(table[i]+ " ");
+
+        }
+        System.out.println();
+    }
+
+    public void showSize(){
+        System.out.print("size is "+this.table.length+". ");
+    }
+
+    public int getSize(){
+        return this.table.length;
+    }
+
+    public static void merge(DataList list1, DataList list2) {
+        int[] t1 = list1.table;
+        int[] t2 = list2.table;
+        int[] t0 = list1.table.clone(); // copy to avoid destroy t1
+        int i = 0, j= 0,n=0;
         while (i< t0.length) {
             if (n>=t1.length) { // switch to the second list
                 t1 = t2; n = 0;
             }
-            if (j>=t2.length || t0[i] < t2[j]) { 
+            if (j>=t2.length || t0[i] < t2[j]) {
                 t1[n] = t0[i];  // including when  j reaches end of t2
                 i++; n++;
             } else {
                 t1[n] = t2[j];
                 j++; n++;
             }
-        }               
-	}
-	
+        }
+    }
+
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/LocalBitonicSort.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/LocalBitonicSort.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,10 +4,10 @@
 import alice.daemon.Config;
 
 public class LocalBitonicSort {
-	public static void main(String[] args){
-		new AliceDaemon(new Config(args)).listen(); // logger off
-		
-		SortConfig conf = new SortConfig(args);
-		new SetInfo(conf).execute();
-	}
+    public static void main(String[] args){
+        new AliceDaemon(new Config(args)).listen(); // logger off
+
+        SortConfig conf = new SortConfig(args);
+        new SetInfo(conf).execute();
+    }
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/MakeData.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/MakeData.java	Thu Nov 30 19:42:31 2017 +0900
@@ -7,25 +7,25 @@
 import alice.datasegment.Receiver;
 
 public class MakeData extends CodeSegment {
-	
-	private Receiver info1 = ids.create(CommandType.PEEK);
-	private Receiver info2 = ids.create(CommandType.TAKE);
+
+    private Receiver info1 = ids.create(CommandType.PEEK);
+    private Receiver info2 = ids.create(CommandType.TAKE);
+
+    public MakeData(){
+        info1.setKey("sortconf");
+        info2.setKey("data");
+    }
 
-	public MakeData(){
-		info1.setKey("sortconf");
-		info2.setKey("data");
-	}
-	
-	@Override
-	public void run() {
-		// This conversion over head should be remove.
-		SortConfig conf = info1.asClass(SortConfig.class);
-		DataList list = info2.asClass(DataList.class);
-		int size = conf.getLength();
-		Random rnd = new Random();
-		for (int i = 0; i < size; i++){
-			list.table[i] = rnd.nextInt(100000)+10;
-		}
-		ods.update("list", list);
-	}
+    @Override
+    public void run() {
+        // This conversion over head should be remove.
+        SortConfig conf = info1.asClass(SortConfig.class);
+        DataList list = info2.asClass(DataList.class);
+        int size = conf.getLength();
+        Random rnd = new Random();
+        for (int i = 0; i < size; i++){
+            list.table[i] = rnd.nextInt(100000)+10;
+        }
+        ods.update("list", list);
+    }
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/RangeInfo.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/RangeInfo.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,13 +4,13 @@
 
 @Message
 public class RangeInfo {
-	public int range;
-	public boolean lastFlag;
-	
-	public RangeInfo(){}
-	public RangeInfo(int i,boolean flag){
-		range = i;
-		lastFlag = flag;
-	}
+    public int range;
+    public boolean lastFlag;
+
+    public RangeInfo(){}
+    public RangeInfo(int i,boolean flag){
+        range = i;
+        lastFlag = flag;
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/SetInfo.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/SetInfo.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,37 +4,37 @@
 
 public class SetInfo extends CodeSegment {
 
-	private SortConfig conf;
-	public static String[] range;
-	public static String[] array;
-	public static String[] count;
-	
-	public SetInfo(SortConfig conf) {
-		this.conf = conf;
-	}
+    private SortConfig conf;
+    public static String[] range;
+    public static String[] array;
+    public static String[] count;
+
+    public SetInfo(SortConfig conf) {
+        this.conf = conf;
+    }
+
+    @Override
+    public void run() {
+        ods.put("sortconf", conf);
+        ods.put("data", new DataList(conf.length));
+        // sortconf and datasegments should be passed directory.
 
-	@Override
-	public void run() {
-		ods.put("sortconf", conf);
-		ods.put("data", new DataList(conf.length));
-		// sortconf and datasegments should be passed directory.
-		
-		create_keys();
-		new MakeData();
-		new SetTask();
-	}
+        create_keys();
+        new MakeData();
+        new SetTask();
+    }
+
+    private void create_keys() {
+        range = new String[conf.length];
+        array = new String[conf.length];
+        count = new String[conf.length];
 
-	private void create_keys() {
-		range = new String[conf.length];
-		array = new String[conf.length];
-		count = new String[conf.length];
-		
-		for(int i = 0 ; i < conf.length ; i++) {
-			range[i] = "range" + i;
-			array[i] = "array" + i;
-			count[i] = "count" + i;
-		}
-		
-	}
-	
+        for(int i = 0 ; i < conf.length ; i++) {
+            range[i] = "range" + i;
+            array[i] = "array" + i;
+            count[i] = "count" + i;
+        }
+
+    }
+
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/SetTask.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/SetTask.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,44 +5,42 @@
 import alice.datasegment.Receiver;
 
 public class SetTask extends CodeSegment {
-	public static long t;
-	private Receiver info1 = ids.create(CommandType.PEEK);
-	private Receiver info2 = ids.create(CommandType.TAKE);
-	
-	SetTask(){
-		info1.setKey("sortconf");
-		info2.setKey("list");
-	}
-	
-	@Override
-	public void run() {
-		SortConfig conf = info1.asClass(SortConfig.class);
-		DataList list = info2.asClass(DataList.class);
-		
-		int sort_count = conf.getSplitNum()*2;
-		ods.put("sort_count", sort_count*2);
-	
-		int block_num = (conf.getLength() + sort_count- 1) / sort_count;
-		ods.put("block_num", block_num);
-		
-		System.out.println("sort start");
-		t = System.currentTimeMillis();
-		{
-			int i;
-			for (i = 0; i < sort_count / 2; i++) {
-				// anonymous datasegmaents should be used.
-				ods.put(SetInfo.range[i], new RangeInfo(i,i==(sort_count/2)-1));
-				ods.update(SetInfo.array[i*2], list.createDataList(i*2*block_num, block_num));
-				ods.update(SetInfo.array[i*2+1], list.createDataList((i*2+1)*block_num, block_num));
-				ods.update(SetInfo.count[i], 0);
-				new SortPhase(SetInfo.range[i],SetInfo.array[i*2],SetInfo.array[i*2+1],0,SetInfo.count[i]);
-				
-			}
-			new ShowData(i*2, sort_count);
-			
-		}
-		
-		
-	}
+    public static long t;
+    private Receiver info1 = ids.create(CommandType.PEEK);
+    private Receiver info2 = ids.create(CommandType.TAKE);
+
+    SetTask(){
+        info1.setKey("sortconf");
+        info2.setKey("list");
+    }
+
+    @Override
+    public void run() {
+        SortConfig conf = info1.asClass(SortConfig.class);
+        DataList list = info2.asClass(DataList.class);
+
+        int sort_count = conf.getSplitNum()*2;
+        ods.put("sort_count", sort_count*2);
+
+        int block_num = (conf.getLength() + sort_count- 1) / sort_count;
+        ods.put("block_num", block_num);
+
+        System.out.println("sort start");
+        t = System.currentTimeMillis();
+        {
+            int i;
+            for (i = 0; i < sort_count / 2; i++) {
+                // anonymous datasegmaents should be used.
+                ods.put(SetInfo.range[i], new RangeInfo(i,i==(sort_count/2)-1));
+                ods.update(SetInfo.array[i*2], list.createDataList(i*2*block_num, block_num));
+                ods.update(SetInfo.array[i*2+1], list.createDataList((i*2+1)*block_num, block_num));
+                ods.update(SetInfo.count[i], 0);
+                new SortPhase(SetInfo.range[i],SetInfo.array[i*2],SetInfo.array[i*2+1],0,SetInfo.count[i]);
+
+            }
+        }
+        new ShowData(sort_count, sort_count);
+
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/ShowData.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/ShowData.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,39 +5,39 @@
 import alice.datasegment.Receiver;
 
 public class ShowData extends CodeSegment{
-	
-	private Receiver[] info;
-	
-	public ShowData(int cnt, int index) {
-		info = new Receiver[cnt];
-		for (int i= 0;i < cnt; i++)
-			info[i] = ids.create(CommandType.PEEK);
-		for (int i= 0;i < cnt; i++)
-			info[i].setKey(SetInfo.array[i],index);
-		
-	}
-	
-	@Override
-	public void run() {
-		System.out.println(System.currentTimeMillis() -SetTask.t +" ms");
-		int size = 0;
-		for (Receiver anInfo : info) {
-			DataList dlist = anInfo.asClass(DataList.class);
-			size += dlist.table.length;
-		}
-		
-		DataList list = new DataList(size);
-		
-		int start = 0;
-		for (Receiver anInfo : info) {
-			DataList dlist = anInfo.asClass(DataList.class);
-			System.arraycopy(dlist.table, 0, list.table, start, dlist.table.length);
-			start += dlist.table.length;
-		}
-		System.out.println("size check :"+ list.table.length);
-		Sort.check(list);
-		System.exit(0);
-	}
-	
-	
+
+    private Receiver[] info;
+
+    public ShowData(int cnt, int index) {
+        info = new Receiver[cnt];
+        for (int i= 0;i < cnt; i++)
+            info[i] = ids.create(CommandType.TAKE);
+        for (int i= 0;i < cnt; i++)
+            info[i].setKey(SetInfo.array[i],index);
+
+    }
+
+    @Override
+    public void run() {
+        System.out.println(System.currentTimeMillis() -SetTask.t +" ms");
+        int size = 0;
+        for (Receiver anInfo : info) {
+            DataList dlist = anInfo.asClass(DataList.class);
+            size += dlist.table.length;
+        }
+
+        DataList list = new DataList(size);
+
+        int start = 0;
+        for (Receiver anInfo : info) {
+            DataList dlist = anInfo.asClass(DataList.class);
+            System.arraycopy(dlist.table, 0, list.table, start, dlist.table.length);
+            start += dlist.table.length;
+        }
+        System.out.println("size check :"+ list.table.length);
+        Sort.check(list);
+        System.exit(0);
+    }
+
+
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/Sort.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/Sort.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,63 +1,63 @@
 package alice.test.codesegment.local.bitonicsort;
 
 public class Sort {
-	
-	// this method has "stack overflow" problem
-	public static void quickSort(DataList data){
-		int[] stack = new int[8192];
-		int sp = 0;
-		int begin = 0;
-		int end = data.table.length-1; // index is up to length-1
-		while(true){
-			while(begin < end){
-				if (end-begin< 40){
-					bubbleSort(data,begin,end);
-					break;
-				} else {
-					int where = (begin+end)/2;
-					int pivot = data.table[where];
-					data.table[where] = data.table[begin];
-					int p = begin;
-					for (int i=begin+1;i<=end;i++){
-						if (data.table[i]<pivot){
-							p++;
-							if (i!=p)data.swap(p,i);
-						}
-					}
-					data.table[begin] = data.table[p];
-					data.table[p] = pivot;
-					stack[sp++] = p+1;
-					stack[sp++] = end;
-					end=p-1;
-				}
-			}
-			if (sp==0) return;
-			end = stack[--sp];
-			begin = stack[--sp];
-			
-		}
-	}
-	
-	public static void bubbleSort(DataList data ,int begin,int end){
-		for (int i=begin;i<end;i++){
-			for (int j=end;j>i;j--){
-				if (data.table[i] > data.table[j]){
-					data.swap(i,j);
-				}
-			}
-		}
-		
-		
-	}
-	
-	public static void check(DataList data){
-		System.out.println("checking ....");
-		for (int i = 0; i< data.table.length-1; i++){
-			if (data.table[i] > data.table[i+1]){
-				System.out.println("MISS "+data.table[i]+" > "+data.table[i+1]+" Position is "+i);
-				return;
-			}
-		}
-		System.out.println("sort is succeed");
-	}
+
+    // this method has "stack overflow" problem
+    public static void quickSort(DataList data){
+        int[] stack = new int[8192];
+        int sp = 0;
+        int begin = 0;
+        int end = data.table.length-1; // index is up to length-1
+        while(true){
+            while(begin < end){
+                if (end-begin< 40){
+                    bubbleSort(data,begin,end);
+                    break;
+                } else {
+                    int where = (begin+end)/2;
+                    int pivot = data.table[where];
+                    data.table[where] = data.table[begin];
+                    int p = begin;
+                    for (int i=begin+1;i<=end;i++){
+                        if (data.table[i]<pivot){
+                            p++;
+                            if (i!=p)data.swap(p,i);
+                        }
+                    }
+                    data.table[begin] = data.table[p];
+                    data.table[p] = pivot;
+                    stack[sp++] = p+1;
+                    stack[sp++] = end;
+                    end=p-1;
+                }
+            }
+            if (sp==0) return;
+            end = stack[--sp];
+            begin = stack[--sp];
+
+        }
+    }
+
+    public static void bubbleSort(DataList data ,int begin,int end){
+        for (int i=begin;i<end;i++){
+            for (int j=end;j>i;j--){
+                if (data.table[i] > data.table[j]){
+                    data.swap(i,j);
+                }
+            }
+        }
+
+
+    }
+
+    public static void check(DataList data){
+        System.out.println("checking ....");
+        for (int i = 0; i< data.table.length-1; i++){
+            if (data.table[i] > data.table[i+1]){
+                System.out.println("MISS "+data.table[i]+" > "+data.table[i+1]+" Position is "+i);
+                return;
+            }
+        }
+        System.out.println("sort is succeed");
+    }
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/SortConfig.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/SortConfig.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,36 +4,36 @@
 
 @Message
 public class SortConfig {
-	public int length = 1200;
-	public int MAX_BLOCK_SIZE = 1024;
-	public int cpu = 1;
-	
-	public SortConfig(){}
-	
-	public SortConfig(String[] args){
-		for (int i=0;i<args.length; i++){
-			if ("-l".equals(args[i])){
-				length = Integer.parseInt(args[++i]);	
-			} else if ("-b".equals(args[i])){
-				MAX_BLOCK_SIZE = Integer.parseInt(args[++i]);	
-			}
-		}
-		if (length<MAX_BLOCK_SIZE) MAX_BLOCK_SIZE = length;
-	}
+    public int length = 1200;
+    public int MAX_BLOCK_SIZE = 1024;
+    public int cpu = 1;
+
+    public SortConfig(){}
+
+    public SortConfig(String[] args){
+        for (int i=0;i<args.length; i++){
+            if ("-l".equals(args[i])){
+                length = Integer.parseInt(args[++i]);
+            } else if ("-b".equals(args[i])){
+                MAX_BLOCK_SIZE = Integer.parseInt(args[++i]);
+            }
+        }
+        if (length<MAX_BLOCK_SIZE) MAX_BLOCK_SIZE = length;
+    }
 
-	public int getLength() {
-		return length;
-	}
+    public int getLength() {
+        return length;
+    }
+
+    public int getblockSize() {
+        return MAX_BLOCK_SIZE;
+    }
 
-	public int getblockSize() {
-		return MAX_BLOCK_SIZE;
-	}
-	
-	public int getSplitNum(){
-		if (length / cpu < MAX_BLOCK_SIZE){
-			return cpu;
-		} else {
-			return (length + MAX_BLOCK_SIZE -1) / MAX_BLOCK_SIZE;
-		}
-	}
+    public int getSplitNum(){
+        if (length / cpu < MAX_BLOCK_SIZE){
+            return cpu;
+        } else {
+            return (length + MAX_BLOCK_SIZE -1) / MAX_BLOCK_SIZE;
+        }
+    }
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/SortPhase.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/SortPhase.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,56 +5,56 @@
 import alice.datasegment.Receiver;
 
 public class SortPhase extends CodeSegment{
-	private Receiver info0 = ids.create(CommandType.PEEK); // range
-	private Receiver info1 = ids.create(CommandType.TAKE); // Array1
-	private Receiver info2 = ids.create(CommandType.TAKE); // Array2
-	private Receiver info3 = ids.create(CommandType.PEEK); // sort_count
-	private Receiver info4 = ids.create(CommandType.TAKE); // count
-	
-	
-	public SortPhase(String key0, String key1, String key2, int index, String key4){
-		info0.setKey(key0);
-		info1.setKey(key1,index);
-		info2.setKey(key2,index);
-		info3.setKey("sort_count");
-		info4.setKey(key4);
-	}
-	
-	@Override
-	public void run() {
-		RangeInfo info = info0.asClass(RangeInfo.class);
-		DataList list1 = info1.asClass(DataList.class);
-		DataList list2 = info2.asClass(DataList.class);
-		int sort_count = info3.asInteger();
-		int count = info4.asInteger();
-		
-		int i = info.range;
-		//System.out.println("CS"+i+" "+info1.key+" "+info2.key+" dataIndex "+info1.index +" count "+count);
-		Sort.quickSort(list1);
-		Sort.quickSort(list2);
-		DataList.merge(list1,list2);
-		
-		if (count%2==0&&i==0){
-			ods.flip(info1); // first block index is less than others. So put data twice.
-		} else if (count%2==0&&info.lastFlag){
-			ods.flip(info2); // Same reason 
-		}
-		
-		ods.flip(info1);
-		ods.flip(info2);
-		
-		if (count%2==0&&info.lastFlag&&count+2<sort_count/2){
-			new SortPhase(info0.key, info1.key, info2.key,count+2,info4.key);
-			ods.update(info4.key, count+2);
-		} else {
-			String f = (count%2==1) ? SetInfo.array[2*i] : SetInfo.array[2*i+1];
-			String b = (count%2==1) ? SetInfo.array[2*i+1] : SetInfo.array[2*i+2];
-			
-			new SortPhase(info0.key, f, b, count+1, info4.key);
-			ods.update(info4.key, count+1);
-		}
-		
-		
-	}
-	
+    private Receiver info0 = ids.create(CommandType.PEEK); // range
+    private Receiver info1 = ids.create(CommandType.TAKE); // Array1
+    private Receiver info2 = ids.create(CommandType.TAKE); // Array2
+    private Receiver info3 = ids.create(CommandType.PEEK); // sort_count
+    private Receiver info4 = ids.create(CommandType.TAKE); // count
+
+
+    public SortPhase(String key0, String key1, String key2, int index, String key4){
+        info0.setKey(key0);
+        info1.setKey(key1,index);
+        info2.setKey(key2,index);
+        info3.setKey("sort_count");
+        info4.setKey(key4);
+    }
+
+    @Override
+    public void run() {
+        RangeInfo info = info0.asClass(RangeInfo.class);
+        DataList list1 = info1.asClass(DataList.class);
+        DataList list2 = info2.asClass(DataList.class);
+        int sort_count = info3.asInteger();
+        int count = info4.asInteger();
+
+        int i = info.range;
+        //System.out.println("CS"+i+" "+info1.key+" "+info2.key+" dataIndex "+info1.index +" count "+count);
+        Sort.quickSort(list1);
+        Sort.quickSort(list2);
+        DataList.merge(list1,list2);
+
+        if (count%2==0&&i==0){
+            ods.flip(info1); // first block index is less than others. So put data twice.
+        } else if (count%2==0&&info.lastFlag){
+            ods.flip(info2); // Same reason
+        }
+
+        ods.flip(info1);
+        ods.flip(info2);
+
+        if (count%2==0&&info.lastFlag&&count+2<sort_count/2){
+            new SortPhase(info0.key, info1.key, info2.key,count+2,info4.key);
+            ods.update(info4.key, count+2);
+        } else {
+            String f = (count%2==1) ? SetInfo.array[2*i] : SetInfo.array[2*i+1];
+            String b = (count%2==1) ? SetInfo.array[2*i+1] : SetInfo.array[2*i+2];
+
+            new SortPhase(info0.key, f, b, count+1, info4.key);
+            ods.update(info4.key, count+1);
+        }
+
+
+    }
+
 }
--- a/src/main/java/alice/test/codesegment/local/bitonicsort/SortTest.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/bitonicsort/SortTest.java	Thu Nov 30 19:42:31 2017 +0900
@@ -3,53 +3,53 @@
 import java.util.Random;
 
 public class SortTest {
-	
-	public static void main(String args[]){
-		int size1 = 1000000;
-		int size2 = 1000;
-		int MAX = 1000000;
-		long t;
-		DataList list1 = new DataList(size1);
-		DataList list2 = new DataList(size1);
-		DataList list3 = new DataList(size2);
-		
-		Random rnd = new Random();
-		for (int i = 0; i < size1; i++){
-			int num = rnd.nextInt(MAX)+10;
-			list1.table[i] = num;
-			list2.table[i] = num;
-		}
-		for (int i = 0; i < size2; i++){
-			int num = rnd.nextInt(MAX)+10;
-			list3.table[i] = num;
-		}
-		
-		// bubbleSort
-		t = System.currentTimeMillis();
-		Sort.bubbleSort(list3,0,list3.table.length-1);
-		System.out.println("bubble sort : "+ (System.currentTimeMillis()-t)+" ms");
-		Sort.check(list3);
-		
-		// quickSort
-		t = System.currentTimeMillis();
-		Sort.quickSort(list1);
-		System.out.println("quick sort1 : "+ (System.currentTimeMillis()-t)+" ms");
-		Sort.check(list1);
-		
-		t = System.currentTimeMillis();
-		Sort.quickSort(list2);
-		System.out.println("quick sort2 : "+ (System.currentTimeMillis()-t)+" ms");
-		Sort.check(list2);
-		
-		// merge Test
-	    DataList.merge(list1, list2);
-	    Sort.check(list1);
-	    Sort.check(list2);
-	    
-	    // separate Test
-	    list1.showData(50);
-	    list1.createDataList(0, 25).showSize();
-	    list1.createDataList(0, 25).showData();
-	    list1.createDataList(25, 25).showData();
-	}
+
+    public static void main(String args[]){
+        int size1 = 1000000;
+        int size2 = 1000;
+        int MAX = 1000000;
+        long t;
+        DataList list1 = new DataList(size1);
+        DataList list2 = new DataList(size1);
+        DataList list3 = new DataList(size2);
+
+        Random rnd = new Random();
+        for (int i = 0; i < size1; i++){
+            int num = rnd.nextInt(MAX)+10;
+            list1.table[i] = num;
+            list2.table[i] = num;
+        }
+        for (int i = 0; i < size2; i++){
+            int num = rnd.nextInt(MAX)+10;
+            list3.table[i] = num;
+        }
+
+        // bubbleSort
+        t = System.currentTimeMillis();
+        Sort.bubbleSort(list3,0,list3.table.length-1);
+        System.out.println("bubble sort : "+ (System.currentTimeMillis()-t)+" ms");
+        Sort.check(list3);
+
+        // quickSort
+        t = System.currentTimeMillis();
+        Sort.quickSort(list1);
+        System.out.println("quick sort1 : "+ (System.currentTimeMillis()-t)+" ms");
+        Sort.check(list1);
+
+        t = System.currentTimeMillis();
+        Sort.quickSort(list2);
+        System.out.println("quick sort2 : "+ (System.currentTimeMillis()-t)+" ms");
+        Sort.check(list2);
+
+        // merge Test
+        DataList.merge(list1, list2);
+        Sort.check(list1);
+        Sort.check(list2);
+
+        // separate Test
+        list1.showData(50);
+        list1.createDataList(0, 25).showSize();
+        list1.createDataList(0, 25).showData();
+        list1.createDataList(25, 25).showData();
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/codesegment/local/factorial/FactorialCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,46 @@
+package alice.test.codesegment.local.factorial;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+/**
+ * Created by e125769 on 2/24/15.
+ */
+public class FactorialCodeSegment extends CodeSegment {
+
+    Receiver input[];
+
+    public  FactorialCodeSegment(int n, String key){//5個Receiverを作る
+        input = new Receiver[n];
+        for (int i = 0; i < n; i++){
+            input[i] = ids.create(CommandType.TAKE);//take用Receiverを生成
+        }
+        for (int i = 0; i < n; i++){//createと同じループではだめ。修論参照。
+            input[i].setKey(key);
+        }
+    }
+
+    @Override
+    public void run() {//main.
+        System.out.println("run FactorialCodeSegment");
+
+        long result = 1;
+
+        for (int i = 0; i < input.length; i++){//わける
+            result *= input[i].asClass(Long.class);//(int)r.getObj(); , asInteger Remoteは別。byteArrayだから
+        }
+
+        System.out.println(input[input.length - 1].asClass(Long.class) + "まで: " + result);
+
+        ods.put("key1", result);
+
+        if (input[0].key.equals("key1")){
+            new FactorialCodeSegment(4, "key1");//setKeyよりあとに操作しない
+        }
+
+        System.exit(0);
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/codesegment/local/factorial/StartCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,38 @@
+package alice.test.codesegment.local.factorial;
+
+import alice.codesegment.CodeSegment;
+import alice.test.codesegment.local.TestCodeSegment;
+
+/**
+ * Created by e125769 on 2/24/15.
+ */
+public class StartCodeSegment extends CodeSegment{
+
+    @Override
+    public void run() {//データをセット&表示をするCS
+        System.out.println("run StartCodeSegment");
+
+        FactorialCodeSegment cs[] = new FactorialCodeSegment[4];//計算するCSを用意
+
+        System.out.println("create FactorialCodeSegment");
+
+        for (int i = 0; i < cs.length; i++){//4回CSを走らせている
+            cs[i] = new FactorialCodeSegment(5, "key" + i);//配列にCSインスタンスを代入 newした時点でコンストラクタのsetKeyでデータを取りに行く
+        }
+
+        for (long i = 1; i <= 20; i++) {//1~100までを4つのキューに格納
+            if (i <= 5){//一応パイプライン状に走る
+                ods.put("local", "key0", i);
+            } else if (5 < i && i <= 10){
+                ods.put("local", "key1", i);
+            } else if (10 < i && i <= 15){
+                ods.put("local", "key2", i);
+            } else{
+                ods.put("local", "key3", i);
+            }
+        }
+
+
+    }
+
+}
--- a/src/main/java/alice/test/codesegment/local/wordcount/CorrectResult.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/wordcount/CorrectResult.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,31 +6,31 @@
 
 public class CorrectResult extends CodeSegment{
 
-	private Receiver[] array;
-	
-	public CorrectResult(int size) {
-		array = new Receiver[size];
-		for (int i=0;i<size;i++){
-			array[i] = ids.create(CommandType.TAKE);
-		}
-		for (int i=0;i<size;i++)
-			array[i].setKey("result");
-	}
+    private Receiver[] array;
+
+    public CorrectResult(int size) {
+        array = new Receiver[size];
+        for (int i=0;i<size;i++){
+            array[i] = ids.create(CommandType.TAKE);
+        }
+        for (int i=0;i<size;i++)
+            array[i].setKey("result");
+    }
 
-	@Override
-	public void run() {
-		int line_num = 0;
-		int word_num = 0;
-		Result result;
-		for (Receiver anArray : array) {
-			result = anArray.asClass(Result.class);
-			line_num += result.line_num;
-			word_num += result.word_num;
-		}
-		System.out.println(System.currentTimeMillis() - StartWordCount.t);
-		System.out.println(line_num+" "+word_num);
-		System.exit(0);
-		
-	}
+    @Override
+    public void run() {
+        int line_num = 0;
+        int word_num = 0;
+        Result result;
+        for (Receiver anArray : array) {
+            result = anArray.asClass(Result.class);
+            line_num += result.line_num;
+            word_num += result.word_num;
+        }
+        System.out.println(System.currentTimeMillis() - StartWordCount.t);
+        System.out.println(line_num+" "+word_num);
+        System.exit(0);
+
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/wordcount/Range.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/wordcount/Range.java	Thu Nov 30 19:42:31 2017 +0900
@@ -2,15 +2,15 @@
 
 public class Range {
 
-	public char[] array;
-	public char nextchar;
-	
-	public Range(int size){
-		this.array = new char[size];
-	}
+    public char[] array;
+    public char nextchar;
 
-	public Range(char[] _array) {
-		this.array = _array;
-	}
+    public Range(int size){
+        this.array = new char[size];
+    }
+
+    public Range(char[] _array) {
+        this.array = _array;
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/wordcount/ReadFileTest.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/wordcount/ReadFileTest.java	Thu Nov 30 19:42:31 2017 +0900
@@ -8,39 +8,39 @@
 import java.io.InputStreamReader;
 
 public class ReadFileTest {
-	
-	public static void main(String[] args){
-		WordConfig conf = new WordConfig(args);
-		BufferedReader br = null;
-		int i = 0;
-		try {
-			br= new BufferedReader(
-					new InputStreamReader(
-							new FileInputStream(
-									new File(conf.filename)
-									)));
-			int size = 4; // Kbyte
-			
-			Range range = new Range(size);
-			int check = br.read(range.array);
-			for (;check!=-1;i++){
-			
-				char[] array;
-				array = new char[size];
-				check = br.read(array);
-				range.nextchar = array[0];
-				System.out.print(range.array); // ods
-				System.out.println(range.nextchar);
-				range = new Range(array);
-			} 
-			System.out.println(i);
-		} catch (FileNotFoundException e) {
-			System.out.println("file was not found");
-			System.exit(1);
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		
-	}
+
+    public static void main(String[] args){
+        WordConfig conf = new WordConfig(args);
+        BufferedReader br = null;
+        int i = 0;
+        try {
+            br= new BufferedReader(
+                    new InputStreamReader(
+                            new FileInputStream(
+                                    new File(conf.filename)
+                                    )));
+            int size = 4; // Kbyte
+
+            Range range = new Range(size);
+            int check = br.read(range.array);
+            for (;check!=-1;i++){
+
+                char[] array;
+                array = new char[size];
+                check = br.read(array);
+                range.nextchar = array[0];
+                System.out.print(range.array); // ods
+                System.out.println(range.nextchar);
+                range = new Range(array);
+            }
+            System.out.println(i);
+        } catch (FileNotFoundException e) {
+            System.out.println("file was not found");
+            System.exit(1);
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+    }
 }
--- a/src/main/java/alice/test/codesegment/local/wordcount/Result.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/wordcount/Result.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,11 +4,11 @@
 
 @Message
 public class Result {
-	public int line_num;
-	public int word_num;
-	
-	public Result(int line,int word){
-		line_num = line;
-		word_num = word;
-	}
+    public int line_num;
+    public int word_num;
+
+    public Result(int line,int word){
+        line_num = line;
+        word_num = word;
+    }
 }
--- a/src/main/java/alice/test/codesegment/local/wordcount/SeparateArray.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/wordcount/SeparateArray.java	Thu Nov 30 19:42:31 2017 +0900
@@ -9,45 +9,45 @@
 import alice.codesegment.CodeSegment;
 
 public class SeparateArray extends CodeSegment{
-	private WordConfig conf;
-	
-	SeparateArray(WordConfig conf){
-		this.conf = conf;
-	}
-	
-	@Override
-	public void run() {	
-		// cpu分だけTaskをあらかじめ作成
-	 	int cpu_num = Runtime.getRuntime().availableProcessors();
-	 	for (int cnt =0;cnt < cpu_num;cnt++){
-	 		new WordCount();
-	 	}
-		BufferedReader br = null;
-		int i = 0;
-		try {
-			br= new BufferedReader(
-					new InputStreamReader(
-							new FileInputStream(
-									new File(conf.filename)
-									)));
-			int size = conf.division * 1024; // Kbyte
-			Range range = new Range(size);
-			int check = br.read(range.array);
-			for (;check!=-1;i++){			
-				char[] array;
-				array = new char[size];
-				check = br.read(array);
-				range.nextchar = array[0];
-				ods.put("array", range);
-				range = new Range(array);
-			} 
-			new CorrectResult(i);
-		} catch (FileNotFoundException e) {
-			System.exit(1);
-		} catch (IOException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-	}
+    private WordConfig conf;
+
+    SeparateArray(WordConfig conf){
+        this.conf = conf;
+    }
+
+    @Override
+    public void run() {
+        // cpu分だけTaskをあらかじめ作成
+        int cpu_num = Runtime.getRuntime().availableProcessors();
+        for (int cnt =0;cnt < cpu_num;cnt++){
+            new WordCount();
+        }
+        BufferedReader br = null;
+        int i = 0;
+        try {
+            br= new BufferedReader(
+                    new InputStreamReader(
+                            new FileInputStream(
+                                    new File(conf.filename)
+                                    )));
+            int size = conf.division * 1024; // Kbyte
+            Range range = new Range(size);
+            int check = br.read(range.array);
+            for (;check!=-1;i++){
+                char[] array;
+                array = new char[size];
+                check = br.read(array);
+                range.nextchar = array[0];
+                ods.put("array", range);
+                range = new Range(array);
+            }
+            new CorrectResult(i);
+        } catch (FileNotFoundException e) {
+            System.exit(1);
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/wordcount/StartWordCount.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/wordcount/StartWordCount.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,12 +5,12 @@
 
 
 public class StartWordCount {
-	public static long t = System.currentTimeMillis();
-	public static void main(String[] args){
-		
-		new AliceDaemon(new Config(args)).listen(); // logger off
-		
-		WordConfig conf = new WordConfig(args);
-		new SeparateArray(conf).execute();
-	}
+    public static long t = System.currentTimeMillis();
+    public static void main(String[] args){
+
+        new AliceDaemon(new Config(args)).listen(); // logger off
+
+        WordConfig conf = new WordConfig(args);
+        new SeparateArray(conf).execute();
+    }
 }
--- a/src/main/java/alice/test/codesegment/local/wordcount/WordConfig.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/wordcount/WordConfig.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,23 +1,23 @@
 package alice.test.codesegment.local.wordcount;
 
 public class WordConfig {
-	public String filename;
-	public static String[] array;
-	public int division = 16;
-	
-	public WordConfig(String[] args) {
-		for (int i=0;i<args.length; i++){
-			if ("-f".equals(args[i])){
-				filename = args[++i];	
-			} else if ("-d".equals(args[i])){
-				division = Integer.parseInt(args[++i]);	
-			}
-		}
-		
-		if (filename==null){
-			System.out.println("Usage: WordCount -f FILENAME");
-			System.exit(0);
-		}
-	}
+    public String filename;
+    public static String[] array;
+    public int division = 16;
+
+    public WordConfig(String[] args) {
+        for (int i=0;i<args.length; i++){
+            if ("-f".equals(args[i])){
+                filename = args[++i];
+            } else if ("-d".equals(args[i])){
+                division = Integer.parseInt(args[++i]);
+            }
+        }
+
+        if (filename==null){
+            System.out.println("Usage: WordCount -f FILENAME");
+            System.exit(0);
+        }
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/local/wordcount/WordCount.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/local/wordcount/WordCount.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,43 +5,43 @@
 import alice.datasegment.Receiver;
 
 public class WordCount extends CodeSegment{
-	
-	private Receiver info1 = ids.create(CommandType.TAKE);
-	
-	public WordCount(){
-		info1.setKey("array");
-	}
+
+    private Receiver info1 = ids.create(CommandType.TAKE);
+
+    public WordCount(){
+        info1.setKey("array");
+    }
 
-	@Override
-	public void run() {
-		Range r = info1.asClass(Range.class);
-		int word_flag = 0;
-	    int word_num = 0;
-	    int line_num = 0;
-	    int i = 0;
-		for (; i < r.array.length; i++) {
-			if (r.array[i] == 0x20) { // 空白                                                                                                                                
-				word_flag = 1;
-			} else if (r.array[i] == 0x0A) { // 改行
-				line_num += 1;
-				word_flag = 1;
-			} else {
-				word_num += word_flag;
-				word_flag = 0;
-			}
-		}
-		word_num += word_flag;
-		if (r.nextchar!='\0'){ // null means last block
-			if ((r.array[i-1] == 0x0A||r.array[i-1] == 0x20) &&
-					(r.nextchar == 0x0A||r.nextchar == 0x20)){
-				word_num--;
-			}
-		}
-		
-		Result result = new Result(line_num,word_num);
-		ods.put("result", result);
-		recycle();//new WordCount();
-		
-	}
+    @Override
+    public void run() {
+        Range r = info1.asClass(Range.class);
+        int word_flag = 0;
+        int word_num = 0;
+        int line_num = 0;
+        int i = 0;
+        for (; i < r.array.length; i++) {
+            if (r.array[i] == 0x20) { // 空白
+                word_flag = 1;
+            } else if (r.array[i] == 0x0A) { // 改行
+                line_num += 1;
+                word_flag = 1;
+            } else {
+                word_num += word_flag;
+                word_flag = 0;
+            }
+        }
+        word_num += word_flag;
+        if (r.nextchar!='\0'){ // null means last block
+            if ((r.array[i-1] == 0x0A||r.array[i-1] == 0x20) &&
+                    (r.nextchar == 0x0A||r.nextchar == 0x20)){
+                word_num--;
+            }
+        }
+
+        Result result = new Result(line_num,word_num);
+        ods.put("result", result);
+        recycle();//new WordCount();
+
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/remote/RemoteIncrement.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/remote/RemoteIncrement.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,21 +6,27 @@
 
 public class RemoteIncrement extends CodeSegment {
 
-	public Receiver num = ids.create(CommandType.TAKE);
-	
-	/**
-	 * Increment DataSegment value up to 10
-	 */
-	@Override
-	public void run() {
-		int num = this.num.asInteger();
-		System.out.println("[CodeSegment] " + num++);
-		if (num == 10) System.exit(0);
+    public Receiver num = ids.create(CommandType.TAKE);//true でCompressedDSMからtake
 
-		RemoteIncrement cs = new RemoteIncrement();
-		cs.num.setKey("remote", "num");
-		
-		ods.put("local", "num", num);
-	}
+    /**
+     * Increment DataSegment value up to 10
+     */
+    @Override
+    public void run() {
+        String z = "";
+        if (num.isCompressed()){
+            z = "zMP";
+        }
+        int num = this.num.asInteger();
+        System.out.println("[CodeSegment" + z + "] " + num++);
+        if (num == 5) System.exit(0);
 
-}
+        RemoteIncrement cs = new RemoteIncrement();
+
+        ods.put("compressedremote", "num", num);
+        ods.put("remote", "num", num);
+
+        cs.num.setKey("compressedlocal", "num");
+    }
+
+}
\ No newline at end of file
--- a/src/main/java/alice/test/codesegment/remote/RemoteStartCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/remote/RemoteStartCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -3,13 +3,13 @@
 import alice.codesegment.CodeSegment;
 
 public class RemoteStartCodeSegment extends CodeSegment {
-	
-	@Override
-	public void run() {
-		RemoteIncrement cs = new RemoteIncrement();
-		cs.num.setKey("remote", "num");
-		
-		ods.put("local", "num", 0);
-	}
+
+    @Override
+    public void run() {
+        RemoteIncrement cs = new RemoteIncrement();
 
-}
+        ods.put("compressedremote", "num", 0);
+
+        cs.num.setKey("compressedlocal", "num");
+    }
+}
\ No newline at end of file
--- a/src/main/java/alice/test/codesegment/remote/TestRemoteAlice.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/remote/TestRemoteAlice.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,12 +5,12 @@
 
 public class TestRemoteAlice {
 
-	public static void main(String[] args) {
-		TestRemoteConfig conf = new TestRemoteConfig(args);
+    public static void main(String[] args) {
+        TestRemoteConfig conf = new TestRemoteConfig(args);//トポロジー設定をコマンドライン引数からとって設定?
 
-		new AliceDaemon(conf).listen();
-		DataSegment.connect(conf.key, "", conf.hostname, conf.connectPort, false);
-		new RemoteStartCodeSegment().execute();
-	}
+        new AliceDaemon(conf).listen();//構成開始?TopMはない
+        DataSegment.connect(conf.key, "", conf.hostname, conf.connectPort);
+        new RemoteStartCodeSegment().execute();
+    }
 
 }
--- a/src/main/java/alice/test/codesegment/remote/TestRemoteConfig.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/codesegment/remote/TestRemoteConfig.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,21 +4,21 @@
 
 public class TestRemoteConfig extends Config {
 
-	public String hostname;
-	public int connectPort = 10000;
-	public String key;
+    public String hostname = "127.0.0.1";
+    public int connectPort = 10000;
+    public String key = "remote";
 
-	public TestRemoteConfig(String[] args) {
-		super(args);
-		for (int i = 0; i< args.length; i++) {
-			if ("-h".equals(args[i])) {
-				hostname = args[++i];
-			} else if ("-cp".equals(args[i])) {
-				connectPort = Integer.parseInt(args[++i]);
-			} else if ("-key".equals(args[i])) {
-				key = args[++i];
-			}
-		}
-	}
+    public TestRemoteConfig(String[] args) {
+        super(args);
+        for (int i = 0; i< args.length; i++) {
+            if ("-h".equals(args[i])) {
+                hostname = args[++i];
+            } else if ("-cp".equals(args[i])) {
+                connectPort = Integer.parseInt(args[++i]);
+            } else if ("-key".equals(args[i])) {
+                key = args[++i];
+            }
+        }
+    }
 
 }
--- a/src/main/java/alice/test/concurrent/AliceConcurrentTest.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/concurrent/AliceConcurrentTest.java	Thu Nov 30 19:42:31 2017 +0900
@@ -2,17 +2,17 @@
 
 public class AliceConcurrentTest {
 
-	public static void main(String args[]) {
-		
-		int count = 1;
-		
-		for (int i = 0; i< args.length; i++) {
-			if ("-c".equals(args[i])) {
-				count = Integer.parseInt(args[++i]);
-			}
-		}
-		
-		new StartConcurrent(count).execute();
-	}
-	
+    public static void main(String args[]) {
+
+        int count = 1;
+
+        for (int i = 0; i< args.length; i++) {
+            if ("-c".equals(args[i])) {
+                count = Integer.parseInt(args[++i]);
+            }
+        }
+
+        new StartConcurrent(count).execute();
+    }
+
 }
--- a/src/main/java/alice/test/concurrent/AliceFinish.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/concurrent/AliceFinish.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,20 +6,20 @@
 
 public class AliceFinish extends CodeSegment {
 
-	private int num;
-	
-	public Receiver ds1 = ids.create(CommandType.TAKE);
-	
-	public AliceFinish(int threadNum) {
-		this.num = threadNum; 
-	}
+    private int num;
+
+    public Receiver ds1 = ids.create(CommandType.TAKE);
+
+    public AliceFinish(int threadNum) {
+        this.num = threadNum;
+    }
 
-	@Override
-	public void run() {
-		if (--num == 0) System.exit(0);
-		
-		AliceFinish cs1 = new AliceFinish(num);
-		cs1.ds1.setKey("finish");
-	}
-	
+    @Override
+    public void run() {
+        if (--num == 0) System.exit(0);
+
+        AliceFinish cs1 = new AliceFinish(num);
+        cs1.ds1.setKey("finish");
+    }
+
 }
--- a/src/main/java/alice/test/concurrent/SleepCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/concurrent/SleepCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -8,24 +8,24 @@
 
 public class SleepCodeSegment extends CodeSegment {
 
-	public Receiver ds1 = ids.create(CommandType.TAKE);
-	
-	private int num;
-	
-	public SleepCodeSegment(int i) {
-		this.num = i;
-	}
+    public Receiver ds1 = ids.create(CommandType.TAKE);
+
+    private int num;
+
+    public SleepCodeSegment(int i) {
+        this.num = i;
+    }
 
-	@Override
-	public void run() {
-		try {
-			Thread.sleep(1000);
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-		System.out.println("[CodeSegment-" + num + "] Hello, World!");
-		
-		ods.put("local", "finish", ValueFactory.createNilValue());
-	}
+    @Override
+    public void run() {
+        try {
+            Thread.sleep(1000);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        System.out.println("[CodeSegment-" + num + "] Hello, World!");
+
+        ods.put("local", "finish", ValueFactory.createNilValue());
+    }
 
 }
--- a/src/main/java/alice/test/concurrent/StartConcurrent.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/concurrent/StartConcurrent.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,27 +6,27 @@
 
 public class StartConcurrent extends CodeSegment {
 
-	private int count;
-	
-	public StartConcurrent(int count) {
-		this.count = count;
-	}
+    private int count;
+
+    public StartConcurrent(int count) {
+        this.count = count;
+    }
+
+    @Override
+    public void run() {
+        int threadNum = Runtime.getRuntime().availableProcessors() * count;
 
-	@Override
-	public void run() {
-		int threadNum = Runtime.getRuntime().availableProcessors() * count;
-		
-		AliceFinish cs1 = new AliceFinish(threadNum);
-		cs1.ds1.setKey("finish");
-		
-		for (int i = 0; i < threadNum; i++) {
-			SleepCodeSegment cs2 = new SleepCodeSegment(i);
-			cs2.ds1.setKey("wait");
-		}
-		
-		for (int i = 0; i < threadNum; i++) {
-			ods.put("local", "wait", ValueFactory.createNilValue());
-		}
-	}
-	
+        AliceFinish cs1 = new AliceFinish(threadNum);
+        cs1.ds1.setKey("finish");
+
+        for (int i = 0; i < threadNum; i++) {
+            SleepCodeSegment cs2 = new SleepCodeSegment(i);
+            cs2.ds1.setKey("wait");
+        }
+
+        for (int i = 0; i < threadNum; i++) {
+            ods.put("local", "wait", ValueFactory.createNilValue());
+        }
+    }
+
 }
--- a/src/main/java/alice/test/reflection/CSTemplate.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/reflection/CSTemplate.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,13 +4,13 @@
 
 public class CSTemplate extends CodeSegment{
 
-	public CSTemplate(){
-		
-	}
-	
-	@Override
-	public void run() {
-		
-	}
+    public CSTemplate(){
+
+    }
+
+    @Override
+    public void run() {
+
+    }
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/reflection/CloseEventManager.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,88 @@
+package alice.test.reflection;
+
+import javassist.CannotCompileException;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtConstructor;
+import javassist.CtField;
+import javassist.NotFoundException;
+
+
+public class CloseEventManager {
+    public static CloseEventManager closeManager = new CloseEventManager();
+
+    private CloseEventManager(){}
+    public static CloseEventManager getInstance(){
+        return closeManager;
+    }
+    private ClassPool cp = ClassPool.getDefault();
+
+    public <T> void setCodeSegment(String managerKey, Class<T> clazz){
+
+        CtClass cs = null;
+        String metaName = "Meta"+clazz.getSimpleName();
+        try {
+            // if cannot get mataName Class go catch NotFoundException
+            cs = cp.get(metaName);
+            // already created
+            Class<?> metaClazz = cp.getClassLoader().loadClass(metaName);
+            metaClazz.newInstance();
+        } catch (ClassNotFoundException e) {
+            System.out.println("ClassLoder loadClass error");
+            e.printStackTrace();
+        } catch (InstantiationException e) {
+            System.out.println("newInstance() error");
+        } catch (IllegalAccessException e) {
+            System.out.println("newInstance() error");
+        } catch (NotFoundException e) {
+            try {
+                CtClass parent = cp.get(clazz.getName());
+
+                // check super class is CS
+                boolean checkSuperClass = parent.getSuperclass().getSimpleName().equals("CodeSegment");
+                if (!checkSuperClass) {
+                    // argument wrong
+                    return;
+                } else {
+                    cs = cp.get(clazz.getName());
+
+                    // define meta inputDataSegment
+                    CtClass receiver = cp.get("alice.datasegment.Receiver");
+
+                    // need check exist field name
+                    String metaFieldName = "metaInfo";
+                    CtField cf = new CtField(receiver ,metaFieldName, cs);
+                    cs.addField(cf, "ids.create(alice.datasegment.CommandType.PEEK)");
+
+                    CtConstructor[] ccArray = cs.getConstructors();
+                    CtConstructor cc = null;
+                    for (int i = 0; i < ccArray.length; i++){
+                        if (ccArray[i].getName().equals(clazz.getSimpleName())){
+                            cc = ccArray[i];
+                            break;
+                        }
+
+                    }
+                    String metaSetKey = metaFieldName+".setKey(\"TEST\");";
+
+                    cc.insertAfter(metaSetKey);
+                    cs.setName(metaName);
+
+                    Class<?> metaClass = cs.toClass();
+                    metaClass.newInstance();
+                }
+            } catch (NotFoundException e1) {
+                System.out.println("not found super Class");
+                return;
+            } catch (CannotCompileException e1) {
+                e1.printStackTrace();
+            } catch (InstantiationException e1) {
+                e1.printStackTrace();
+            } catch (IllegalAccessException e1) {
+                e1.printStackTrace();
+            }
+        }
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/reflection/DisposeManager.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,102 @@
+package alice.test.reflection;
+
+import javassist.CannotCompileException;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtField;
+import javassist.CtMethod;
+import javassist.CtNewConstructor;
+import javassist.CtNewMethod;
+import javassist.NotFoundException;
+import javassist.bytecode.AccessFlag;
+
+public class DisposeManager {
+    private static DisposeManager instance = new DisposeManager();
+    private ClassPool cp = ClassPool.getDefault();
+
+    private DisposeManager(){}
+
+    public static DisposeManager getInstance(){
+        return instance;
+    }
+
+    public <T> void setCodeSegment(String managerKey, Class<T> clazz){
+        CtClass cs = null;
+        String metaName = "Meta"+clazz.getSimpleName();
+        try {
+            // if cannot get mataName Class go catch NotFoundException
+            cs = cp.get(metaName);
+            // already created
+            Class<?> metaClazz = cp.getClassLoader().loadClass(metaName);
+            metaClazz.newInstance();
+        } catch (ClassNotFoundException e) {
+            System.out.println("ClassLoder loadClass error");
+            e.printStackTrace();
+        } catch (InstantiationException e) {
+            System.out.println("newInstance() error");
+        } catch (IllegalAccessException e) {
+            System.out.println("newInstance() error");
+        } catch (NotFoundException e) {
+            try {
+                CtClass parent = cp.get(clazz.getName());
+
+                // check super class is CS
+                boolean checkSuperClass = parent.getSuperclass().getSimpleName().equals("CodeSegment");
+                if (!checkSuperClass) {
+                    // argument wrong
+                    return;
+                } else {
+
+                    // create Meta Code Segment
+                    cs = cp.makeClass("Meta"+clazz.getSimpleName());
+                    parent.getClassFile().setAccessFlags(AccessFlag.ABSTRACT);
+                    parent.setName("Abstract"+parent.getSimpleName());
+                    cs.setSuperclass(parent);
+
+                    // define meta inputDataSegment
+                    CtClass receiver = cp.get("alice.datasegment.Receiver");
+
+                    // need check exist name
+                    String metaFieldName = "metaInfo";
+
+                    CtField cf = new CtField(receiver ,metaFieldName, parent);
+                    parent.addField(cf, "ids.create(alice.datasegment.CommandType.PEEK)");
+
+                    cf.getFieldInfo().setAccessFlags(AccessFlag.PUBLIC);
+                    for (CtField f : parent.getFields()){
+                        int accessType = f.getFieldInfo().getAccessFlags();
+                        if (accessType != AccessFlag.PUBLIC){
+                            f.getFieldInfo().setAccessFlags(AccessFlag.PUBLIC);
+                        }
+                    }
+
+                    CtMethod runMethod = parent.getMethod("run", "()V");
+                    CtMethod copy = CtNewMethod.copy(runMethod, cs, null);
+                    runMethod.setName("metaRun");
+                    System.out.println(copy.getName());
+                    cs.addMethod(copy);
+
+                    String cnst = "public "+metaName+"(){"
+                            + metaFieldName+".setKey(\"TEST\");"
+                            + "}";
+
+                    cs.addConstructor(CtNewConstructor.make(cnst, cs));
+
+                    parent.toClass();
+                    Class<?> metaClass = cs.toClass();
+                    metaClass.newInstance();
+                }
+            } catch (NotFoundException e1) {
+                System.out.println("not found super Class");
+                return;
+            } catch (CannotCompileException e1) {
+                e1.printStackTrace();
+            } catch (InstantiationException e1) {
+                e1.printStackTrace();
+            } catch (IllegalAccessException e1) {
+                e1.printStackTrace();
+            }
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/reflection/DisposeManagerTest.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,18 @@
+package alice.test.reflection;
+
+import alice.daemon.AliceDaemon;
+import alice.daemon.Config;
+
+public class DisposeManagerTest {
+    public static void main(String[] args) throws Exception{
+        new AliceDaemon(new Config(args)).listen(); // logger off
+        CSTemplate cs = new CSTemplate();
+        cs.ods.put("key1", "String data");
+        cs.ods.put("TEST", "TEST");
+        CloseEventManager.getInstance().setCodeSegment("local", MetaCodeSegment.class);
+        CloseEventManager.getInstance().setCodeSegment("local", MetaCodeSegment.class);
+
+        //DisposeManager.getInstance().setCodeSegment("local", MetaCodeSegment.class);
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/reflection/MetaCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,36 @@
+package alice.test.reflection;
+
+import org.msgpack.type.Value;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class MetaCodeSegment extends CodeSegment {
+
+    // create input datasegment arg1
+    Receiver arg1 = ids.create(CommandType.TAKE);
+
+    public MetaCodeSegment(){
+        arg1.setKey("key1", arg1.index);
+    }
+
+    @Override
+    public void run() {
+        System.out.println("type = " + arg1.type);
+        System.out.println("index = " + arg1.index);
+        System.out.println("data = " + arg1.getVal());
+        System.out.println(((Value)arg1.getVal()).getType());
+        System.out.println(MetaCodeSegment.class);
+
+        if (arg1.index == 10) {
+            System.exit(0);
+            return;
+        }
+
+        // DataSegment.get("local").update
+        ods.update("local", "key1", "String data");
+        //this.recycle();
+    }
+
+}
\ No newline at end of file
--- a/src/main/java/alice/test/reflection/ReflectionTest.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/reflection/ReflectionTest.java	Thu Nov 30 19:42:31 2017 +0900
@@ -8,44 +8,44 @@
 
 public class ReflectionTest {
 
-	public static void main(String[] args){
-		try {
-			new ReflectionTest().createCS();
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		System.out.println("TEST END");
-	}
+    public static void main(String[] args){
+        try {
+            new ReflectionTest().createCS();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        System.out.println("TEST END");
+    }
 
-	public void createCS() throws Exception{
-		
-		ClassPool cp = ClassPool.getDefault();
-		CtClass tep = cp.get("alice.test.reflection.CSTemplate");
-		CtClass rec = cp.get("alice.datasegment.Receiver");
+    public void createCS() throws Exception{
+
+        ClassPool cp = ClassPool.getDefault();
+        CtClass tep = cp.get("alice.test.reflection.CSTemplate");
+        CtClass rec = cp.get("alice.datasegment.Receiver");
 
-		// ---- define Field -----
-		//CtField f1 = CtField.make("alice.datasegment.Receiver arg1 = ids.create(alice.datasegment.CommandType.PEEK);", tep);
-		//tep.addField(f1);
-		CtField f1 = new CtField(rec,"arg1",tep);
-		tep.addField(f1,"ids.create(alice.datasegment.CommandType.PEEK)");
+        // ---- define Field -----
+        //CtField f1 = CtField.make("alice.datasegment.Receiver arg1 = ids.create(alice.datasegment.CommandType.PEEK);", tep);
+        //tep.addField(f1);
+        CtField f1 = new CtField(rec,"arg1",tep);
+        tep.addField(f1,"ids.create(alice.datasegment.CommandType.PEEK)");
 
-		// ---- define Constructor -----
-		CtConstructor c = tep.getConstructor("()V");
-		c.insertAfter("arg1.setKey(\"key1\");");
+        // ---- define Constructor -----
+        CtConstructor c = tep.getConstructor("()V");
+        c.insertAfter("arg1.setKey(\"key1\");");
 
-		// ---- define run -----
-		CtMethod m = tep.getMethod("run", "()V");
-		m.insertAfter("System.out.println(\"type = \" + arg1.type);");
-		m.insertAfter("System.out.println(\"index = \" + arg1.index);");
-		m.insertAfter("System.out.println(\"data = \" + arg1.getVal());");
-		m.insertAfter("System.out.println(((org.msgpack.type.Value)arg1.getVal()).getType());");
-		m.insertAfter("if (arg1.index==10){ System.exit(0);}");
-		m.insertAfter("new alice.test.reflection.CSTemplate();");
-		m.insertAfter("ods.update(\"key1\", \"String Data\");");
+        // ---- define run -----
+        CtMethod m = tep.getMethod("run", "()V");
+        m.insertAfter("System.out.println(\"type = \" + arg1.type);");
+        m.insertAfter("System.out.println(\"index = \" + arg1.index);");
+        m.insertAfter("System.out.println(\"data = \" + arg1.getVal());");
+        m.insertAfter("System.out.println(((org.msgpack.type.Value)arg1.getVal()).getType());");
+        m.insertAfter("if (arg1.index==10){ System.exit(0);}");
+        m.insertAfter("new alice.test.reflection.CSTemplate();");
+        m.insertAfter("ods.update(\"key1\", \"String Data\");");
 
-		Class<?> clazz = tep.toClass(); // load Class 
-		@SuppressWarnings("unused")
-		CSTemplate cs = (CSTemplate)clazz.newInstance(); // create instance
-		
-	}
+        Class<?> clazz = tep.toClass(); // load Class
+        @SuppressWarnings("unused")
+        CSTemplate cs = (CSTemplate)clazz.newInstance(); // create instance
+
+    }
 }
--- a/src/main/java/alice/test/topology/aquarium/AutoIncrement.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/AutoIncrement.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,43 +5,43 @@
 import alice.datasegment.Receiver;
 
 public class AutoIncrement extends CodeSegment {
-	
-	private Receiver position = ids.create(CommandType.PEEK);
-	private Receiver number = ids.create(CommandType.PEEK);
-	private static final float MIN = -1.3f;
-	
-	public AutoIncrement(String key, int index) {
-		this.number.setKey("maxsize");
-		this.position.setKey(key, index);
-	}
+
+    private Receiver position = ids.create(CommandType.PEEK);
+    private Receiver number = ids.create(CommandType.PEEK);
+    private static final float MIN = -1.3f;
+
+    public AutoIncrement(String key, int index) {
+        this.number.setKey("maxsize");
+        this.position.setKey(key, index);
+    }
 
-	@Override
-	public void run() {
-		float max = this.number.asInteger() * 2 - 1 + 0.3f;
-		FishPoint fp = this.position.asClass(FishPoint.class);
-		if (fp.getX() + 0.01 > max) {
-			fp.setXYZ(MIN, fp.getY(), fp.getZ());
-		} else if (fp.getX() + 0.01 < MIN) {
-			fp.setXYZ(max, fp.getY(), fp.getZ());
-		}
-		else {
-			fp.setXYZ(fp.getX() + 0.01f, fp.getY(), fp.getZ());
-		}
-		
-		ods.update(position.key, fp);
-		synchronized (this) {
-			try {
-				// TODO
-				// Waiting should be done in Alice kernel
-				// ids.create(CommandType.WAIT);
-			 
-				wait(20);
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-		}
-		
-		new AutoIncrement(this.position.key, this.position.index);
-	}
-	
+    @Override
+    public void run() {
+        float max = this.number.asInteger() * 2 - 1 + 0.3f;
+        FishPoint fp = this.position.asClass(FishPoint.class);
+        if (fp.getX() + 0.01 > max) {
+            fp.setXYZ(MIN, fp.getY(), fp.getZ());
+        } else if (fp.getX() + 0.01 < MIN) {
+            fp.setXYZ(max, fp.getY(), fp.getZ());
+        }
+        else {
+            fp.setXYZ(fp.getX() + 0.01f, fp.getY(), fp.getZ());
+        }
+
+        ods.update(position.key, fp);
+        synchronized (this) {
+            try {
+                // TODO
+                // Waiting should be done in Alice kernel
+                // ids.create(CommandType.WAIT);
+
+                wait(20);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+
+        new AutoIncrement(this.position.key, this.position.index);
+    }
+
 }
--- a/src/main/java/alice/test/topology/aquarium/CheckLocalIndex.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/CheckLocalIndex.java	Thu Nov 30 19:42:31 2017 +0900
@@ -8,26 +8,26 @@
 
 public class CheckLocalIndex extends CodeSegment {
 
-	private Receiver data = ids.create(CommandType.PEEK);
-	private Receiver list = ids.create(CommandType.PEEK);
-	
-	public CheckLocalIndex(String key, int index){
-		this.list.setKey("_CLIST");
-		this.data.setKey(key, index);
-	}
-	
-	@Override
-	public void run() {
-		@SuppressWarnings("unchecked")
-		List<String> r = list.asClass(List.class);
-		for (String node : r) {
-			if (!node.equals(data.from)) {
-				System.out.println(data.from);
-				ods.update(node, data.key, data.getVal());
-			}
-		}
-		new CheckLocalIndex(data.key, data.index);
-		
-	}
+    private Receiver data = ids.create(CommandType.PEEK);
+    private Receiver list = ids.create(CommandType.PEEK);
+
+    public CheckLocalIndex(String key, int index){
+        this.list.setKey("_CLIST");
+        this.data.setKey(key, index);
+    }
+
+    @Override
+    public void run() {
+        @SuppressWarnings("unchecked")
+        List<String> r = list.asClass(List.class);
+        for (String node : r) {
+            if (!node.equals(data.from)) {
+                System.out.println(data.from);
+                ods.update(node, data.key, data.getVal());
+            }
+        }
+        new CheckLocalIndex(data.key, data.index);
+
+    }
 
 }
--- a/src/main/java/alice/test/topology/aquarium/CheckMyName.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/CheckMyName.java	Thu Nov 30 19:42:31 2017 +0900
@@ -10,88 +10,88 @@
 
 
 public class CheckMyName extends CodeSegment {
- 	private Receiver host = ids.create(CommandType.PEEK);
-	private Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
-	private String key = "fish";
-	
-	public CheckMyName(){
-		host.setKey("host");
-	}
-	
-	@Override
-	public void run(){
-		String name = host.asString();
-		Matcher matcher = pattern.matcher(name);
-		
-		matcher.find();
-		String type = matcher.group(1);
-		int num = new Integer(matcher.group(2));
-		ods.put("host_num", num*2);
-		MakeFrame frame =  new MakeFrame(name,num*2);
-		ods.put("num", 1);
-		
-		if (type.equals("cli")){
-			System.out.println("cli"+num);
-			new TakeMynum();	
-		}else if (type.equals("node")){
-			System.out.println("node"+num);
-			if (num != 0){
-				new TakeMynum();
-			} else {
-				new SendMaxsize(0);
-			}
-		}
-		new CheckLocalIndex("maxsize",0);
-		
-		ods.update(key, new FishPoint(-0.1f,-0.1f));
-		new SetLocation(new MakeObject(frame), key, 0);
-		new CheckLocalIndex(key,1);
-		for (int i = 0; i < 3 ; i++){
-			key = "fish"+i;
-			if (num == 0) new AutoIncrement(key,0);
-			ods.update(key, new FishPoint((float)Math.random(),
-					(float)Math.random(), (float)Math.random()));
-			new SetLocation(new MakeObject(frame), key, 0);
-			new CheckLocalIndex(key,1);
-		}
-		
-		for (int i = 3; i < 6 ; i++){
-			key = "fish"+i;
-			if (num == 1) new AutoIncrement(key,0);
-			Random rnd = new Random();
-			int tmp = rnd.nextInt(3);
-			int rand = tmp + 1;
-			ods.update(key, new FishPoint( (float)rand, 
-					-(float)Math.random(), -(float)Math.random()));
-			new SetLocation(new MakeObject(frame), key, 0);
-			new CheckLocalIndex(key,1);
-		}
-		
-		for (int i = 6; i < 9 ; i++){
-			key = "fish"+i;
-			if (num == 2) new AutoIncrement(key,0);
-			Random rnd = new Random();
-			int tmp = rnd.nextInt(3); 
-			int rand = tmp + 3;
-			ods.update(key, new FishPoint( (float)rand, 
-					(float)Math.random(), -(float)Math.random()));
-			new SetLocation(new MakeObject(frame), key, 0);
-			new CheckLocalIndex(key,1);
-		}
-		
-		for (int i = 9; i < 12 ; i++){
-			key = "fish"+i;
-			if (num == 3) new AutoIncrement(key,0);
-			
-			Random rnd = new Random();
-			int tmp = rnd.nextInt(3); 
-			int rand = tmp + 5;
-			
-			ods.update(key, new FishPoint( (float)rand, 
-					-(float)Math.random(), (float)Math.random()));
-			new SetLocation(new MakeObject(frame), key, 0);
-			new CheckLocalIndex(key,1);
-		}
-		
-	}
+    private Receiver host = ids.create(CommandType.PEEK);
+    private Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
+    private String key = "fish";
+
+    public CheckMyName(){
+        host.setKey("host");
+    }
+
+    @Override
+    public void run(){
+        String name = host.asString();
+        Matcher matcher = pattern.matcher(name);
+
+        matcher.find();
+        String type = matcher.group(1);
+        int num = new Integer(matcher.group(2));
+        ods.put("host_num", num*2);
+        MakeFrame frame =  new MakeFrame(name,num*2);
+        ods.put("num", 1);
+
+        if (type.equals("cli")){
+            System.out.println("cli"+num);
+            new TakeMynum();
+        }else if (type.equals("node")){
+            System.out.println("node"+num);
+            if (num != 0){
+                new TakeMynum();
+            } else {
+                new SendMaxsize(0);
+            }
+        }
+        new CheckLocalIndex("maxsize",0);
+
+        ods.update(key, new FishPoint(-0.1f,-0.1f));
+        new SetLocation(new MakeObject(frame), key, 0);
+        new CheckLocalIndex(key,1);
+        for (int i = 0; i < 3 ; i++){
+            key = "fish"+i;
+            if (num == 0) new AutoIncrement(key,0);
+            ods.update(key, new FishPoint((float)Math.random(),
+                    (float)Math.random(), (float)Math.random()));
+            new SetLocation(new MakeObject(frame), key, 0);
+            new CheckLocalIndex(key,1);
+        }
+
+        for (int i = 3; i < 6 ; i++){
+            key = "fish"+i;
+            if (num == 1) new AutoIncrement(key,0);
+            Random rnd = new Random();
+            int tmp = rnd.nextInt(3);
+            int rand = tmp + 1;
+            ods.update(key, new FishPoint( (float)rand,
+                    -(float)Math.random(), -(float)Math.random()));
+            new SetLocation(new MakeObject(frame), key, 0);
+            new CheckLocalIndex(key,1);
+        }
+
+        for (int i = 6; i < 9 ; i++){
+            key = "fish"+i;
+            if (num == 2) new AutoIncrement(key,0);
+            Random rnd = new Random();
+            int tmp = rnd.nextInt(3);
+            int rand = tmp + 3;
+            ods.update(key, new FishPoint( (float)rand,
+                    (float)Math.random(), -(float)Math.random()));
+            new SetLocation(new MakeObject(frame), key, 0);
+            new CheckLocalIndex(key,1);
+        }
+
+        for (int i = 9; i < 12 ; i++){
+            key = "fish"+i;
+            if (num == 3) new AutoIncrement(key,0);
+
+            Random rnd = new Random();
+            int tmp = rnd.nextInt(3);
+            int rand = tmp + 5;
+
+            ods.update(key, new FishPoint( (float)rand,
+                    -(float)Math.random(), (float)Math.random()));
+            new SetLocation(new MakeObject(frame), key, 0);
+            new CheckLocalIndex(key,1);
+        }
+
+    }
 }
--- a/src/main/java/alice/test/topology/aquarium/FishMovementConfig.java	Wed Apr 19 19:19:27 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-package alice.test.topology.aquarium;
-
-import alice.topology.node.TopologyNodeConfig;
-
-public class FishMovementConfig extends TopologyNodeConfig {
-	
-	public FishMovementConfig(String[] args){
-		super(args);
-	} 
-	
-
-}
--- a/src/main/java/alice/test/topology/aquarium/FishMovementTopology.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/FishMovementTopology.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,11 +1,12 @@
 package alice.test.topology.aquarium;
 import alice.topology.node.TopologyNode;
+import alice.topology.node.TopologyNodeConfig;
 
 public class FishMovementTopology {
-	public static void main(String[] args){
-		FishMovementConfig conf = new FishMovementConfig(args);
-		new TopologyNode(conf, new StartFishMovement());
-		
-	}
+    public static void main(String[] args){
+        TopologyNodeConfig conf = new TopologyNodeConfig(args);
+        new TopologyNode(conf, new StartFishMovement());
+
+    }
 
 }
--- a/src/main/java/alice/test/topology/aquarium/FishPoint.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/FishPoint.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,45 +4,45 @@
 
 @Message
 public class FishPoint {
-	// public fields are serialized.
-	public float x = 0.0f;
-	public float y = 0.0f;
-	public float z = 0.0f;
-	
-	public FishPoint(){}
-	
-	public FishPoint(float x,float y){
-		this.x = x;
-		this.y = y;
-	}
-	
-	public FishPoint(float x,float y,float z){
-		this.x = x;
-		this.y = y;
-		this.z = z;
-	}
-	
-	public void setXY(float x,float y){
-		this.x = x;
-		this.y = y;
-	}
-	
-	public void setXYZ(float x,float y,float z){
-		this.x = x;
-		this.y = y;
-		this.z = z;
-	}
-	
-	public float getX(){
-		return this.x;
-	}
-	
-	public float getY(){
-		return this.y;
-	}
-	
-	public float getZ(){
-		return this.z;
-	}
-	
+    // public fields are serialized.
+    public float x = 0.0f;
+    public float y = 0.0f;
+    public float z = 0.0f;
+
+    public FishPoint(){}
+
+    public FishPoint(float x,float y){
+        this.x = x;
+        this.y = y;
+    }
+
+    public FishPoint(float x,float y,float z){
+        this.x = x;
+        this.y = y;
+        this.z = z;
+    }
+
+    public void setXY(float x,float y){
+        this.x = x;
+        this.y = y;
+    }
+
+    public void setXYZ(float x,float y,float z){
+        this.x = x;
+        this.y = y;
+        this.z = z;
+    }
+
+    public float getX(){
+        return this.x;
+    }
+
+    public float getY(){
+        return this.y;
+    }
+
+    public float getZ(){
+        return this.z;
+    }
+
 }
--- a/src/main/java/alice/test/topology/aquarium/KeyInputCodeSegment.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/KeyInputCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,52 +4,52 @@
 import java.awt.event.KeyListener;
 
 public class KeyInputCodeSegment implements KeyListener{
-		
-	MakeFrame frame;
-	public KeyInputCodeSegment(MakeFrame frame) {
-		this.frame = frame;
-	}
+
+    MakeFrame frame;
+    public KeyInputCodeSegment(MakeFrame frame) {
+        this.frame = frame;
+    }
 
-	@Override
-	public void keyPressed(KeyEvent event) {
-		//System.out.println(event.getKeyCode());
-		switch(event.getKeyCode())
-		{
-		case 37: // left
-			new SendLocation(-0.1f,0.0f,0.0f); 
-			break;
-		case 38: // up
-			new SendLocation(0.0f,0.1f,0.0f);
-			break;
-		case 39: // right
-			new SendLocation(0.1f,0.0f,0.0f);
-			break;
-		case 40: // down
-			new SendLocation(0.0f,-0.1f,0.0f);
-			break;
-		case 76: // l
-			new SendLocation(0.0f,0.0f,0.1f);
-			break;
-		case 78: // "n"
-			new RefreshWindow(frame);
-			break;
-		case 79: // "o"
-			new SendLocation(0.0f,0.0f,-0.1f);
-			break;
-		case 82: // "r"
-			new ResetFish().execute();
-			break;
-		}
-	}
+    @Override
+    public void keyPressed(KeyEvent event) {
+        //System.out.println(event.getKeyCode());
+        switch(event.getKeyCode())
+        {
+        case 37: // left
+            new SendLocation(-0.1f,0.0f,0.0f);
+            break;
+        case 38: // up
+            new SendLocation(0.0f,0.1f,0.0f);
+            break;
+        case 39: // right
+            new SendLocation(0.1f,0.0f,0.0f);
+            break;
+        case 40: // down
+            new SendLocation(0.0f,-0.1f,0.0f);
+            break;
+        case 76: // l
+            new SendLocation(0.0f,0.0f,0.1f);
+            break;
+        case 78: // "n"
+            new RefreshWindow(frame);
+            break;
+        case 79: // "o"
+            new SendLocation(0.0f,0.0f,-0.1f);
+            break;
+        case 82: // "r"
+            new ResetFish().execute();
+            break;
+        }
+    }
 
-	@Override
-	public void keyReleased(KeyEvent event) {
-		
-	}
+    @Override
+    public void keyReleased(KeyEvent event) {
+
+    }
 
-	@Override
-	public void keyTyped(KeyEvent event) {
-		
-	}
+    @Override
+    public void keyTyped(KeyEvent event) {
+
+    }
 
 }
--- a/src/main/java/alice/test/topology/aquarium/MakeFrame.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/MakeFrame.java	Thu Nov 30 19:42:31 2017 +0900
@@ -22,93 +22,93 @@
 import com.sun.j3d.utils.universe.SimpleUniverse;
 
 public class MakeFrame {
-	
-	private static final int F_SIZE_X = 800;
-	private static final int F_SIZE_Y = 800;
-	private ViewChange canvas;
-	private JFrame frame;
-	private ObjectList list = new ObjectList();
-	
-	public MakeFrame(String str,float x) {
-	    System.loadLibrary("jawt"); 
-		frame = new JFrame(str);
-		frame.setSize(F_SIZE_X, F_SIZE_Y);
-		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-		
-		JPanel cp = new JPanel();
-		cp.setLayout(null);
-		frame.add(cp);
-		
-		GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
-		canvas = new ViewChange(x,0.01f,config);
-		canvas.setBounds(0,0, F_SIZE_X, F_SIZE_Y);
-		cp.add(canvas);
-		
-		canvas.universe.addBranchGraph(createLight());
-		canvas.universe.addBranchGraph(setBackground());
-		
-		canvas.addKeyListener(new KeyInputCodeSegment(this));
-		frame.setVisible(true);
-		
-	}
-	
-	private BranchGroup setBackground() {
-		BranchGroup scene = new BranchGroup();
-		BufferedImage img = null;
-		try {
-			URL url = getClass().getClassLoader().getResource("image/image1.jpg");
-			if (url!=null) {
-			    img = ImageIO.read(url);
-			} else {
-			    img = ImageIO.read(new File("image/image1.jpg"));
-			}
-		} catch (IOException e) {
-		  	e.printStackTrace();
-		}
-		ImageComponent2D image = 
-				new ImageComponent2D(ImageComponent2D.FORMAT_RGBA8,img);
-		Background background = new Background(image);
-		background.setImageScaleMode(Background.SCALE_FIT_ALL);
-		BoundingSphere bounds = new BoundingSphere(new Point3d(), 10.0);
-		background.setApplicationBounds(bounds);
-		scene.addChild(background);
-		return scene;
-		
-	}
-	
-	private BranchGroup createLight() {
-		BranchGroup scene = new BranchGroup();
-		Color3f light_color  = new Color3f(1.7f,1.7f,1.7f);
-		Vector3f light_direction = new Vector3f(0.0f,0.0f,-1.0f);
-		DirectionalLight light = new DirectionalLight(light_color,light_direction);
-		BoundingSphere bounds = new BoundingSphere(new Point3d(), 10.0);
-		light.setInfluencingBounds(bounds);
-		scene.addChild(light);
-		return scene;
-	}
-	
-	public void register(MakeObject obj){
-		list.table.add(obj);
-		BranchGroup group = obj.createBranch();
-		this.canvas.universe.addBranchGraph(group);
-	}
-	
-	public ViewChange getCanvas(){
-		return this.canvas;
-	}
-	
-	public JFrame getJFrame(){
-		return this.frame;
-	}
-	
-	public ObjectList getList(){
-		return this.list;
-	}
-	
-	static public void main(String [] args) {
-	    MakeFrame test = new MakeFrame("Test", 0);
-	    test.setBackground();
-	    test.createLight();
-	}
-	
+
+    private static final int F_SIZE_X = 800;
+    private static final int F_SIZE_Y = 800;
+    private ViewChange canvas;
+    private JFrame frame;
+    private ObjectList list = new ObjectList();
+
+    public MakeFrame(String str,float x) {
+        System.loadLibrary("jawt");
+        frame = new JFrame(str);
+        frame.setSize(F_SIZE_X, F_SIZE_Y);
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        JPanel cp = new JPanel();
+        cp.setLayout(null);
+        frame.add(cp);
+
+        GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
+        canvas = new ViewChange(x,0.01f,config);
+        canvas.setBounds(0,0, F_SIZE_X, F_SIZE_Y);
+        cp.add(canvas);
+
+        canvas.universe.addBranchGraph(createLight());
+        canvas.universe.addBranchGraph(setBackground());
+
+        canvas.addKeyListener(new KeyInputCodeSegment(this));
+        frame.setVisible(true);
+
+    }
+
+    private BranchGroup setBackground() {
+        BranchGroup scene = new BranchGroup();
+        BufferedImage img = null;
+        try {
+            URL url = getClass().getClassLoader().getResource("images/image1.jpg");
+            if (url!=null) {
+                img = ImageIO.read(url);
+            } else {
+                img = ImageIO.read(new File("images/image1.jpg"));
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        ImageComponent2D image =
+                new ImageComponent2D(ImageComponent2D.FORMAT_RGBA8,img);
+        Background background = new Background(image);
+        background.setImageScaleMode(Background.SCALE_FIT_ALL);
+        BoundingSphere bounds = new BoundingSphere(new Point3d(), 10.0);
+        background.setApplicationBounds(bounds);
+        scene.addChild(background);
+        return scene;
+
+    }
+
+    private BranchGroup createLight() {
+        BranchGroup scene = new BranchGroup();
+        Color3f light_color  = new Color3f(1.7f,1.7f,1.7f);
+        Vector3f light_direction = new Vector3f(0.0f,0.0f,-1.0f);
+        DirectionalLight light = new DirectionalLight(light_color,light_direction);
+        BoundingSphere bounds = new BoundingSphere(new Point3d(), 10.0);
+        light.setInfluencingBounds(bounds);
+        scene.addChild(light);
+        return scene;
+    }
+
+    public void register(MakeObject obj){
+        list.table.add(obj);
+        BranchGroup group = obj.createBranch();
+        this.canvas.universe.addBranchGraph(group);
+    }
+
+    public ViewChange getCanvas(){
+        return this.canvas;
+    }
+
+    public JFrame getJFrame(){
+        return this.frame;
+    }
+
+    public ObjectList getList(){
+        return this.list;
+    }
+
+    static public void main(String [] args) {
+        MakeFrame test = new MakeFrame("Test", 0);
+        test.setBackground();
+        test.createLight();
+    }
+
 }
--- a/src/main/java/alice/test/topology/aquarium/MakeObject.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/MakeObject.java	Thu Nov 30 19:42:31 2017 +0900
@@ -21,95 +21,95 @@
 import com.sun.j3d.utils.image.TextureLoader;
 
 public class MakeObject {
-	
-	private Transform3D transform;  
-	private TransformGroup transform_group;
-	private ViewChange canvas;
-	private Matrix4d matrix;
-	private double s;
+
+    private Transform3D transform;
+    private TransformGroup transform_group;
+    private ViewChange canvas;
+    private Matrix4d matrix;
+    private double s;
+
 
-	
-	public MakeObject(MakeFrame frame){
-		this.canvas = frame.getCanvas();
-		this.s = 0.3;
-		frame.register(this);
-	}
-	
-	public BranchGroup createBranch(){
-		BranchGroup scene = new BranchGroup();
-		/*Box box = new Box(0.1f,0.1f,0.0f,
+    public MakeObject(MakeFrame frame){
+        this.canvas = frame.getCanvas();
+        this.s = 0.3;
+        frame.register(this);
+    }
+
+    public BranchGroup createBranch(){
+        BranchGroup scene = new BranchGroup();
+        /*Box box = new Box(0.1f,0.1f,0.0f,
 				Box.GENERATE_NORMALS|Box.GENERATE_TEXTURE_COORDS,createAppearance());*/
-		ObjectFile obj = new ObjectFile(ObjectFile.RESIZE);
-		Scene img = null;
-		try{
-			URL url=getClass().getClassLoader().getResource("TUNA");
-			img = obj.load(url);
-		} catch(FileNotFoundException e){
-			System.err.println(e);
-			System.exit(1);
-		} catch(ParsingErrorException e){
-			System.err.println(e);
-			System.exit(1);
-		} catch(IncorrectFormatException e){
-			System.err.println(e);
-			System.exit(1);
-		}
-		
-		transform_group = new TransformGroup();
-		setLocation(-2.0f,-2.0f); //set out of window
-		transform_group.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
-		transform_group.addChild(img.getSceneGroup());
-		scene.addChild(transform_group);
-		return scene;		
-	}
-	
-	// no use method
-	public Appearance createAppearance(){
-		Appearance app = new Appearance();
-		Image image = null; 	
-		Toolkit toolkit = Toolkit.getDefaultToolkit();
-		URL url = getClass().getClassLoader().getResource("fish.jpg");
-		image = toolkit.getImage(url);
-		MediaTracker mt = new MediaTracker(canvas);
-		mt.addImage(image, 0);
-		mt.checkAll(true);
-		try {
-			mt.waitForID(0);
-			
-		}catch (InterruptedException e){
-			e.printStackTrace();
-			
-		}
-		Texture texture = new TextureLoader(image,canvas).getTexture();
-		app.setTexture(texture);
-		return app;
-		
-	}
-	
-	public void setScale(float size){
-		s = size;
-	}
-	
-	public void setLocation(float x,float y){
-		transform = new Transform3D();
-		matrix = new Matrix4d(s,0,0,x,
-							  0,s,0,y,
-							  0,0,s,0,
-							  0,0,0,1);
-		transform.set(matrix);
-		transform_group.setTransform(transform);
-	}
-	
-	public void setLocation(float x,float y,float z){
-		transform = new Transform3D();
-		matrix = new Matrix4d(s,0,0,x,
-				  			  0,s,0,y,
-				  			  0,0,s,z,
-				  			  0,0,0,1);
-		transform.set(matrix);
-		transform_group.setTransform(transform);
-	}
-	
-	
+        ObjectFile obj = new ObjectFile(ObjectFile.RESIZE);
+        Scene img = null;
+        try{
+            URL url=getClass().getClassLoader().getResource("objects/TUNA.obj");
+            img = obj.load(url);
+        } catch(FileNotFoundException e){
+            System.err.println(e);
+            System.exit(1);
+        } catch(ParsingErrorException e){
+            System.err.println(e);
+            System.exit(1);
+        } catch(IncorrectFormatException e){
+            System.err.println(e);
+            System.exit(1);
+        }
+
+        transform_group = new TransformGroup();
+        setLocation(-2.0f,-2.0f); //set out of window
+        transform_group.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
+        transform_group.addChild(img.getSceneGroup());
+        scene.addChild(transform_group);
+        return scene;
+    }
+
+    // no use method
+    public Appearance createAppearance(){
+        Appearance app = new Appearance();
+        Image image = null;
+        Toolkit toolkit = Toolkit.getDefaultToolkit();
+        URL url = getClass().getClassLoader().getResource("fish.jpg");
+        image = toolkit.getImage(url);
+        MediaTracker mt = new MediaTracker(canvas);
+        mt.addImage(image, 0);
+        mt.checkAll(true);
+        try {
+            mt.waitForID(0);
+
+        }catch (InterruptedException e){
+            e.printStackTrace();
+
+        }
+        Texture texture = new TextureLoader(image,canvas).getTexture();
+        app.setTexture(texture);
+        return app;
+
+    }
+
+    public void setScale(float size){
+        s = size;
+    }
+
+    public void setLocation(float x,float y){
+        transform = new Transform3D();
+        matrix = new Matrix4d(s,0,0,x,
+                0,s,0,y,
+                0,0,s,0,
+                0,0,0,1);
+        transform.set(matrix);
+        transform_group.setTransform(transform);
+    }
+
+    public void setLocation(float x,float y,float z){
+        transform = new Transform3D();
+        matrix = new Matrix4d(s,0,0,x,
+                0,s,0,y,
+                0,0,s,z,
+                0,0,0,1);
+        transform.set(matrix);
+        transform_group.setTransform(transform);
+    }
+
+
 }
 
--- a/src/main/java/alice/test/topology/aquarium/MouseViewEvent.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/MouseViewEvent.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,49 +4,49 @@
 import java.awt.event.MouseMotionListener;
 
 public class MouseViewEvent implements MouseMotionListener {
-	
-	int new_x, new_y;
-	int pre_x, pre_y;
-	ViewChange v;
-	
-	public MouseViewEvent(ViewChange v) {
-		this.v = v;
-		
-	}
+
+    int new_x, new_y;
+    int pre_x, pre_y;
+    ViewChange v;
+
+    public MouseViewEvent(ViewChange v) {
+        this.v = v;
+
+    }
+
+    @Override
+    public void mouseDragged(MouseEvent event) {
+        new_x = event.getX();
+        new_y = event.getY();
+
+        v.theta -= v.sensitivity * (new_y - pre_y);
+        v.phi += v.sensitivity * (new_x - pre_x);
+        v.camera_y = v.distance * (float)Math.sin(v.theta);
+        v.camera_xz = v.distance * (float)Math.cos(v.theta);
 
-	@Override
-	public void mouseDragged(MouseEvent event) {
-		new_x = event.getX();
-		new_y = event.getY();
-		
-		v.theta -= v.sensitivity * (new_y - pre_y);
-		v.phi += v.sensitivity * (new_x - pre_x);
-		v.camera_y = v.distance * (float)Math.sin(v.theta);
-		v.camera_xz = v.distance * (float)Math.cos(v.theta);
-	
-		v.camera_x =  v.camera_xz * (float)Math.sin(v.phi);
-		v.camera_z =  v.camera_xz * (float)Math.cos(v.phi);	
-		v.Vector_camera_pos.x = v.camera_x;
-		v.Vector_camera_pos.y = v.camera_y;
-		v.Vector_camera_pos.z = v.camera_z;
-		
-		v.Transform_camera_pos.setIdentity();
-		v.Transform_camera_pos.setTranslation(v.Vector_camera_pos);
-		
-		v.Transform_camera_theta.rotX(-v.theta);
-		v.Transform_camera_phi.rotY(v.phi);
-		v.Transform_camera_phi.mul(v.Transform_camera_theta);
-		v.Transform_camera_pos.mul(v.Transform_camera_phi);
-		v.Camera.setTransform(v.Transform_camera_pos);
-		pre_x = event.getX();
-		pre_y = event.getY();
-		
-	}	
-	
-	@Override
-	public void mouseMoved(MouseEvent event) {
-		pre_x = event.getX();
-		pre_y = event.getY();	
-	}
+        v.camera_x =  v.camera_xz * (float)Math.sin(v.phi);
+        v.camera_z =  v.camera_xz * (float)Math.cos(v.phi);
+        v.Vector_camera_pos.x = v.camera_x;
+        v.Vector_camera_pos.y = v.camera_y;
+        v.Vector_camera_pos.z = v.camera_z;
+
+        v.Transform_camera_pos.setIdentity();
+        v.Transform_camera_pos.setTranslation(v.Vector_camera_pos);
+
+        v.Transform_camera_theta.rotX(-v.theta);
+        v.Transform_camera_phi.rotY(v.phi);
+        v.Transform_camera_phi.mul(v.Transform_camera_theta);
+        v.Transform_camera_pos.mul(v.Transform_camera_phi);
+        v.Camera.setTransform(v.Transform_camera_pos);
+        pre_x = event.getX();
+        pre_y = event.getY();
+
+    }
+
+    @Override
+    public void mouseMoved(MouseEvent event) {
+        pre_x = event.getX();
+        pre_y = event.getY();
+    }
 
 }
--- a/src/main/java/alice/test/topology/aquarium/ObjectList.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/ObjectList.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,5 +4,5 @@
 import java.util.List;
 
 public class ObjectList {
-	public List<MakeObject> table = new ArrayList<MakeObject>();
+    public List<MakeObject> table = new ArrayList<MakeObject>();
 }
--- a/src/main/java/alice/test/topology/aquarium/RefreshWindow.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/RefreshWindow.java	Thu Nov 30 19:42:31 2017 +0900
@@ -4,25 +4,25 @@
 import alice.datasegment.Receiver;
 
 public class RefreshWindow extends CodeSegment {
-	private Receiver num = ids.create(CommandType.PEEK);
-	private Receiver host = ids.create(CommandType.PEEK);
-	private MakeFrame frame;
-	
-	public RefreshWindow(MakeFrame frame){
-		this.host.setKey("host");
-		this.num.setKey("host_num");
-		this.frame = frame;
-	}
-	
-	@Override
-	public void run() {
-		frame.getJFrame().dispose();
-		ObjectList list = frame.getList();
-		frame = new MakeFrame(host.asString(),num.asInteger());
-		for (MakeObject obj : list.table) {
-			frame.register(obj);
-		}
-	}
+    private Receiver num = ids.create(CommandType.PEEK);
+    private Receiver host = ids.create(CommandType.PEEK);
+    private MakeFrame frame;
+
+    public RefreshWindow(MakeFrame frame){
+        this.host.setKey("host");
+        this.num.setKey("host_num");
+        this.frame = frame;
+    }
+
+    @Override
+    public void run() {
+        frame.getJFrame().dispose();
+        ObjectList list = frame.getList();
+        frame = new MakeFrame(host.asString(),num.asInteger());
+        for (MakeObject obj : list.table) {
+            frame.register(obj);
+        }
+    }
 
 }
 
--- a/src/main/java/alice/test/topology/aquarium/ResetFish.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/ResetFish.java	Thu Nov 30 19:42:31 2017 +0900
@@ -3,14 +3,14 @@
 import alice.codesegment.CodeSegment;
 
 public class ResetFish extends CodeSegment {
-	
-	public ResetFish(){}
+
+    public ResetFish(){}
 
-	@Override
-	public void run() {
-		FishPoint fp = new FishPoint(0.0f,0.0f,0.0f);
-		ods.update("fish", fp);
-		
-	}
+    @Override
+    public void run() {
+        FishPoint fp = new FishPoint(0.0f,0.0f,0.0f);
+        ods.update("fish", fp);
+
+    }
 
 }
--- a/src/main/java/alice/test/topology/aquarium/SendLocation.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/SendLocation.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,25 +6,25 @@
 
 
 public class SendLocation extends CodeSegment {
-	
-	private Receiver position = ids.create(CommandType.PEEK);
-	float x;
-	float y;
-	float z;
-	
-	public SendLocation(float x,float y,float z){
-		this.x = x;
-		this.y = y;
-		this.z = z;
-		position.setKey("fish");
-	}
-	
-	@Override
-	public void run() {
-		FishPoint fp = this.position.asClass(FishPoint.class);
-		fp.setXYZ(fp.getX()+x, fp.getY()+y, fp.getZ()+z);
-		ods.update("fish", fp);
-		
-	}
+
+    private Receiver position = ids.create(CommandType.PEEK);
+    float x;
+    float y;
+    float z;
+
+    public SendLocation(float x,float y,float z){
+        this.x = x;
+        this.y = y;
+        this.z = z;
+        position.setKey("fish");
+    }
+
+    @Override
+    public void run() {
+        FishPoint fp = this.position.asClass(FishPoint.class);
+        fp.setXYZ(fp.getX()+x, fp.getY()+y, fp.getZ()+z);
+        ods.update("fish", fp);
+
+    }
 
 }
--- a/src/main/java/alice/test/topology/aquarium/SendMaxsize.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/SendMaxsize.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,17 +6,17 @@
 
 public class SendMaxsize extends CodeSegment{
 
-	private Receiver max = ids.create(CommandType.PEEK);
-	
-	public SendMaxsize(int index){
-		this.max.setKey("num", index);
-	}
-	
-	@Override
-	public void run() {
-		int size = max.asInteger();
-		ods.update("maxsize",size);
-		new SendMaxsize(this.max.index);
-	}
+    private Receiver max = ids.create(CommandType.PEEK);
+
+    public SendMaxsize(int index){
+        this.max.setKey("num", index);
+    }
+
+    @Override
+    public void run() {
+        int size = max.asInteger();
+        ods.update("maxsize",size);
+        new SendMaxsize(this.max.index);
+    }
 
 }
--- a/src/main/java/alice/test/topology/aquarium/SetLocation.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/SetLocation.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,22 +6,22 @@
 
 
 public class SetLocation extends CodeSegment{
-	
-	private Receiver position = ids.create(CommandType.PEEK);
-	private MakeObject obj;
-	
-	public SetLocation(MakeObject obj ,String key, int index){
-		this.obj = obj;
-		this.position.setKey(key,index);
-	}
-	
-	@Override
-	public void run(){
-		FishPoint fp = this.position.asClass(FishPoint.class);
-		obj.setLocation(fp.getX(), fp.getY(), fp.getZ());
-		new SetLocation(obj, position.key, position.index);
-					
-	}
-	
+
+    private Receiver position = ids.create(CommandType.PEEK);
+    private MakeObject obj;
+
+    public SetLocation(MakeObject obj ,String key, int index){
+        this.obj = obj;
+        this.position.setKey(key,index);
+    }
+
+    @Override
+    public void run(){
+        FishPoint fp = this.position.asClass(FishPoint.class);
+        obj.setLocation(fp.getX(), fp.getY(), fp.getZ());
+        new SetLocation(obj, position.key, position.index);
+
+    }
+
 
 }
--- a/src/main/java/alice/test/topology/aquarium/StartFishMovement.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/StartFishMovement.java	Thu Nov 30 19:42:31 2017 +0900
@@ -3,10 +3,10 @@
 import alice.codesegment.CodeSegment;
 
 public class StartFishMovement extends CodeSegment{
-	@Override
-	public void run(){
-		new CheckMyName();
-	}
-	
+    @Override
+    public void run(){
+        new CheckMyName();
+    }
+
 
 }
--- a/src/main/java/alice/test/topology/aquarium/TakeMynum.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/TakeMynum.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,23 +5,23 @@
 import alice.datasegment.Receiver;
 
 public class TakeMynum extends CodeSegment {
-	
-	private Receiver mynum = ids.create(CommandType.TAKE);
-	
-	public TakeMynum(){
-		this.mynum.setKey("num");
-	}
-	
-	public TakeMynum(int index){
-		this.mynum.setKey("num", index);
-	}
+
+    private Receiver mynum = ids.create(CommandType.TAKE);
+
+    public TakeMynum(){
+        this.mynum.setKey("num");
+    }
 
-	@Override
-	public void run() {
-		new TakePnum(this.mynum);
-		ods.put("num", 0);
-		new TakeMynum(this.mynum.index+1);
-	}
+    public TakeMynum(int index){
+        this.mynum.setKey("num", index);
+    }
+
+    @Override
+    public void run() {
+        new TakePnum(this.mynum);
+        ods.put("num", 0);
+        new TakeMynum(this.mynum.index+1);
+    }
 
 }
 
--- a/src/main/java/alice/test/topology/aquarium/TakePnum.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/TakePnum.java	Thu Nov 30 19:42:31 2017 +0900
@@ -5,20 +5,20 @@
 import alice.datasegment.Receiver;
 
 public class TakePnum extends CodeSegment {
-	// this CodeSegment has bug
-	
-	private Receiver pnum = ids.create(CommandType.TAKE);
-	private Receiver mynum;
-	
-	public TakePnum(Receiver data){
-		this.pnum.setKey("parent", "num");
-		this.mynum = data;
-	}
+    // this CodeSegment has bug
+
+    private Receiver pnum = ids.create(CommandType.TAKE);
+    private Receiver mynum;
 
-	@Override
-	public void run() {
-		ods.update("parent", "num", 
-				this.pnum.asInteger()+this.mynum.asInteger());
-	}
+    public TakePnum(Receiver data){
+        this.pnum.setKey("parent", "num");
+        this.mynum = data;
+    }
+
+    @Override
+    public void run() {
+        ods.update("parent", "num",
+                this.pnum.asInteger()+this.mynum.asInteger());
+    }
 
 }
--- a/src/main/java/alice/test/topology/aquarium/ViewChange.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/aquarium/ViewChange.java	Thu Nov 30 19:42:31 2017 +0900
@@ -1,58 +1,62 @@
 package alice.test.topology.aquarium;
 
+import com.sun.j3d.utils.universe.SimpleUniverse;
+import com.sun.j3d.utils.universe.ViewingPlatform;
+
+import javax.media.j3d.Canvas3D;
+import javax.media.j3d.Transform3D;
+import javax.media.j3d.TransformGroup;
+import javax.vecmath.Vector3f;
 import java.awt.*;
 
-import javax.media.j3d.*;
-import javax.vecmath.*;
-import com.sun.j3d.utils.universe.*;
 
 public class ViewChange extends Canvas3D {
 
-	private static final long serialVersionUID = 1L;
-	float sensitivity;
-	float distance = 2.5f;
-	float camera_x, camera_y, camera_z, camera_xz, camera_xy, camera_yz = 0;
-	float phi =  0; // flow
-	float theta = 0;
-	
-	SimpleUniverse universe;
-	TransformGroup Camera;
-	Transform3D Transform_camera_pos;
-	Transform3D Transform_camera_phi;
-	Transform3D Transform_camera_theta;
-	Vector3f Vector_camera_pos;
-	
-	public ViewChange(float x, float Sensitivity, GraphicsConfiguration config){
-		super(config);
-		
-		sensitivity = Sensitivity;
-		universe = new SimpleUniverse(this);
-		ViewingPlatform vp = universe.getViewingPlatform();
-		Camera = vp.getViewPlatformTransform();
+    private static final long serialVersionUID = 1L;
+    float sensitivity;
+    float distance = 2.5f;
+    float camera_x, camera_y, camera_z, camera_xz, camera_xy, camera_yz = 0;
+    float phi =  0; // flow
+    float theta = 0;
+
+    SimpleUniverse universe;
+    TransformGroup Camera;
+    Transform3D Transform_camera_pos;
+    Transform3D Transform_camera_phi;
+    Transform3D Transform_camera_theta;
+    Vector3f Vector_camera_pos;
+
+    public ViewChange(float x, float Sensitivity, GraphicsConfiguration config){
+        super(config);
+
+        sensitivity = Sensitivity;
+        universe = new SimpleUniverse(this);
+        ViewingPlatform vp = universe.getViewingPlatform();
+        Camera = vp.getViewPlatformTransform();
 
-		camera_y = distance * (float)Math.sin(theta);
-		camera_xz = distance * (float)Math.cos(theta);
-		System.out.println(x);
-		camera_x = x;
-		camera_z =  camera_xz * (float)Math.cos(phi);
-		
-		Vector_camera_pos = new Vector3f(camera_x, camera_y, camera_z);
-		Transform_camera_pos = new Transform3D();
-		Transform_camera_pos.setTranslation(Vector_camera_pos);
-		Transform_camera_phi = new Transform3D();
-		Transform_camera_theta = new Transform3D();
-		Transform_camera_theta.rotX(-theta);
-		Transform_camera_phi.rotY(phi);
-		Transform_camera_theta.mul(Transform_camera_phi);
-		Transform_camera_pos.mul(Transform_camera_theta);
+        camera_y = distance * (float)Math.sin(theta);
+        camera_xz = distance * (float)Math.cos(theta);
+        System.out.println(x);
+        camera_x = x;
+        camera_z =  camera_xz * (float)Math.cos(phi);
 
-		Camera.setTransform(Transform_camera_pos);
+        Vector_camera_pos = new Vector3f(camera_x, camera_y, camera_z);
+        Transform_camera_pos = new Transform3D();
+        Transform_camera_pos.setTranslation(Vector_camera_pos);
+        Transform_camera_phi = new Transform3D();
+        Transform_camera_theta = new Transform3D();
+        Transform_camera_theta.rotX(-theta);
+        Transform_camera_phi.rotY(phi);
+        Transform_camera_theta.mul(Transform_camera_phi);
+        Transform_camera_pos.mul(Transform_camera_theta);
 
-		addMouseMotionListener(new MouseViewEvent(this));
-		
-	}
-	
-	
-	
+        Camera.setTransform(Transform_camera_pos);
+
+        addMouseMotionListener(new MouseViewEvent(this));
+
+    }
+
+
+
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/AddObject.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,64 @@
+package alice.test.topology.aquarium.fx;
+
+import javafx.application.Platform;
+import javafx.scene.Group;
+import javafx.scene.Node;
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class AddObject extends CodeSegment {
+    // add Object on javaFx Scene
+    private Receiver info = ids.create(CommandType.TAKE);  // objectList
+    private Receiver info1 = ids.create(CommandType.TAKE); // fish Object made from CreateObject CS
+    private Receiver info2 = ids.create(CommandType.PEEK); // node name
+    private boolean executed = false;
+
+    public AddObject(){
+        info.setKey("root");
+        info1.setKey("addOffer");
+        info2.setKey("host");
+    }
+
+    @Override
+    public void run() {
+
+
+        if (!executed) {
+            executed = true;
+            // javafx's Scene can be accessed only FX application thread.
+            Platform.runLater(this);
+        } else {
+            boolean duplication = false;
+            Group root = info.asClass(Group.class);
+            Group obj = info1.asClass(Group.class);
+            String myName = info2.asString();
+
+            for (Node n : root.getChildren()){
+                if (n.getId().equals(obj.getId()))
+                    duplication = true;
+            }
+
+            if (!duplication) {
+                root.getChildren().add(obj);
+                System.out.println(obj.getId()+" add");
+                ods.put(obj.getId()+"Fish", obj);
+
+                // controlled own fish
+                if (myName.equals(obj.getId())){
+                    new CalculatePosition(obj.getId()+"FishdiffP");
+                }
+                new SetTranslate(obj.getId()+"Fish");
+
+                FishInfo fishInfo = new FishInfo();
+                fishInfo.name = obj.getId();
+                fishInfo.size = obj.getScaleX();
+                ods.put("register", fishInfo);
+            }
+            ods.flip(info);
+            new AddObject();
+        }
+    }
+
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/Aquarium.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,133 @@
+package alice.test.topology.aquarium.fx;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.net.URL;
+
+import javax.imageio.ImageIO;
+
+import alice.codesegment.OutputDataSegment;
+import javafx.application.Application;
+import javafx.embed.swing.SwingFXUtils;
+import javafx.event.EventHandler;
+import javafx.scene.Group;
+import javafx.scene.Parent;
+import javafx.scene.PerspectiveCamera;
+import javafx.scene.Scene;
+import javafx.scene.SceneAntialiasing;
+import javafx.scene.SubScene;
+import javafx.scene.image.ImageView;
+import javafx.scene.image.WritableImage;
+import javafx.scene.input.KeyEvent;
+import javafx.scene.paint.Color;
+import javafx.scene.transform.Rotate;
+import javafx.scene.transform.Translate;
+import javafx.stage.Stage;
+import javafx.stage.WindowEvent;
+
+public class Aquarium extends Application {
+
+    private OutputDataSegment ods = new OutputDataSegment();
+
+    @Override
+    public void start(Stage primaryStage) throws IOException {
+        final String myName = getParameters().getRaw().get(0); // name
+        primaryStage.setTitle("Aquarium "+ myName);
+        primaryStage.setResizable(false);
+        primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
+            @Override
+            public void handle(WindowEvent event) {
+                // should send finish DataSegment
+                System.exit(0);
+            }
+        });
+
+        Scene scene = new Scene(createContent());
+        scene.setFill(Color.color(0.2, 0.5, 1.0));
+        scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
+            public void handle(KeyEvent t) {
+                FishInfo info = null;
+                switch (t.getCode()) {
+                case RIGHT:
+                    info = new FishInfo(0.1,0,0);
+                    info.rolY = -1;
+                    info.rotate = 90;
+                    break;
+                case LEFT:
+                    info = new FishInfo(-0.1,0,0);
+                    info.rolY = 1;
+                    info.rotate = 90;
+                    break;
+                case UP:
+                    info = new FishInfo(0,-0.1,0);
+                    info.rolX = -1;
+                    info.rotate = 90;
+                    break;
+                case DOWN:
+                    info = new FishInfo(0,0.1,0);
+                    info.rolX = 1;
+                    info.rotate = 90;
+                    break;
+                case N:
+                    info = new FishInfo(0,0,0.1);
+                    break;
+                case M:
+                    info = new FishInfo(0,0,-0.1);
+                    info.rotate = 180;
+                    break;
+                default: // do nothing
+                    // reset. send median position. after implement
+                    info = new FishInfo(0,0,0);
+                    break;
+                }
+                ods.update(myName+"FishdiffP", info);
+            }
+        });
+        primaryStage.setScene(scene);
+        primaryStage.show();
+    }
+
+    private Parent createContent(){
+        Group root = new Group();
+        ods.put("root", root);
+
+        // Create and position camera
+        PerspectiveCamera camera = new PerspectiveCamera(true);
+        camera.getTransforms().addAll(
+                new Rotate(0, Rotate.Y_AXIS),
+                new Rotate(0, Rotate.X_AXIS),
+                new Translate(0, 0, -15));
+        camera.setId("camera");
+        root.getChildren().add(camera);
+
+        BufferedImage img = null;
+        try {
+            URL url = getClass().getClassLoader().getResource("images/IKAMUSUME.jpg");
+            img = ImageIO.read(url);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        WritableImage wimg = SwingFXUtils.toFXImage(img, null);
+        ImageView iview = new ImageView(wimg);
+        iview.setFitWidth(11);
+        iview.setFitHeight(11);
+        iview.setTranslateX(-5.5);
+        iview.setTranslateY(-5.5);
+        iview.setTranslateZ(6.0);
+        iview.setId("IKAMUSUME");
+        root.getChildren().add(iview);
+
+        // Use a SubScene
+        SubScene subScene = new SubScene(root, 800, 700, true, SceneAntialiasing.BALANCED);
+        subScene.setFill(Color.TRANSPARENT);
+        subScene.setCamera(camera);
+        Group parent = new Group(subScene);
+
+        return parent;
+    }
+
+    public static void main(String[] args) {
+        launch(args);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/AquariumConfig.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,18 @@
+package alice.test.topology.aquarium.fx;
+
+import alice.topology.node.TopologyNodeConfig;
+
+public class AquariumConfig extends TopologyNodeConfig {
+
+    public String type = "TUNA";
+
+    public AquariumConfig(String[] args) {
+        super(args);
+        for (int i = 0; i< args.length; i++) {
+            if ("-type".equals(args[i])) {
+                type = args[++i];
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/CalculatePosition.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,40 @@
+package alice.test.topology.aquarium.fx;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class CalculatePosition extends CodeSegment {
+
+    private Receiver info = ids.create(CommandType.TAKE); // diff fish position value
+    private Receiver info1 = ids.create(CommandType.TAKE); // absolute fish position value
+    private Receiver info2 = ids.create(CommandType.PEEK);
+
+    public CalculatePosition(String key){
+        info.setKey(key);
+        info1.setKey("OwnFishP");
+        info2.setKey("host");
+
+    }
+
+    @Override
+    public void run() {
+        FishInfo dfp = info.asClass(FishInfo.class);
+        FishInfo afp = info1.asClass(FishInfo.class);
+        String myName = info2.asString();
+
+        afp.setX(afp.getX() + dfp.getX());
+        afp.setY(afp.getY() + dfp.getY());
+        afp.setZ(afp.getZ() + dfp.getZ());
+        ods.update(info1.key, afp);
+
+        FishInfo fishInfo = new FishInfo(afp.getX(),afp.getY(),afp.getZ());
+        fishInfo.rolX = dfp.rolX;
+        fishInfo.rolY = dfp.rolY;
+        fishInfo.rolZ = dfp.rolZ;
+        fishInfo.rotate = dfp.rotate;
+        ods.update(myName+"FishabsoluteP", fishInfo);
+
+        this.recycle();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/CheckAllFishInfoExist.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,59 @@
+package alice.test.topology.aquarium.fx;
+
+import java.io.IOException;
+
+import javafx.scene.Group;
+import javafx.scene.Node;
+
+import org.msgpack.MessagePack;
+import org.msgpack.type.ArrayValue;
+import org.msgpack.type.Value;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class CheckAllFishInfoExist extends CodeSegment {
+    // this CS check all fish object exist in scene
+
+    private Receiver info = ids.create(CommandType.TAKE);  // fishInfoList
+    private Receiver info1 = ids.create(CommandType.PEEK);
+
+    public CheckAllFishInfoExist(){
+        info.setKey("receiveRegisteredList");
+        info1.setKey("root");
+    }
+
+    @Override
+    public void run() {
+        try {
+            new SendDataOthers(info, info.key);
+            ods.put("registeredList", info.getVal());
+            ArrayValue fishInfoList = info.asClass(Value.class).asArrayValue();
+            MessagePack packer = new MessagePack();
+            Group root = info1.asClass(Group.class);
+            for (Value v : fishInfoList){
+                boolean exist = false;
+                FishInfo info = packer.convert(v, FishInfo.class);
+                if (info.name != null) {
+                    for (Node n : root.getChildren()) {
+                        if (info.name.equals(n.getId())) {
+                            exist = true;
+                            break;
+                        }
+                    }
+
+                    if (!exist) {
+                        info.fromCheckExist = true;
+                        ods.put("fishData", info);
+                    }
+                }
+            }
+
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        this.recycle();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/CheckMyName.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,55 @@
+package alice.test.topology.aquarium.fx;
+
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class CheckMyName extends CodeSegment {
+    private Receiver host = ids.create(CommandType.PEEK);
+    private Pattern pattern = Pattern.compile("^(node|cli|local)([0-9]+)$");
+    private int INNER_WIDTH = 10;
+
+    public CheckMyName(){
+        host.setKey("host");
+    }
+
+    @Override
+    public void run() {
+        String name = host.asString();
+        Matcher matcher = pattern.matcher(name);
+        matcher.find();
+
+        // use view scope
+        int num = new Integer(matcher.group(2));
+        // scope: A_n = 5 + 10(n - 1);
+        int median = INNER_WIDTH * num;
+        ods.put("median", median); // node0 median : 0
+                                   // node1 median : 10
+                                   // node2 median : 20
+
+        if (num == 0){
+            // only root node create fishInfoList registered all fishInfo
+            // fishInfoList send children for checking all Fish object in own scene
+            new RegisterList();
+            ods.put("registeredList", new ArrayList<FishInfo>());
+        }
+
+        new CheckAllFishInfoExist();
+
+        FishInfo fishInfo = new FishInfo(median,0,0);
+        fishInfo.setName(name);
+
+        ods.put("OwnFishP", fishInfo.clone());
+        ods.put("fishData", fishInfo);
+
+        new CreateObject();
+        new AddObject();
+
+        String[] args = {name};
+        Aquarium.main(args);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/CreateObject.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,83 @@
+package alice.test.topology.aquarium.fx;
+
+import javafx.beans.binding.When;
+import javafx.beans.property.BooleanProperty;
+import javafx.beans.property.SimpleBooleanProperty;
+import javafx.scene.Group;
+import javafx.scene.Node;
+import javafx.scene.shape.DrawMode;
+import javafx.scene.shape.MeshView;
+
+import com.interactivemesh.jfx.importer.col.ColModelImporter;
+import com.interactivemesh.jfx.importer.obj.ObjModelImporter;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class CreateObject extends CodeSegment{
+
+    private Receiver info = ids.create(CommandType.TAKE);  // fishInfo
+    private Receiver info1 = ids.create(CommandType.PEEK);  // fishInfo
+
+    public CreateObject(){
+        info.setKey("fishData");
+        info1.setKey("type");
+
+    }
+
+    @Override
+    public void run() {
+        FishInfo fishInfo = info.asClass(FishInfo.class);
+
+        Group obj = new Group();
+        addColladaObject(obj);
+
+        obj.setScaleX(fishInfo.size);
+        obj.setScaleY(fishInfo.size);
+        obj.setScaleZ(fishInfo.size);
+        obj.setId(fishInfo.name);
+
+        ods.put("addOffer", obj);
+        if (!fishInfo.fromCheckExist)
+            new SendDataOthers(info, "fishData");
+
+        new CreateObject();
+    }
+
+    // for read *.obj file
+    public void addObject(Group obj){
+        BooleanProperty showWireframe = new SimpleBooleanProperty(false);
+        ObjModelImporter objImporter = new ObjModelImporter();
+        objImporter.read(getClass().getClassLoader().getResource("objects/Scooter-smgrps.obj"));
+
+        MeshView[] dukeMesh = objImporter.getImport();
+        objImporter.close();
+
+        for (MeshView _dukeMesh : dukeMesh) {
+            obj.getChildren().addAll(_dukeMesh);
+            _dukeMesh.drawModeProperty().bind(new When(showWireframe).then(DrawMode.LINE).otherwise(DrawMode.FILL));
+        }
+    }
+
+    // for read *.dae file
+    public void addColladaObject(Group obj){
+        String url = getResourceUrl();
+        ColModelImporter colImporter = new ColModelImporter();
+        colImporter.read(getClass().getClassLoader().getResource(url));
+        Node[] node = colImporter.getImport();
+        obj.getChildren().add(node[0]);
+    }
+
+    public String getResourceUrl() {
+        String type = info1.asString();
+        System.out.println(type);
+        for (FishType f :FishType.values()){
+            if (type.equals(f.name())){
+                return f.getUrl();
+            }
+        }
+        return FishType.DEFAULT.getUrl();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/FishInfo.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,70 @@
+package alice.test.topology.aquarium.fx;
+
+import org.msgpack.annotation.Message;
+
+@Message
+public class FishInfo {
+    // public fields are serialized.
+    public double x = 0;
+    public double y = 0;
+    public double z = 0;
+    public String name;
+    public double size = 0.1;
+    public String type = "defalut"; // use select object type. after implement may be...
+
+    public double rolX = 0; // these parameters use RotationAxis
+    public double rolY = 0;
+    public double rolZ = 0;
+    public double rotate = 0;
+
+    public boolean fromCheckExist = false;
+
+    public FishInfo(){
+        // this constructor is nothing to do, but need for serializing with MessagePack
+    }
+
+    public FishInfo(double x,double y,double z){
+        this.x = x;
+        this.y = y;
+        this.z = z;
+    }
+
+    public void setName(String name){
+        this.name = name;
+    }
+
+    public void setSize(double size){
+        this.size = size;
+    }
+
+    public double getX(){
+        return this.x;
+    }
+
+    public void setX(double x){
+        this.x = x;
+    }
+
+    public double getY(){
+        return this.y;
+    }
+
+    public void setY(double y){
+        this.y = y;
+    }
+
+    public double getZ(){
+        return this.z;
+    }
+
+    public void setZ(double z){
+        this.z = z;
+    }
+
+    public FishInfo clone(){
+        FishInfo info = new FishInfo(this.x,this.y,this.z);
+        info.setName(this.name);
+        return info;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/FishType.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,17 @@
+package alice.test.topology.aquarium.fx;
+
+public enum FishType {
+
+    DEFAULT("objects/seymourplane-150-im.dae"),
+    TUNA("objects/TUNA.dae");
+
+    private String url;
+
+    FishType(String url){
+        this.url = url;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/GetMyHostName.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,20 @@
+package alice.test.topology.aquarium.fx;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class GetMyHostName extends CodeSegment{
+
+    private Receiver info = ids.create(CommandType.PEEK);
+
+    public GetMyHostName() {
+        info.setKey("host");
+    }
+    @Override
+    public void run() {
+        String host = info.asString();
+        new MoveBeforePosition(host);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/MoveBeforePosition.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,31 @@
+package alice.test.topology.aquarium.fx;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class MoveBeforePosition extends CodeSegment {
+
+    private Receiver info = ids.create(CommandType.PEEK);
+    private Receiver info1 = ids.create(CommandType.TAKE);
+    private Receiver info2 = ids.create(CommandType.PEEK);
+
+    public MoveBeforePosition(String key) {
+        info.setKey("parent", key+"FishbackUp");
+        info1.setKey("OwnFishP");
+        info2.setKey("host");
+    }
+    @Override
+    public void run() {
+        FishInfo fp = info.asClass(FishInfo.class);
+        FishInfo fp2 = fp.clone();
+        fp2.setX(0);
+        fp2.setY(0);
+        fp2.setZ(0);
+        ods.put(info1.key, fp);
+        String key = info2.asString();
+        ods.put(key+"FishdiffP", fp2);
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/RegisterList.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,32 @@
+package alice.test.topology.aquarium.fx;
+
+import java.util.List;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class RegisterList extends CodeSegment{
+
+    private Receiver info = ids.create(CommandType.TAKE);  // created fish object info
+    private Receiver info1 = ids.create(CommandType.TAKE); // created fish List
+
+    public RegisterList(){
+        info.setKey("register");
+        info1.setKey("registeredList");
+    }
+
+    @Override
+    public void run() {
+        FishInfo fishInfo = info.asClass(FishInfo.class);
+
+        @SuppressWarnings("unchecked")
+        List<FishInfo> list = info1.asClass(List.class);
+
+        list.add(fishInfo);
+        ods.update(info1.key, list);
+        new SendDataOthers(info1, "receiveRegisteredList");
+        new RegisterList();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/SendDataOthers.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,32 @@
+package alice.test.topology.aquarium.fx;
+
+import java.util.List;
+
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class SendDataOthers extends CodeSegment {
+    // this CodeSegment is bad.
+
+    private Receiver info = ids.create(CommandType.PEEK);
+    private Receiver info1; // should use dataSegment
+    private String key;     // should use dataSegment
+
+    public SendDataOthers(Receiver r, String key){
+        this.key = key;
+        info1 = r;
+        info.setKey("_CLIST");
+    }
+
+    @Override
+    public void run() {
+        @SuppressWarnings("unchecked")
+        List<String> nodes = info.asClass(List.class);
+        for (String node : nodes) {
+            if (!info1.from.equals(node))
+                ods.put(node, key, info1.getReceiveData());
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/SetTranslate.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,48 @@
+package alice.test.topology.aquarium.fx;
+
+import javafx.application.Platform;
+import javafx.geometry.Point3D;
+import javafx.scene.Group;
+import alice.codesegment.CodeSegment;
+import alice.datasegment.CommandType;
+import alice.datasegment.Receiver;
+
+public class SetTranslate extends CodeSegment {
+
+    private Receiver info  = ids.create(CommandType.TAKE); // object instance
+    private Receiver info1 = ids.create(CommandType.TAKE); // absolute fish position value
+    private Receiver info2 = ids.create(CommandType.PEEK); // median
+    private boolean executed = false;
+
+    public SetTranslate(String key) {
+        info.setKey(key);
+        info1.setKey(key+"absoluteP");
+        info2.setKey("median");
+    }
+
+    @Override
+    public void run() {
+        if (!executed) {
+            executed = true;
+            new SendDataOthers(info1, info1.key);
+            ods.update(info.key+"backUp", info1.getReceiveData());
+            // javafx's Scene can be accessed only FX application thread.
+            Platform.runLater(this);
+        } else {
+            Group fish = info.asClass(Group.class);
+            FishInfo fp = info1.asClass(FishInfo.class);
+            int median = info2.asInteger();
+
+            fish.setRotate(fp.rotate);
+            fish.setRotationAxis(new Point3D(fp.rolX,fp.rolY,fp.rolZ));
+            fish.setTranslateX(fp.getX() - median);
+            fish.setTranslateY(fp.getY());
+            fish.setTranslateZ(fp.getZ());
+            ods.flip(info);
+
+            executed = false;
+            new SetTranslate(info.key);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/StartAquariumFX.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,19 @@
+package alice.test.topology.aquarium.fx;
+
+import alice.topology.node.TopologyNode;
+
+public class StartAquariumFX {
+    public static void main(String args[]){
+        AquariumConfig conf = new AquariumConfig(args);
+        conf.register(GetMyHostName.class);
+        StartCodeSegment cs = new StartCodeSegment();
+        if (conf.getManagerHostName() !=null){
+            cs.ods.put("type", conf.type);
+            new TopologyNode(conf, cs);
+        } else {
+            cs.ods.put("host", "local0");
+            cs.execute();
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/java/alice/test/topology/aquarium/fx/StartCodeSegment.java	Thu Nov 30 19:42:31 2017 +0900
@@ -0,0 +1,12 @@
+package alice.test.topology.aquarium.fx;
+
+import alice.codesegment.CodeSegment;
+
+public class StartCodeSegment extends CodeSegment{
+
+    @Override
+    public void run() {
+        new CheckMyName();
+    }
+
+}
--- a/src/main/java/alice/test/topology/fish/AssignStartX.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/fish/AssignStartX.java	Thu Nov 30 19:42:31 2017 +0900
@@ -6,35 +6,35 @@
 
 public class AssignStartX extends CodeSegment {
 
-	public Receiver routing = ids.create(CommandType.PEEK);
-	public int startX;
-	public int index;
+    public Receiver routing = ids.create(CommandType.PEEK);
+    public int startX;
+    public int index;
+
+    public AssignStartX(int startX, int index) {
+        this.startX = startX;
+        this.index = index;
+    }
+
+    @Override
+    public void run() {
+        System.out.println("AssignStartX: " + startX);
 
-	public AssignStartX(int startX, int index) {
-		this.startX = startX;
-		this.index = index;
-	}
-	
-	@Override
-	public void run() {
-		System.out.println("AssignStartX: " + startX);
-		
-		RoutingTable routing = this.routing.asClass(RoutingTable.class);
-		int x = startX;
-		System.out.println("RoutingTable: " + this.routing.getVal());
-		if (this.index >= this.routing.index) {
-			AssignStartX cs = new AssignStartX(startX, index);
-			cs.routing.setKey("local", "routing", this.routing.index);
-			return;
-		}
-		for (Routing r : routing.table) {
-			System.out.println(r.name);
-			ods.update(r.name, "startX", x);
-			System.out.println("Assign: " + r.name + ".startX = " + x);
-			x += r.width;
-		}
-		PeekStartX cs = new PeekStartX(this.routing.index);
-		cs.startX.setKey("local", "startX", this.index);
-	}
+        RoutingTable routing = this.routing.asClass(RoutingTable.class);
+        int x = startX;
+        System.out.println("RoutingTable: " + this.routing.getVal());
+        if (this.index >= this.routing.index) {
+            AssignStartX cs = new AssignStartX(startX, index);
+            cs.routing.setKey("local", "routing", this.routing.index);
+            return;
+        }
+        for (Routing r : routing.table) {
+            System.out.println(r.name);
+            ods.update(r.name, "startX", x);
+            System.out.println("Assign: " + r.name + ".startX = " + x);
+            x += r.width;
+        }
+        PeekStartX cs = new PeekStartX(this.routing.index);
+        cs.startX.setKey("local", "startX", this.index);
+    }
 
 }
--- a/src/main/java/alice/test/topology/fish/CheckMyName.java	Wed Apr 19 19:19:27 2017 +0900
+++ b/src/main/java/alice/test/topology/fish/CheckMyName.java	Thu Nov 30 19:42:31 2017 +0900
@@ -8,51 +8,51 @@
 import alice.datasegment.Receiver;
 
 public class CheckMyName extends CodeSegment {
-	
-	private Receiver host = ids.create(CommandType.PEEK);
-	
-	public CheckMyName(){
-		host.setKey("host");
-	}
-	
-	@Override
-	public void run() {
-		String name = host.asString();
-		Pattern pattern = Pattern.compile("^(node|cli)([0-9]+)$");
-		Matcher matcher = pattern.matcher(name);
-		
-		matcher.find();
-		String type = matcher.group(1);
-		int num = new Integer(matcher.group(2));
-		
-		if (type.equals("cli")) {
-			System.out.println("********************I am cli" + num);
-			ods.update("local", "width", 400);
-			
-			GetStartX cs = new GetStartX();
-			cs.startX.setKey("local", "startX");
-			
-		} else if (type.equals("node")) {
-			System.out.println("*****************