changeset 150:e33871f4b39a

*** empty log message ***
author pin
date Mon, 04 Aug 2008 20:34:09 +0900
parents 5942e0e3c632
children 1768e68ba98e
files bin/remoteeditor/network/REP.class src/remoteeditor/network/REP.java src/sample/merge/TranslaterImp1.java
diffstat 3 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
Binary file bin/remoteeditor/network/REP.class has changed
--- a/src/remoteeditor/network/REP.java	Mon Aug 04 20:10:25 2008 +0900
+++ b/src/remoteeditor/network/REP.java	Mon Aug 04 20:34:09 2008 +0900
@@ -36,5 +36,9 @@
 	public static final int SMCMD_UPDATE_ACK = 66;
 	public static final int SMCMD_GET_UNDO = 71;
 	public static final int SMCMD_GET_UNDO_ACK = 72;
+	
+    public static final int REPCMD_INSERT_UNDO	= 106;
+    public static final int REPCMD_DELETE_UNDO	= 109;
+    public static final int REPCMD_REPLACE_UNDO	= 113;
 
 }
--- a/src/sample/merge/TranslaterImp1.java	Mon Aug 04 20:10:25 2008 +0900
+++ b/src/sample/merge/TranslaterImp1.java	Mon Aug 04 20:34:09 2008 +0900
@@ -145,15 +145,18 @@
 	synchronized public REPCommand[] transReceiveCmd(REPCommand cmd){
 		int i=0;
 		REPCommand cmds[];
-		if (cmd.eid==eid){
-			return catchOwnCommand(cmd);
-		}
+		assert (cmd.eid != eid);
+//		if (cmd.eid==eid){
+//			return catchOwnCommand(cmd);
+//		}
 
 		for (REPCommand cmd0 : unMergedCmds){
 			if (cmd0.eid==cmd.eid) i++;
 		}
-
+		
 		if ( sentCmds.size()<i ){
+			//自分のエディタでされた編集コマンドより他のエディタでの編集コマンドのほうが多かった場合NOPを挿入
+			//自分のコマンドがないとマージできないのでNOPを挿入
 			cmds = new REPCommand[2];
 			String str = "NO OPERATION";
 			cmds[0] = setCmdState( new REPCommand(REP.REPCMD_NOP, 0, eid, 0, 0, str.length(), str) );
@@ -178,4 +181,14 @@
 	public void setEid(int _eid){
 		eid = _eid;
 	}
+
+	public Stack<REPCommand> getList() {
+		// TODO Auto-generated method stub
+		return unMergedCmds;
+	}
+
+	public LinkedList<REPCommand> getSentCmds() {
+		// TODO Auto-generated method stub
+		return sentCmds;
+	}
 }