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

Modify ServerMainLoop
author one
date Fri, 13 Feb 2009 19:13:50 +0900
parents
children
comparison
equal deleted inserted replaced
419:7ff127c8ad64 420:5c95a9020e31
1 package test.mergertest;
2
3 import java.util.List;
4
5 import rep.REP;
6 import rep.REPCommand;
7 import test.editortest.Logger;
8 import test.editortest.REPText;
9
10 public class RemoteEditorSimulator {
11
12 private REPText repText;
13 private int eid;
14
15 public RemoteEditorSimulator(int eid){
16 this.eid = eid;
17 repText = new REPTextWithLinkedList();
18 }
19
20 public void edit(REPCommand command) {
21 Logger.print(command);
22 if(command.cmd == REP.REPCMD_INSERT_USER){
23 repText.insert(command.lineno, command.string);
24 }else if(command.cmd == REP.REPCMD_DELETE_USER){
25 repText.delete(command.lineno);
26 }
27 }
28
29 public int getEID() {
30 return eid;
31 }
32
33 public void display() {
34 List<String> list = repText.list();
35 System.out.println();
36 System.out.println("---------- Editor" + eid + " ----------");
37 for(String str : list){
38 System.out.println(str);
39 }
40 }
41
42 }