Mercurial > hg > RemoteEditor > REPSessionManager
comparison rep/Editor.java @ 122:790c8dd42a7b
*** empty log message ***
author | kono |
---|---|
date | Tue, 26 Aug 2008 16:33:47 +0900 |
parents | 9381b4734a0b |
children | 617a47cb0150 |
comparison
equal
deleted
inserted
replaced
121:80ef604d09dc | 122:790c8dd42a7b |
---|---|
1 package rep; | 1 package rep; |
2 | 2 |
3 import java.nio.channels.SocketChannel; | 3 import java.nio.channels.SocketChannel; |
4 import java.util.LinkedList; | |
4 import java.util.StringTokenizer; | 5 import java.util.StringTokenizer; |
5 | 6 |
6 public class Editor { | 7 public class Editor { |
7 private int eid; | 8 private int eid; |
8 private SocketChannel myChannel; | 9 private SocketChannel myChannel; |
9 private SocketChannel nextChannel; | 10 private SocketChannel nextChannel; |
10 private String host; | 11 private String host; |
11 private String port; | 12 private String port; |
12 //public int getEID; | 13 //public int getEID; |
13 private String file; | 14 private String file; |
15 private LinkedList<REPCommand> undoCommandList = new LinkedList<REPCommand>(); | |
16 private LinkedList<Integer> temp = new LinkedList<Integer>(); | |
14 | 17 |
15 public Editor(int editorNo, SocketChannel channel){ | 18 public Editor(int editorNo, SocketChannel channel){ |
16 this.eid = editorNo; | 19 this.eid = editorNo; |
17 this.myChannel = channel; | 20 this.myChannel = channel; |
18 } | 21 } |
80 | 83 |
81 public void setChannel(SocketChannel channel) { | 84 public void setChannel(SocketChannel channel) { |
82 myChannel = channel; | 85 myChannel = channel; |
83 } | 86 } |
84 | 87 |
88 public void addUndoCommand(REPCommand command) { | |
89 if(command.cmd == REP.SMCMD_GET_UNDO_ACK){ | |
90 command.setCMD((temp.get(0)).intValue()); | |
91 temp.remove(); | |
92 } | |
93 | |
94 undoCommandList.addFirst(command); | |
95 System.out.println(undoCommandList); | |
96 // if(undoCommandList.size() > 10){ | |
97 // for(REPCommand undoCommand : undoCommandList){ | |
98 // send(undoCommand); | |
99 // } | |
100 // undoCommandList.clear(); | |
101 // } | |
102 } | |
103 | |
104 public void undo() { | |
105 // TODO Auto-generated method stub | |
106 for(REPCommand undoCommand : undoCommandList){ | |
107 send(undoCommand); | |
108 } | |
109 undoCommandList.clear(); | |
110 } | |
111 | |
112 public void setKindOfUndoCmd(int cmd) { | |
113 // TODO Auto-generated method stub | |
114 temp .add(cmd); | |
115 } | |
116 | |
85 } | 117 } |