Mercurial > hg > RemoteEditor > Eclipse
view src/sample/merge/TestSessionManager.java @ 57:f055e65c7e3c
*** empty log message ***
author | pin |
---|---|
date | Tue, 24 Jul 2007 17:40:07 +0900 |
parents | |
children | aa47ea5bdac9 |
line wrap: on
line source
package sample.merge; import java.util.LinkedList; import java.util.List; import remoteeditor.command.REPCommand; import remoteeditor.command.REPCommandEvent; public class TestSessionManager implements Runnable{ List <REPCommandPlus> commandList = new LinkedList<REPCommandPlus>(); List <TestEditor> editorList = new LinkedList<TestEditor>(); public synchronized void send(REPCommand command, int EID){ REPCommandPlus commandp = new REPCommandPlus(command, EID); commandList.add(commandp); } public void run() { while(true){ if(commandList.size() > 0){ int eid = commandList.get(0).getEID(); for(int i = 0; i < editorList.size()-1; i++){ if(eid == editorList.get(i).getEID()){ System.out.println("test"); editorList.get(i+1).CommandReceived(new REPCommandEvent(commandList.get(0).getCommand())); } } if(eid == editorList.get(editorList.size()-1).getEID()){ editorList.get(0).CommandReceived(new REPCommandEvent(commandList.get(0).getCommand())); } } try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } public void addEditor(TestEditor editor) { editorList.add(editor); } } class REPCommandPlus{ private REPCommand command; private int EID; public REPCommandPlus(REPCommand command, int eid) { this.command = command; this.EID = eid; } public int getEID(){ return EID; } public REPCommand getCommand(){ return command; } }