diff test/mergertest/RemoteEditorSimulator.java @ 420:5c95a9020e31

Modify ServerMainLoop
author one
date Fri, 13 Feb 2009 19:13:50 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/mergertest/RemoteEditorSimulator.java	Fri Feb 13 19:13:50 2009 +0900
@@ -0,0 +1,42 @@
+package test.mergertest;
+
+import java.util.List;
+
+import rep.REP;
+import rep.REPCommand;
+import test.editortest.Logger;
+import test.editortest.REPText;
+
+public class RemoteEditorSimulator {
+
+	private REPText repText;
+	private int eid;
+	
+	public RemoteEditorSimulator(int eid){
+		this.eid = eid;
+		repText = new REPTextWithLinkedList();
+	}
+
+	public void edit(REPCommand command) {
+		Logger.print(command);
+		if(command.cmd == REP.REPCMD_INSERT_USER){
+			repText.insert(command.lineno, command.string);
+		}else if(command.cmd == REP.REPCMD_DELETE_USER){
+			repText.delete(command.lineno);
+		}
+	}
+
+	public int getEID() {
+		return eid;
+	}
+
+	public void display() {
+		List<String> list = repText.list();
+		System.out.println();
+		System.out.println("---------- Editor" + eid + " ----------");
+		for(String str : list){
+			System.out.println(str);
+		}
+	}
+
+}