diff src/alice/jungle/codesegment/LogUpdateCodeSegment.java @ 47:686057add8a4

confirmed LogUpdateCodeSegment
author one
date Fri, 12 Jul 2013 11:45:12 +0900
parents fd3643699f83
children a89c3539bff2
line wrap: on
line diff
--- a/src/alice/jungle/codesegment/LogUpdateCodeSegment.java	Fri Jul 12 11:27:00 2013 +0900
+++ b/src/alice/jungle/codesegment/LogUpdateCodeSegment.java	Fri Jul 12 11:45:12 2013 +0900
@@ -17,21 +17,20 @@
 public class LogUpdateCodeSegment extends CodeSegment {
 	
 	public Receiver arg1 = ids.create(CommandType.PEEK);
-	private final String rh;
-	private final String key;
+	public Receiver host = ids.create(CommandType.PEEK);
 	
-	public LogUpdateCodeSegment(String _rh, String _key) {
-		rh = _rh;
-		key = _key;
+	public LogUpdateCodeSegment() {
+		host.setKey("host",0);
 	}
 	
 	public void run() {
 		System.out.println("--LogUpdateCodeSegment--");
 		int index = arg1.index;
+		String h = host.asString();
 		DefaultTreeOperationLogContainer container = arg1.asClass(DefaultTreeOperationLogContainer.class);
-		if(updaterIsMe(container)) {
-			LogUpdateCodeSegment updateCS = new LogUpdateCodeSegment(rh, key);
-			updateCS.arg1.setKey(rh, key, index+1);
+		if(updaterIsMe(h, container)) {
+			LogUpdateCodeSegment updateCS = new LogUpdateCodeSegment();
+			updateCS.arg1.setKey("log", index+1);
 			return;
 		}
 		DefaultTreeOperationLog log = null;
@@ -51,13 +50,12 @@
 		if(either.isA()) {
 			throw new IllegalStateException();			
 		}
-		LogUpdateCodeSegment updateCS = new LogUpdateCodeSegment(rh, key);
-		updateCS.arg1.setKey(rh, key, index+1);
+		LogUpdateCodeSegment updateCS = new LogUpdateCodeSegment();
+		updateCS.arg1.setKey("log", index+1);
 	}
 	
-	private boolean updaterIsMe(DefaultTreeOperationLogContainer container) {
-
-		return false;
+	private boolean updaterIsMe(String host, DefaultTreeOperationLogContainer container) {
+		return host.equals(container.getServerName());
 	}