Mercurial > hg > RemoteEditor > Eclipse
changeset 157:1a2269c820df simulator2008-8-26
*** empty log message ***
author | pin |
---|---|
date | Tue, 26 Aug 2008 18:15:00 +0900 |
parents | 7ebd30e5e385 |
children | 55bc9f6b0691 |
files | src/pathfinder/mergetest/ChannelSimulator.java src/pathfinder/mergetest/EditorObject.java src/pathfinder/mergetest/PacketSet.java src/pathfinder/mergetest/REPHandler.java src/pathfinder/mergetest/REPHandlerDoWaiting.java src/pathfinder/mergetest/REPHandlerImpl.java src/pathfinder/mergetest/REPHandlerInMerge.java src/pathfinder/mergetest/SelectionKeySimulator.java src/pathfinder/mergetest/SelectorSimulator.java src/pathfinder/mergetest/SessionManagerSimulatorWithMerger.java src/pathfinder/mergetest/TestMerger.java src/pathfinder/mergetest/TestMerger2.java src/pathfinder/mergetest/UserSimulator.java src/pathfinder/mergetest/UsersSimulator.java src/sample/merge/TranslaterImp1.java |
diffstat | 15 files changed, 321 insertions(+), 126 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pathfinder/mergetest/ChannelSimulator.java Mon Aug 25 15:53:03 2008 +0900 +++ b/src/pathfinder/mergetest/ChannelSimulator.java Tue Aug 26 18:15:00 2008 +0900 @@ -3,6 +3,8 @@ import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; +import remoteeditor.command.REPCommand; + public class ChannelSimulator<P> { private BlockingQueue<P> qread; private BlockingQueue<P> qwrite; @@ -91,5 +93,11 @@ return !qread.isEmpty(); } + public SelectionKeySimulator keyFor(SelectorSimulator<REPCommand> selector2) { + // TODO Auto-generated method stub + + return selector2.getKey(this); + } + }
--- a/src/pathfinder/mergetest/EditorObject.java Mon Aug 25 15:53:03 2008 +0900 +++ b/src/pathfinder/mergetest/EditorObject.java Tue Aug 26 18:15:00 2008 +0900 @@ -1,6 +1,7 @@ package pathfinder.mergetest; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import remoteeditor.command.REPCommand; @@ -12,6 +13,7 @@ private ChannelSimulator<P> channel; private TranslaterImp1 translater; private List<REPCommand> sentList; + private List<REPCommand> sendList; public EditorObject(int i, ChannelSimulator<P> cs) { // TODO Auto-generated constructor stub @@ -25,6 +27,7 @@ channel = cs; translater = imp1; sentList = new ArrayList<REPCommand>(); + sendList = new LinkedList<REPCommand>(); } public ChannelSimulator<P> getChannel() { @@ -74,9 +77,40 @@ public void send(REPCommand command) { // TODO Auto-generated method stub + if(false) System.out.println("send to Editor : " + eid + " : " + command); if(command !=null){ - channel.write((P) command); + //channel.write((P) command); + write(command); } } + public void addWaitCommand(REPCommand command) { + // TODO Auto-generated method stub + sendList.add(command); + } + + public void sendWaitingCommands() { + // TODO Auto-generated method stub + for(REPCommand command : sendList){ + channel.write(pack(command)); + } + sendList.clear(); + } + + private P pack(REPCommand command) { + // TODO Auto-generated method stub + P cmd = (P) new REPCommand(command); + return cmd; + } + + public void write(REPCommand cmd) { + // TODO Auto-generated method stub + channel.write(pack(cmd)); + } + + public boolean isMerging() { + // TODO Auto-generated method stub + return translater.isMerging(); + } + }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pathfinder/mergetest/PacketSet.java Tue Aug 26 18:15:00 2008 +0900 @@ -0,0 +1,16 @@ +package pathfinder.mergetest; + +import remoteeditor.command.REPCommand; + +public class PacketSet { + + private ChannelSimulator<REPCommand> channel; + private REPCommand packet; + + public PacketSet(ChannelSimulator<REPCommand> channel, REPCommand packet) { + // TODO Auto-generated constructor stub + this.channel = channel; + this.packet = packet; + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pathfinder/mergetest/REPHandler.java Tue Aug 26 18:15:00 2008 +0900 @@ -0,0 +1,8 @@ +package pathfinder.mergetest; + +import remoteeditor.command.REPCommand; + +public interface REPHandler { + void handle(SelectionKeySimulator<REPCommand> key); + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pathfinder/mergetest/REPHandlerDoWaiting.java Tue Aug 26 18:15:00 2008 +0900 @@ -0,0 +1,17 @@ +package pathfinder.mergetest; + +import remoteeditor.command.REPCommand; + +public class REPHandlerDoWaiting implements REPHandler { + + private SessionManagerSimulatorWithMerger session; + + public REPHandlerDoWaiting(SessionManagerSimulatorWithMerger session) { + this.session = session; + } + + public void handle(SelectionKeySimulator<REPCommand> key) { + session.doWaiting(); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pathfinder/mergetest/REPHandlerImpl.java Tue Aug 26 18:15:00 2008 +0900 @@ -0,0 +1,23 @@ +package pathfinder.mergetest; + +import remoteeditor.command.REPCommand; + +public class REPHandlerImpl implements REPHandler { + + private SessionManagerSimulatorWithMerger session; + + + public REPHandlerImpl(SessionManagerSimulatorWithMerger session) { + // TODO Auto-generated constructor stub + this.session = session; + } + + public void handle(SelectionKeySimulator<REPCommand> key) { + // TODO Auto-generated method stub + ChannelSimulator<REPCommand> channel = (ChannelSimulator<REPCommand>) key.channel(); + REPCommand packet = channel.read(); + REPCommand command = session.unpack(packet); + session.manage(channel, command); + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pathfinder/mergetest/REPHandlerInMerge.java Tue Aug 26 18:15:00 2008 +0900 @@ -0,0 +1,27 @@ +package pathfinder.mergetest; + +import java.util.LinkedList; +import java.util.List; + +import remoteeditor.command.REPCommand; + +public class REPHandlerInMerge implements REPHandler { + + private SessionManagerSimulatorWithMerger session; + //List<PacketSet> packetList = new LinkedList<PacketSet>(); + + public REPHandlerInMerge(SessionManagerSimulatorWithMerger session) { + // TODO Auto-generated constructor stub + this.session = session; + } + + public void handle(SelectionKeySimulator<REPCommand> key) { + // TODO Auto-generated method stub + ChannelSimulator<REPCommand> channel = (ChannelSimulator<REPCommand>) key.channel(); + REPCommand packet = channel.read(); + session.addWaitingCommand(new PacketSet(channel, packet)); + REPCommand command = session.unpack(packet); + session.manage(channel, command); + } + +}
--- a/src/pathfinder/mergetest/SelectionKeySimulator.java Mon Aug 25 15:53:03 2008 +0900 +++ b/src/pathfinder/mergetest/SelectionKeySimulator.java Tue Aug 26 18:15:00 2008 +0900 @@ -4,6 +4,7 @@ public static final int OP_READ = 0; private ChannelSimulator<P> channel; + private Object attachment; public SelectionKeySimulator(ChannelSimulator<P> cs) { // TODO Auto-generated constructor stub @@ -24,4 +25,14 @@ return channel; } + public Object attachment() { + // TODO Auto-generated method stub + return attachment; + } + + public void attach(Object handler) { + // TODO Auto-generated method stub + attachment = handler; + } + }
--- a/src/pathfinder/mergetest/SelectorSimulator.java Mon Aug 25 15:53:03 2008 +0900 +++ b/src/pathfinder/mergetest/SelectorSimulator.java Tue Aug 26 18:15:00 2008 +0900 @@ -51,10 +51,25 @@ keyList.add(new SelectionKeySimulator<P>(cs)); return key; } + + public SelectionKeySimulator<P> register(ChannelSimulator<P> cs, int opt, Object handler){ + SelectionKeySimulator<P> key = new SelectionKeySimulator<P>(cs); + key.attach(handler); + keyList.add(key); + return key; + } public ArrayList<SelectionKeySimulator<P>> selectedKeys() { return selectedKeys; } + + public SelectionKeySimulator getKey(ChannelSimulator channel){ + for(SelectionKeySimulator key : keyList){ + if(key.channel() == channel) + return key; + } + return null; + } }
--- a/src/pathfinder/mergetest/SessionManagerSimulatorWithMerger.java Mon Aug 25 15:53:03 2008 +0900 +++ b/src/pathfinder/mergetest/SessionManagerSimulatorWithMerger.java Tue Aug 26 18:15:00 2008 +0900 @@ -3,74 +3,91 @@ import java.util.ArrayList; import java.util.LinkedList; import java.util.List; + import remoteeditor.command.REPCommand; import remoteeditor.network.REP; import sample.merge.TranslaterImp1; -public class SessionManagerSimulatorWithMerger<P extends REPCommand> extends SeMaSimulator<P> { +public class SessionManagerSimulatorWithMerger extends SeMaSimulator<REPCommand> { - private List<TranslaterImp1> editorList; - private SelectorSimulator<P> selector; - private List<EditorObject<P>> editorList2; + private List<TranslaterImp1> transList; + private SelectorSimulator<REPCommand> selector; + private List<EditorObject<REPCommand>> editorList2; private int startQuit2; + //private List<LinkedList<REPCommand>> sendList; + private List<PacketSet> waitingList; - public SessionManagerSimulatorWithMerger(NetworkSimulator<P> _ns) { + public SessionManagerSimulatorWithMerger(NetworkSimulator<REPCommand> _ns) { super(_ns); } - public SessionManagerSimulatorWithMerger(NetworkSimulator<P> ns, int ne) { + public SessionManagerSimulatorWithMerger(NetworkSimulator<REPCommand> ns, int ne) { super(ns, ne); } - public SessionManagerSimulatorWithMerger(NetworkSimulator<P> _ns, int max_client, int max_packet) { + public SessionManagerSimulatorWithMerger(NetworkSimulator<REPCommand> _ns, int max_client, int max_packet) { super(_ns, max_client, max_packet); - editorList = new ArrayList<TranslaterImp1>(); - selector = new SelectorSimulator<P>(_ns); - editorList2 = new ArrayList<EditorObject<P>>(); + transList = new ArrayList<TranslaterImp1>(); + selector = new SelectorSimulator<REPCommand>(_ns); + editorList2 = new ArrayList<EditorObject<REPCommand>>(); + waitingList = new LinkedList<PacketSet>(); + //sendList = new ArrayList<LinkedList<REPCommand>>(); } protected void checkAccept(){ - ChannelSimulator<P> cs; + ChannelSimulator<REPCommand> cs; while((cs=ns.accept())!=null){ csList.add(cs); - editorList.add(new TranslaterImp1(editorList.size())); - editorList2.add(new EditorObject<P>(editorList2.size(), cs, new TranslaterImp1(editorList2.size()))); + transList.add(new TranslaterImp1(transList.size())); + editorList2.add(new EditorObject<REPCommand>(editorList2.size(), cs, new TranslaterImp1(editorList2.size()))); + //sendList.add(new LinkedList<REPCommand>()); registerChannel (selector, cs, SelectionKeySimulator.OP_READ); } } - private void registerChannel(SelectorSimulator selector2, ChannelSimulator<P> cs, int key) { - selector.register(cs); + private void registerChannel(SelectorSimulator selector2, ChannelSimulator<REPCommand> cs, int key) { + //selector.register(cs); + REPHandler handler = new REPHandlerImpl(this); + selector.register(cs, SelectionKeySimulator.OP_READ, handler); } public void run(){ ns.writeLog("SessionManager start.", 1); + mainLoop(); + + ns.writeLog("SessionManager finish.", 1); + } + + private void mainLoop() { /* Main Loop */ while(running){ selector.select(); - for(SelectionKeySimulator<P> key : selector.selectedKeys()){ + select(); + } + } + + private void select() { + for(SelectionKeySimulator<REPCommand> key : selector.selectedKeys()){ + + if(key.isAcceptable()){ + ChannelSimulator<REPCommand> channel = key.channel(); + channel = channel.accept(); + REPHandler handler = new REPHandlerImpl(this); + selector.register(channel, SelectionKeySimulator.OP_READ, handler); - if(key.isAcceptable()){ - ChannelSimulator<P> channel = key.channel(); - channel = channel.accept(); - selector.register(channel); - - }else if(key.isReadable()){ - ChannelSimulator<P> channel = key.channel(); - P packet = channel.read(); - REPCommand command = unpack(packet); - manage(channel, command); - } + }else if(key.isReadable()){ + + REPHandler handler = (REPHandler)key.attachment(); + handler.handle(key); + } } - - ns.writeLog("SessionManager finish.", 1); } - private void manage(ChannelSimulator<P> channel, REPCommand command) { + void manage(ChannelSimulator<REPCommand> channel, REPCommand command) { // コマンドの処理 int eid = getEID(channel); @@ -108,7 +125,7 @@ nextEditor.send(command); if(command.eid == nextEditor.eid){ //quitコマンドが一周してきた - if(editorList.get(nextEditor.eid).isEmpty()) { + if(transList.get(nextEditor.eid).isFinished()) { command.setCMD(REP.SMCMD_QUIT_2); }else{ System.out.println("has Unmerged Commands."); @@ -117,35 +134,30 @@ } private void quit2(EditorObject nextEditor, REPCommand command, int fromPort) { - - if(command.eid == nextEditor.eid){ - //quitコマンドが一周してきた - command.setCMD(REP.SMCMD_QUIT_2); - } nextEditor.send(command); if(startQuit2 == -1) startQuit2 = fromPort; else if(startQuit2 == nextEditor.eid) ;//finish(); } private void translate(int eid, int neid, REPCommand command) { + + int peid = (eid + editorList2.size() - 1)%editorList2.size(); - ChannelSimulator<P> channel = getChannel(eid); - ChannelSimulator<P> nextChannel = getChannel(neid); + ChannelSimulator<REPCommand> channel = getChannel(eid); + ChannelSimulator<REPCommand> nextChannel = getChannel(neid); + ChannelSimulator<REPCommand> prevChannel = getChannel(peid); EditorObject editor = getEditor(eid); + EditorObject nextEditor = getEditor(neid); if(command.eid == eid){ if(checkOwnCommand(command)){ //エディタからの編集コマンドが戻ってきた場合、マージしてエディタへ反映 - if(eid == 2)System.out.println("returned Editor Command : " + command); - REPCommand[] cmds = editorList.get(eid).catchOwnCommand(command); + //Hndlerを切り替える + setMergeState(channel, selector); + if(eid == 0)System.out.println("returned Editor Command : " + command); + REPCommand[] cmds = transList.get(eid).catchOwnCommand(command); for(REPCommand cmd : cmds){ - try { - Thread.sleep(50); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } REPCommand tmp2 = new REPCommand(cmd); tmp2.eid = REP.MERGE_EID; channel.write(pack(tmp2)); @@ -153,30 +165,45 @@ }else{ //エディタからの新たな編集コマンド - if(eid == 2)System.out.println("new Editor Command : " + command); - editorList.get(eid).transSendCmd(command); - nextChannel.write(pack(command)); + if(eid == 0)System.out.println("new Editor Command : " + command); + transList.get(eid).transSendCmd(command); + nextEditor.send(command); } }else if(command.eid == REP.MERGE_EID){ //マージのときにエディタからの割り込みがないか確認 - if(eid == 2)System.out.println(" Merged Command : " + command); - if(editorList.get(eid).checkMergeConflict(command)){ - LinkedList<REPCommand> againList = editorList.get(eid).getMergeAgain(); + if(eid == 0)System.out.println(" Merged Command : " + command); + if(transList.get(eid).checkMergeConflict(command)){ + LinkedList<REPCommand> againList = transList.get(eid).getMergeAgain(); for(REPCommand againCommand : againList){ channel.write(pack(againCommand)); - if(eid == 2)System.out.println(" reMerge : " + againCommand); + if(false)System.out.println(" reMerge : " + againCommand); } + }else{ + //マージが終了 + //Handlerを元に戻す + if(!editor.isMerging()) setNormalState(channel, selector); } }else{ //他のエディタからのコマンドはマージャへ追加し次のエディタへ送信する - REPCommand[] cmds = editorList.get(eid).transReceiveCmd(command); + REPCommand[] cmds = transList.get(eid).transReceiveCmd(command); for(REPCommand cmd : cmds){ - nextChannel.write(pack(cmd)); + nextEditor.send(cmd); } + } + } - } + private void setMergeState(ChannelSimulator<REPCommand> channel, SelectorSimulator<REPCommand> selector2) { + // TODO Auto-generated method stub + SelectionKeySimulator key = channel.keyFor(selector2); + key.attach(new REPHandlerInMerge(this)); + } + + private void setNormalState(ChannelSimulator<REPCommand> channel, SelectorSimulator<REPCommand> selector2) { + // TODO Auto-generated method stub + SelectionKeySimulator key = channel.keyFor(selector2); + key.attach(new REPHandlerImpl(this)); } private EditorObject getEditor(int eid) { @@ -188,7 +215,7 @@ return null; } - private int getEID(ChannelSimulator<P> channel) { + private int getEID(ChannelSimulator<REPCommand> channel) { int eid = 0; for(EditorObject editor : editorList2){ if(editor.getChannel() == channel){ @@ -198,9 +225,9 @@ return eid; } - private ChannelSimulator<P> getChannel(int eid) { - ChannelSimulator<P> channel = null; - for(EditorObject<P> editor : editorList2){ + private ChannelSimulator<REPCommand> getChannel(int eid) { + ChannelSimulator<REPCommand> channel = null; + for(EditorObject<REPCommand> editor : editorList2){ if(editor.getEID() == eid){ channel = editor.getChannel(); } @@ -210,7 +237,7 @@ private boolean checkOwnCommand(REPCommand command) { boolean ownCommand = false; - LinkedList<REPCommand> sentCommands = editorList.get(command.eid).getSentCmds(); + LinkedList<REPCommand> sentCommands = transList.get(command.eid).getSentCmds(); if(sentCommands.size() > 0){ if(sentCommands.get(0).seq == command.seq){ ownCommand = true; @@ -219,19 +246,21 @@ return ownCommand; } - private P pack(REPCommand command) { - P cmd = (P) new REPCommand(command); - return cmd; + private REPCommand pack(REPCommand command) { + return new REPCommand(command); + } + + REPCommand unpack(REPCommand packet) { + return new REPCommand(packet); } - private REPCommand unpack(P packet) { - REPCommand cmd = null; - if(packet instanceof REPCommand){ - cmd = (REPCommand) packet; - }else{ - ns.writeLog("Error!! :Packet type is NOT REPCommand!", 1); - } - return new REPCommand(cmd); + public void addWaitingCommand(PacketSet set) { + // TODO Auto-generated method stub + waitingList.add(set); + } + + public void doWaiting() { + } }
--- a/src/pathfinder/mergetest/TestMerger.java Mon Aug 25 15:53:03 2008 +0900 +++ b/src/pathfinder/mergetest/TestMerger.java Tue Aug 26 18:15:00 2008 +0900 @@ -9,7 +9,7 @@ protected NetworkSimulator<REPCommand> ns=null; protected LinkedList<EditorSimulator> editors; protected SeMaSimulator<REPCommand> sema; - protected UsersSimulator users; + protected UserSimulator users; public TestMerger(){ editors = new LinkedList<EditorSimulator>();
--- a/src/pathfinder/mergetest/TestMerger2.java Mon Aug 25 15:53:03 2008 +0900 +++ b/src/pathfinder/mergetest/TestMerger2.java Tue Aug 26 18:15:00 2008 +0900 @@ -8,8 +8,8 @@ static public int cmdNO[] = { REP.REPCMD_INSERT, REP.REPCMD_REPLACE, REP.REPCMD_DELETE }; protected NetworkSimulator<REPCommand> ns=null; protected LinkedList<EditorSimulatorWithoutMerger> editors; - protected SessionManagerSimulatorWithMerger<REPCommand> sema; - protected LinkedList<UsersSimulator> users = new LinkedList<UsersSimulator>(); + protected SessionManagerSimulatorWithMerger sema; + protected LinkedList<UserSimulator> users = new LinkedList<UserSimulator>(); static private String[] text0 = { "aaa", "bbb", "ccc", "ddd", "eee", @@ -55,10 +55,10 @@ if (sema!=null) sema.init(); if (sema!=null) sema.start(); - for(UsersSimulator u: users){ + for(UserSimulator u: users){ u.start(); } - for(UsersSimulator u: users){ + for(UserSimulator u: users){ try { u.join(); } catch (InterruptedException e) { } @@ -98,7 +98,7 @@ /* create NetworkSimulator, and SessionManager if it's required. */ if (sm){ ns = new NetworkSimulatorwithSeMa<REPCommand>(); - sema = new SessionManagerSimulatorWithMerger<REPCommand>(ns, ne, 0); + sema = new SessionManagerSimulatorWithMerger(ns, ne, 0); } else { ns = new NetworkSimulatorwithoutSeMa<REPCommand>(); sema = null; @@ -107,7 +107,7 @@ /* create UsersSimulator. */ for(int i = 0; i < ne; i++){ - users.add(new UsersSimulator(ns, i, userCommand(i))); + users.add(new UserSimulator(ns, i, userCommand(i))); } /* create ne Editors and np commands. */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pathfinder/mergetest/UserSimulator.java Tue Aug 26 18:15:00 2008 +0900 @@ -0,0 +1,45 @@ +package pathfinder.mergetest; + +import java.util.LinkedList; + +import remoteeditor.command.REPCommand; + +public class UserSimulator extends Thread { + private NetworkSimulator<REPCommand> ns; + private LinkedList<REPCommand> cmds; + private int eid; + + public UserSimulator(NetworkSimulator<REPCommand> ns2, int _eid, LinkedList<REPCommand> _cmds) { + ns = ns2; + eid = _eid; + cmds = _cmds; + } + + public void run(){ + ns.writeLog("UsersSimulator start.", 1); + ChannelSimulator<REPCommand> channel = ns.getAcceptedSession(eid); + while(cmds.size()>0){ +// try { +// Thread.sleep(1000); +// } catch (InterruptedException e) { +// // TODO Auto-generated catch block +// e.printStackTrace(); +// } + REPCommand cmd0 = createCmd(); + channel.write(cmd0); + } + + ns.writeLog("UsersSimulator finish.", 1); + } + + private REPCommand createCmd(){ + REPCommand cmd = cmds.remove(0); + return cmd; + } + + public void init() { + // TODO Auto-generated method stub + + } + +}
--- a/src/pathfinder/mergetest/UsersSimulator.java Mon Aug 25 15:53:03 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -package pathfinder.mergetest; - -import java.util.LinkedList; - -import remoteeditor.command.REPCommand; - -public class UsersSimulator extends Thread { - private NetworkSimulator<REPCommand> ns; - private LinkedList<REPCommand> cmds; - private int eid; - - public UsersSimulator(NetworkSimulator<REPCommand> ns2, int _eid, LinkedList<REPCommand> _cmds) { - ns = ns2; - eid = _eid; - cmds = _cmds; - } - - public void run(){ - ns.writeLog("UsersSimulator start.", 1); - ChannelSimulator<REPCommand> channel = ns.getAcceptedSession(eid); - while(cmds.size()>0){ - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - REPCommand cmd0 = createCmd(); - channel.write(cmd0); - } - - ns.writeLog("UsersSimulator finish.", 1); - } - - private REPCommand createCmd(){ - REPCommand cmd = cmds.remove(0); - return cmd; - } - - public void init() { - // TODO Auto-generated method stub - - } - -}
--- a/src/sample/merge/TranslaterImp1.java Mon Aug 25 15:53:03 2008 +0900 +++ b/src/sample/merge/TranslaterImp1.java Tue Aug 26 18:15:00 2008 +0900 @@ -279,10 +279,17 @@ return returnCommand; } - public boolean isEmpty() { + public boolean isFinished() { if(unMergedCmds.size() > 0) return false; if(sentMergedList.size() > 0) return false; if(sentCmds.size() > 0) return false; return true; } + + public boolean isMerging() { + // TODO Auto-generated method stub + if(sentMergedList.size() > 0) return true; + return false; + } + }