comparison rep/SessionList.java @ 164:3841cc75b808

*** empty log message ***
author pin
date Thu, 28 Aug 2008 17:58:42 +0900
parents 5cc8cd48bded
children 3a2c6c2f9761
comparison
equal deleted inserted replaced
163:fb516794ee28 164:3841cc75b808
114 if (sessionLinkedList != null) { 114 if (sessionLinkedList != null) {
115 System.out.println(sessionLinkedList.toString()); 115 System.out.println(sessionLinkedList.toString());
116 return sessionLinkedList.toString(); 116 return sessionLinkedList.toString();
117 } 117 }
118 return "{}"; 118 return "{}";
119 }
120
121 public void sendToNextEditor(REPSocketChannel<REPCommand> channel, REPCommand repCmd) {
122 Editor editor2 = null;
123 Editor editor3;
124 // LinkedList <Editor> editorList = session3.get(repCmd.sid).getEditorList();
125 // this.getSession(sid);
126 LinkedList <Editor> editorList = sessionLinkedList.get(repCmd.sid-1).getEditorList(); //ここもforループで検索しないといけないよ。
127 for(Editor editor : editorList){
128 REPSocketChannel<REPCommand> channel2 = editor.getChannel();
129 if(channel.equals(channel2)){
130 editor2 = editor;
131 }
132 }
133 int size = editorList.size();
134 Editor lastEditor = (Editor) editorList.getLast();
135 if(size == 0){
136 editor3 = null;
137 }else if(editor2 == lastEditor){
138 editor3 = editorList.get(0);
139 }else{
140 editor3 = editorList.get(editorList.indexOf(editor2)+1);
141 }
142 if(editor3 != null){
143 //temp.add(repCmd.cmd);
144 REPCommand getUndoCommand = new REPCommand();
145 getUndoCommand.setCMD(REP.SMCMD_GET_UNDO);
146 getUndoCommand.lineno = repCmd.lineno;
147 editor3.send(getUndoCommand);
148 editor3.setKindOfUndoCmd(reverseCmd(repCmd.cmd));
149 editor3.send(repCmd);
150 //REPPacketSend send = new REPPacketSend(editor3.getChannel());
151 //send.send(repCmd);
152 }
153 } 119 }
154 120
155 private int reverseCmd(int cmd) { 121 private int reverseCmd(int cmd) {
156 // TODO Auto-generated method stub 122 // TODO Auto-generated method stub
157 int kindOfCmd = 0; 123 int kindOfCmd = 0;