# HG changeset patch
# User pin
# Date 1219742100 -32400
# Node ID 1a2269c820dfc5bc990208d6eae04aaf2df37cfb
# Parent 7ebd30e5e385b789679ac6d2104c763bd6ed055e
*** empty log message ***
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/ChannelSimulator.java
--- 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
{
private BlockingQueue
qread;
private BlockingQueue
qwrite;
@@ -91,5 +93,11 @@
return !qread.isEmpty();
}
+ public SelectionKeySimulator keyFor(SelectorSimulator selector2) {
+ // TODO Auto-generated method stub
+
+ return selector2.getKey(this);
+ }
+
}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/EditorObject.java
--- 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 channel;
private TranslaterImp1 translater;
private List sentList;
+ private List sendList;
public EditorObject(int i, ChannelSimulator cs) {
// TODO Auto-generated constructor stub
@@ -25,6 +27,7 @@
channel = cs;
translater = imp1;
sentList = new ArrayList();
+ sendList = new LinkedList();
}
public ChannelSimulator 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();
+ }
+
}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/PacketSet.java
--- /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 channel;
+ private REPCommand packet;
+
+ public PacketSet(ChannelSimulator channel, REPCommand packet) {
+ // TODO Auto-generated constructor stub
+ this.channel = channel;
+ this.packet = packet;
+ }
+
+}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/REPHandler.java
--- /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 key);
+
+}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/REPHandlerDoWaiting.java
--- /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 key) {
+ session.doWaiting();
+ }
+
+}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/REPHandlerImpl.java
--- /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 key) {
+ // TODO Auto-generated method stub
+ ChannelSimulator channel = (ChannelSimulator) key.channel();
+ REPCommand packet = channel.read();
+ REPCommand command = session.unpack(packet);
+ session.manage(channel, command);
+ }
+
+}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/REPHandlerInMerge.java
--- /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 packetList = new LinkedList();
+
+ public REPHandlerInMerge(SessionManagerSimulatorWithMerger session) {
+ // TODO Auto-generated constructor stub
+ this.session = session;
+ }
+
+ public void handle(SelectionKeySimulator key) {
+ // TODO Auto-generated method stub
+ ChannelSimulator channel = (ChannelSimulator) key.channel();
+ REPCommand packet = channel.read();
+ session.addWaitingCommand(new PacketSet(channel, packet));
+ REPCommand command = session.unpack(packet);
+ session.manage(channel, command);
+ }
+
+}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/SelectionKeySimulator.java
--- 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 channel;
+ private Object attachment;
public SelectionKeySimulator(ChannelSimulator
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;
+ }
+
}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/SelectorSimulator.java
--- 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
(cs));
return key;
}
+
+ public SelectionKeySimulator
register(ChannelSimulator
cs, int opt, Object handler){
+ SelectionKeySimulator
key = new SelectionKeySimulator
(cs);
+ key.attach(handler);
+ keyList.add(key);
+ return key;
+ }
public ArrayList> selectedKeys() {
return selectedKeys;
}
+
+ public SelectionKeySimulator getKey(ChannelSimulator channel){
+ for(SelectionKeySimulator key : keyList){
+ if(key.channel() == channel)
+ return key;
+ }
+ return null;
+ }
}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/SessionManagerSimulatorWithMerger.java
--- 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 extends SeMaSimulator
{
+public class SessionManagerSimulatorWithMerger extends SeMaSimulator {
- private List editorList;
- private SelectorSimulator selector;
- private List> editorList2;
+ private List transList;
+ private SelectorSimulator selector;
+ private List> editorList2;
private int startQuit2;
+ //private List> sendList;
+ private List waitingList;
- public SessionManagerSimulatorWithMerger(NetworkSimulator _ns) {
+ public SessionManagerSimulatorWithMerger(NetworkSimulator _ns) {
super(_ns);
}
- public SessionManagerSimulatorWithMerger(NetworkSimulator ns, int ne) {
+ public SessionManagerSimulatorWithMerger(NetworkSimulator ns, int ne) {
super(ns, ne);
}
- public SessionManagerSimulatorWithMerger(NetworkSimulator _ns, int max_client, int max_packet) {
+ public SessionManagerSimulatorWithMerger(NetworkSimulator _ns, int max_client, int max_packet) {
super(_ns, max_client, max_packet);
- editorList = new ArrayList();
- selector = new SelectorSimulator(_ns);
- editorList2 = new ArrayList>();
+ transList = new ArrayList();
+ selector = new SelectorSimulator(_ns);
+ editorList2 = new ArrayList>();
+ waitingList = new LinkedList();
+ //sendList = new ArrayList>();
}
protected void checkAccept(){
- ChannelSimulator cs;
+ ChannelSimulator cs;
while((cs=ns.accept())!=null){
csList.add(cs);
- editorList.add(new TranslaterImp1(editorList.size()));
- editorList2.add(new EditorObject(editorList2.size(), cs, new TranslaterImp1(editorList2.size())));
+ transList.add(new TranslaterImp1(transList.size()));
+ editorList2.add(new EditorObject(editorList2.size(), cs, new TranslaterImp1(editorList2.size())));
+ //sendList.add(new LinkedList());
registerChannel (selector, cs, SelectionKeySimulator.OP_READ);
}
}
- private void registerChannel(SelectorSimulator selector2, ChannelSimulator cs, int key) {
- selector.register(cs);
+ private void registerChannel(SelectorSimulator selector2, ChannelSimulator 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 key : selector.selectedKeys()){
+ select();
+ }
+ }
+
+ private void select() {
+ for(SelectionKeySimulator key : selector.selectedKeys()){
+
+ if(key.isAcceptable()){
+ ChannelSimulator channel = key.channel();
+ channel = channel.accept();
+ REPHandler handler = new REPHandlerImpl(this);
+ selector.register(channel, SelectionKeySimulator.OP_READ, handler);
- if(key.isAcceptable()){
- ChannelSimulator channel = key.channel();
- channel = channel.accept();
- selector.register(channel);
-
- }else if(key.isReadable()){
- ChannelSimulator
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
channel, REPCommand command) {
+ void manage(ChannelSimulator 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 channel = getChannel(eid);
- ChannelSimulator
nextChannel = getChannel(neid);
+ ChannelSimulator channel = getChannel(eid);
+ ChannelSimulator nextChannel = getChannel(neid);
+ ChannelSimulator 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 againList = editorList.get(eid).getMergeAgain();
+ if(eid == 0)System.out.println(" Merged Command : " + command);
+ if(transList.get(eid).checkMergeConflict(command)){
+ LinkedList 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 channel, SelectorSimulator selector2) {
+ // TODO Auto-generated method stub
+ SelectionKeySimulator key = channel.keyFor(selector2);
+ key.attach(new REPHandlerInMerge(this));
+ }
+
+ private void setNormalState(ChannelSimulator channel, SelectorSimulator 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 channel) {
+ private int getEID(ChannelSimulator channel) {
int eid = 0;
for(EditorObject editor : editorList2){
if(editor.getChannel() == channel){
@@ -198,9 +225,9 @@
return eid;
}
- private ChannelSimulator getChannel(int eid) {
- ChannelSimulator
channel = null;
- for(EditorObject
editor : editorList2){
+ private ChannelSimulator getChannel(int eid) {
+ ChannelSimulator channel = null;
+ for(EditorObject editor : editorList2){
if(editor.getEID() == eid){
channel = editor.getChannel();
}
@@ -210,7 +237,7 @@
private boolean checkOwnCommand(REPCommand command) {
boolean ownCommand = false;
- LinkedList sentCommands = editorList.get(command.eid).getSentCmds();
+ LinkedList 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() {
+
}
}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/TestMerger.java
--- 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 ns=null;
protected LinkedList editors;
protected SeMaSimulator sema;
- protected UsersSimulator users;
+ protected UserSimulator users;
public TestMerger(){
editors = new LinkedList();
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/TestMerger2.java
--- 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 ns=null;
protected LinkedList editors;
- protected SessionManagerSimulatorWithMerger sema;
- protected LinkedList users = new LinkedList();
+ protected SessionManagerSimulatorWithMerger sema;
+ protected LinkedList users = new LinkedList();
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();
- sema = new SessionManagerSimulatorWithMerger(ns, ne, 0);
+ sema = new SessionManagerSimulatorWithMerger(ns, ne, 0);
} else {
ns = new NetworkSimulatorwithoutSeMa();
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. */
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/UserSimulator.java
--- /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 ns;
+ private LinkedList cmds;
+ private int eid;
+
+ public UserSimulator(NetworkSimulator ns2, int _eid, LinkedList _cmds) {
+ ns = ns2;
+ eid = _eid;
+ cmds = _cmds;
+ }
+
+ public void run(){
+ ns.writeLog("UsersSimulator start.", 1);
+ ChannelSimulator 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
+
+ }
+
+}
diff -r 7ebd30e5e385 -r 1a2269c820df src/pathfinder/mergetest/UsersSimulator.java
--- 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 ns;
- private LinkedList cmds;
- private int eid;
-
- public UsersSimulator(NetworkSimulator ns2, int _eid, LinkedList _cmds) {
- ns = ns2;
- eid = _eid;
- cmds = _cmds;
- }
-
- public void run(){
- ns.writeLog("UsersSimulator start.", 1);
- ChannelSimulator 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
-
- }
-
-}
diff -r 7ebd30e5e385 -r 1a2269c820df src/sample/merge/TranslaterImp1.java
--- 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;
+ }
+
}