changeset 99:8f98f1ff1b2f

*** empty log message ***
author pin
date Sat, 22 Dec 2007 15:14:42 +0900
parents dd811063bbc5
children 00e0deb365f9
files src/pathfinder/BlockingQ/ChannelSimulator.java src/pathfinder/BlockingQ/EditorSimulator.java src/pathfinder/BlockingQ/NetworkSimulator.java src/pathfinder/BlockingQ/SeMaSimulator.java src/pathfinder/BlockingQ/TestMerger.java src/pathfinder/ChannelSimulator.java src/pathfinder/EditorEmulator.java src/pathfinder/EditorEmulator2.java src/pathfinder/NetworkSimulator.java src/pathfinder/SeMaEmulator.java src/pathfinder/Test.java src/pathfinder/TestMerger.java src/pathfinder/TestMerger2.java src/pathfinder/TestNetwork.java src/pathfinder/Text.java src/pathfinderQ/ChannelSimulator.java src/pathfinderQ/EditorEmulator2.java src/pathfinderQ/NetworkSimulator.java src/pathfinderQ/SeMaEmulator.java src/pathfinderQ/TestMerger2.java
diffstat 20 files changed, 0 insertions(+), 1551 deletions(-) [+]
line wrap: on
line diff
--- a/src/pathfinder/BlockingQ/ChannelSimulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-package pathfinder.BlockingQ;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-public class ChannelSimulator<P> {
-	private BlockingQueue<P> q0;
-	private BlockingQueue<P> q1;
-
-	private NetworkSimulator<P> ns;
-
-	public ChannelSimulator(NetworkSimulator<P> _ns){
-		this(new LinkedBlockingQueue<P>(), new LinkedBlockingQueue<P>(), _ns);
-	}
-	public ChannelSimulator(BlockingQueue<P> _a, BlockingQueue<P> _b, NetworkSimulator<P> _ns){
-		q0 = _a;
-		q1 = _b;
-		ns = _ns;
-	}
-
-	public P read() throws InterruptedException {
-		return q0.take();
-	}
-
-	public void write(P p) throws InterruptedException{
-		synchronized (ns){
-			q1.put(p);
-			ns.notifyAll();
-		}
-	}
-
-	public ChannelSimulator<P> getServerChannel() {
-		return new ChannelSimulator<P>(q1, q0,ns);
-	}
-	
-	public P poll() {
-		return q0.poll();
-	}
-}
--- a/src/pathfinder/BlockingQ/EditorSimulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-package pathfinder.BlockingQ;
-
-import java.util.Queue;
-
-import remoteeditor.command.REPCommand;
-import remoteeditor.network.REP;
-import sample.merge.Translater;
-
-public class EditorSimulator extends Thread{
-	private int eid;
-	private int seq;
-	private boolean isOwner;
-	private NetworkSimulator<REPCommand> ns;
-	private ChannelSimulator<REPCommand> cs;
-	private Queue<REPCommand> CmdList;
-	private Translater translater;
-	private pathfinder.Text text;
-	private boolean running=true;
-
-	public EditorSimulator(int _eid, NetworkSimulator<REPCommand> _ns, Queue<REPCommand> q, String _name) {
-		super(_name);
-		eid = _eid;
-		ns = _ns;
-		CmdList = q;
-		translater = new Translater(_eid);
-		text = new pathfinder.Text();
-		cs = ns.connect();
-	}
-
-	public void setOwner(boolean f){
-		isOwner = f;
-	}
-	synchronized public void finish(){
-		running = false;
-	}
-
-	public void run(){
-		System.out.println("Editor"+eid+" start.");
-
-		// Send All Command that is included CmdList.
-		try {
-			sendAllCommand();
-		} catch (InterruptedException e1) {
-			e1.printStackTrace();
-			running=false;
-		}
-
-		// MainLoop, 
-		while(running){
-			REPCommand cmd;
-			try {
-				cmd = cs.read();
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-				continue;
-			}
-
-			//終了条件
-			if (checkQuit(cmd)){
-				System.out.println("\tEditor"+eid+" catch QUIT command emited by itself.");
-				translater.transReceiveCmd(cmd);
-				running=false; break;
-			}
-			System.out.println("\tEditor"+eid+" catch command:>> "+cmd.toString());
-			cmd = translater.transReceiveCmd(cmd);
-			if (isOwner&&cmd!=null) cmd.setThroughMaster(true);
-			if (cmd==null) continue;
-
-			text.edit(cmd);
-			try {
-				cs.write(cmd);
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-				continue;
-			}
-		}
-
-		System.out.println("Editor"+eid+" finish.");
-	}
-
-	private void sendAllCommand() throws InterruptedException {
-		for (REPCommand cmd: CmdList){
-			cmd.seq = seq;
-			cmd.eid = eid;
-			cmd.setString("this is inserted or replaced by Editor"+eid+":"+seq);
-			cmd = translater.transSendCmd(cmd);
-			if (isOwner) cmd.setThroughMaster(true);
-			text.edit(cmd);
-			cs.write(cmd);
-			seq++;
-		}
-
-		// Send Quit Command
-		cs.write( translater.transSendCmd( new REPCommand(REP.SMCMD_QUIT, 0, eid, seq++, 0, 0, "QUIT by Editor"+eid)));
-	}
-
-	private boolean checkQuit(REPCommand cmd) {
-		// 最初に全部のコマンドを送信するから、自分のQUITが来るのは最後
-		return (cmd.eid==eid && cmd.cmd==REP.SMCMD_QUIT);
-	}
-
-	public pathfinder.Text getText(){
-		return text;
-	}
-}
--- a/src/pathfinder/BlockingQ/NetworkSimulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-package pathfinder.BlockingQ;
-
-import java.util.LinkedList;
-import java.util.Queue;
-
-public class NetworkSimulator<P> {
-
-	/** Waiting connectionRequest to be accepted by SessionManager. */
-	private Queue<ChannelSimulator<P>> acceptList;
-	/** Established connection */
-	private Queue<ChannelSimulator<P>> connectedList;
-
-	public NetworkSimulator(){
-		acceptList = new LinkedList<ChannelSimulator<P>>();
-		connectedList = new LinkedList<ChannelSimulator<P>>();
-	}
-
-	/**
-	 * Establish connection. It's called by SeMa.
-	 * @return
-	 */
-	public ChannelSimulator<P> accept(){
-		ChannelSimulator<P> cs = acceptList.poll();
-		if (cs==null) return null;
-
-		connectedList.offer(cs);
-		return cs.getServerChannel();
-	}
-
-	/**
-	 * Request to connect.
-	 * Client editor use this method to connect SeMa. 
-	 * @param cs
-	 */
-	public ChannelSimulator<P> connect(){
-		ChannelSimulator<P> cs = new ChannelSimulator<P>(this);
-		acceptList.offer(cs);
-		return cs;
-	}
-}
--- a/src/pathfinder/BlockingQ/SeMaSimulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-package pathfinder.BlockingQ;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SeMaSimulator<P> extends Thread {
-	private int MAX_PACKET;
-	private int MAX_CLIENT;
-	private boolean running=true;
-	private NetworkSimulator<P> ns;
-	private List<ChannelSimulator<P>> csList;
-
-	public SeMaSimulator(NetworkSimulator<P> _ns, int max_client, int max_packet){
-		ns = _ns;
-		MAX_CLIENT = max_client;
-		MAX_PACKET = max_packet;
-		csList = new ArrayList<ChannelSimulator<P>>();
-	}
-	public SeMaSimulator(NetworkSimulator<P> _ns){
-		this(_ns, 2, 0);
-	}
-
-	synchronized public void finish(){
-		synchronized(ns){
-			running = false;
-			ns.notify();
-		}
-	}
-
-	/**
-	 * Check whether the NetworkSimulator hold waiting connections.
-	 */
-	private void checkAccept(){
-		ChannelSimulator<P> cs;
-		while((cs=ns.accept())!=null){
-			csList.add(cs);
-		}
-	}
-
-	public void run(){
-		int i=0;
-		int count=0;
-		P packet;
-
-		while(csList.size()<MAX_CLIENT){ checkAccept(); Thread.yield(); }
-		System.out.println("SessionManager start.");
-
-		/* Main Loop */
-		ChannelSimulator<P> cs = csList.get(i);
-		while(running
-				&& (MAX_PACKET==0 || count<MAX_PACKET)){
-			synchronized(ns){
-				int prev_i=i;
-				while((packet=cs.poll())==null && running){
-					i = (i+1)%csList.size();   // i++
-					cs = csList.get(i);        // 次のChennelをゲット
-					if(i==prev_i) try { ns.wait(); } catch (InterruptedException e) { e.printStackTrace(); }
-				}
-			}
-			if(!running) break;
-
-			System.out.println("SeMa pass packet to "+i+":>> "+packet.toString());
-			i = (i+1)%csList.size();   // i++
-			cs = csList.get(i);        // 次のChennelをゲット
-
-			// readできていたならそれを書き込む
-			try {
-				cs.write(packet);
-			} catch (InterruptedException e) {
-				System.out.println("SeMa cannot write!!");
-				e.printStackTrace();
-			}
-			count++;
-		}
-/*
-		ChannelSimulator<P> cs = csList.get(i);
-		while(running
-				&& MAX_PACKET==0 || count<MAX_PACKET){
-			packet=cs.poll();          // [i]からread
-			//if(packet!=null) System.out.println("SeMa catch packet to "+i+":>> "+packet.toString());
-			i = (i+1)%csList.size();   // i++
-			cs = csList.get(i);        // 次のChennelをゲット
-			if (packet!=null) {
-				System.out.println("SeMa pass packet to "+i+":>> "+packet.toString());
-				cs.write(packet);      // readできていたならそれを書き込む
-				count++;
-			}
-			//if (i==0) checkAccept();   //全部回ったらaccept待ちをチェック
-		}
-*/
-		System.out.println("SessionManager finish.");
-	}
-}
--- a/src/pathfinder/BlockingQ/TestMerger.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,155 +0,0 @@
-package pathfinder.BlockingQ;
-
-import java.util.LinkedList;
-import remoteeditor.command.REPCommand;
-import remoteeditor.network.REP;
-
-public class TestMerger {
-	static public int cmdNO[] = { REP.REPCMD_INSERT, REP.REPCMD_REPLACE, REP.REPCMD_DELETE };
-	private int N_editor;
-
-	private NetworkSimulator<REPCommand> ns;
-	private SeMaSimulator<REPCommand> sm;
-	private LinkedList<EditorSimulator> editors;
-	private int N_packet;
-
-	public TestMerger(int editor, int packet){
-		N_editor = editor;
-		N_packet = packet;
-		ns = new NetworkSimulator<REPCommand>();
-		sm = new SeMaSimulator<REPCommand>(ns, N_editor, 0);
-		editors = new LinkedList<EditorSimulator>();
-	}
-
-	public static void main(String[] args){
-		TestMerger tm;
-		tm = new TestMerger(2, 3);
-		//tm.init();
-		tm.test2cmd();
-		//tm.test1cmd();
-		//tm.test0cmd();
-		tm.startTest();
-
-		//tm.printAllTexts();
-		//if (!tm.checkCS())
-		//	System.out.println("Error!! :some ChannelSimulator still have packet!");
-		//if (!tm.checkEquality())
-		//	System.out.println("Error!! :all Editor's text is NOT mutch!");
-
-	}
-
-	/*
-	private void init(){
-		for (int i=0; i<N_editor; i++){
-			int j;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			// 各エディタが送信するコマンド列を生成
-			for(j=0; j<N_packet; j++) {
-				REPCommand cmd = new REPCommand(cmdNO[Verify.random(2)],
-				                                0, i, j,
-				                                10, //Verify.random(text.size()-1), //size-1?
-				                                0, null);
-				cmds.add( cmd);
-			}
-			EditorEmulator2 ee = new EditorEmulator2(i, ns, cmds, "Editor"+i); 
-			editors.add(ee);
-		}
-	}
-	*/
-	private void test2cmd(){
-		for (int i=0; i<N_editor; i++){
-			int j=0;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			// 各エディタが送信するコマンド列を生成
-
-			String str = "created by Editor"+i+":"+j;
-			REPCommand cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-			str = "created by Editor"+i+":"+j;
-			cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-			str = "created by Editor"+i+":"+j;
-			cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-
-			EditorSimulator ee = new EditorSimulator(i, ns, cmds, "Editor"+i);
-			if(i==0) ee.setOwner(true);
-			editors.add(ee);
-		}
-	}
-
-
-	private void test1cmd(){
-		for (int i=0; i<N_editor; i++){
-			int j=0;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			//各エディタが送信するコマンド列を生成
-			String str = "Editor"+i+":"+j;
-			REPCommand cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-			EditorSimulator ee = new EditorSimulator(i, ns, cmds, "Editor"+i); 
-			if(i==0) ee.setOwner(true);
-			editors.add(ee);
-		}
-	}
-
-	private void test0cmd(){
-		for (int i=0; i<N_editor; i++){
-			int j=0;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			//各エディタが送信するコマンド列を生成
-			EditorSimulator ee = new EditorSimulator(i, ns, cmds, "Editor"+i); 
-			if(i==0) ee.setOwner(true);
-			editors.add(ee);
-		}
-	}
-
-	private void startTest() {
-		for (EditorSimulator ee: editors){
-			ee.start();
-		}
-		sm.start();
-
-		try {
-			for (EditorSimulator ee: editors){
-				//ee.finish();
-				ee.join();
-			}
-			sm.finish();
-			sm.join();
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-	}
-
-	private void printAllTexts(){
-		for(EditorSimulator ee: editors){
-			System.out.println("--"+ee.getName()+"------------------------");
-			ee.getText().printAllText();
-		}
-	}
-
-	private boolean checkEquality(){
-		/*
-		Text ee0 = editors.remove().getText();
-		return editors.remove().getText().equals(ee0);
-		*/
-		pathfinder.Text text0 = editors.element().getText();
-		for(EditorSimulator ee: editors){
-			if (!text0.equals(ee.getText())) return false;
-		}
-		return true;
-	}
-}
--- a/src/pathfinder/ChannelSimulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-package pathfinder;
-
-import java.util.LinkedList;
-import java.util.Queue;
-
-public class ChannelSimulator<P> {
-	private NetworkSimulator<P> ns;
-	private Queue<P> q0;
-	private Queue<P> q1;
-/*
-	public ChannelSimulator(NetworkSimulator<P> ns){
-		q0 = new LinkedList<P>(); 
-		q1 = new LinkedList<P>(); 
-		this.ns = ns;
-	}
-*/
-	public ChannelSimulator(NetworkSimulator<P> _ns){
-		this(new LinkedList<P>(), new LinkedList<P>(), _ns);
-	}
-	public ChannelSimulator(Queue<P> _a, Queue<P> _b, NetworkSimulator<P> _ns){
-		q0 = _a;
-		q1 = _b;
-		ns = _ns;
-	}
-
-	public P read(){
-		return ns.read(q0);
-	}
-
-	public boolean write(P p){
-		return ns.write(q1,p);
-	}
-
-	public ChannelSimulator<P> getServerChannel() {
-		return new ChannelSimulator<P>(q1, q0,ns);
-	}
-}
--- a/src/pathfinder/EditorEmulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-package pathfinder;
-
-import remoteeditor.command.REPCommand;
-import remoteeditor.network.REP;
-import sample.merge.Translater;
-import gov.nasa.jpf.jvm.Verify;
-
-public class EditorEmulator extends Thread{
-	private int eid;
-	//private int MAX_CMD;
-	private int MAX_RCV_CMD;
-	private Thread cc;
-	private NetworkSimulator<REPCommand> ns;
-	private ChannelSimulator<REPCommand> cs;
-	private Translater translater;
-	private Text text;
-	private boolean running=true;
-
-	public EditorEmulator(int _eid, NetworkSimulator<REPCommand> _ns, int maxRcvCmd, int maxSndCmd) {
-		eid = _eid;
-		ns = _ns;
-		//MAX_CMD = max_cmd;
-		MAX_RCV_CMD = maxRcvCmd;
-		translater = new Translater(_eid);
-		text = new Text();
-		cs = ns.connect();
-		cc = new AutoCmdSender(text, cs, translater, _eid, maxSndCmd);
-	}
-	public EditorEmulator(int _eid, NetworkSimulator<REPCommand> _ns) {
-		this(_eid, _ns, 0, 3);
-	}
-
-	synchronized public void finish(){
-		running = false;
-	}
-
-	public void run(){
-		int count=0;
-		REPCommand cmd;
-		cc.start();
-		System.out.println("Editor"+eid+" start.");
-
-		while(running
-			  && (count<MAX_RCV_CMD || count==0 )){
-			cmd = cs.read();
-			if (cmd!=null) {
-				count++;
-				System.out.println("\tEditor"+eid+" catch command:>> "+cmd.toString());
-				cmd = translater.transReceiveCmd(cmd);
-			}
-			if (cmd!=null) {
-				text.edit(cmd);
-				cs.write(cmd);
-			}
-		}
-
-		System.out.println("Editor"+eid+" finish.");
-		try {
-			cc.join();
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-	}
-
-}
-
-class AutoCmdSender extends Thread{
-	static public int cmdNO[] = { REP.REPCMD_INSERT, REP.REPCMD_REPLACE, REP.REPCMD_DELETE };
-	private Text text;
-	private ChannelSimulator<REPCommand> cs;
-	private Translater translater;
-	private int MAX_CMD;
-	private int eid;
-	private int seq;
-
-	public AutoCmdSender(Text _text, ChannelSimulator<REPCommand> _cs, Translater trans, int _eid, int max_cmd){
-		text = _text;
-		cs   = _cs;
-		translater = trans;
-		MAX_CMD = max_cmd;
-		seq = 0;
-		eid = _eid;
-	}
-
-	public void run(){
-		REPCommand cmd;
-		for(int i=0; i<MAX_CMD; i++){
-			cmd = genCmd();
-			text.edit(cmd);
-			cmd = translater.transSendCmd(cmd);
-			cs.write(cmd);
-		}
-	}
-
-	private REPCommand genCmd(){
-		String str = new String("inserted or replaced by editor"+eid);
-		return new REPCommand(cmdNO[Verify.random(2)],
-		                      0, eid, seq++,
-		                      Verify.random(text.size()-1), //size-1?
-		                      str.length(), str);
-	}
-}
--- a/src/pathfinder/EditorEmulator2.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-package pathfinder;
-
-import java.util.Queue;
-
-import remoteeditor.command.REPCommand;
-import remoteeditor.network.REP;
-import sample.merge.Translater;
-
-public class EditorEmulator2 extends Thread{
-	private int eid;
-	private int seq;
-	private boolean isOwner;
-	private NetworkSimulator<REPCommand> ns;
-	private ChannelSimulator<REPCommand> cs;
-	private Queue<REPCommand> CmdList;
-	private Translater translater;
-	private Text text;
-	private boolean running=true;
-
-	public EditorEmulator2(int _eid, NetworkSimulator<REPCommand> _ns, Queue<REPCommand> q, String _name) {
-		super(_name);
-		eid = _eid;
-		ns = _ns;
-		CmdList = q;
-		translater = new Translater(_eid);
-		text = new Text();
-		cs = ns.connect();
-	}
-
-	public void setOwner(boolean f){
-		isOwner = f;
-	}
-	synchronized public void finish(){
-		running = false;
-	}
-
-	public void run(){
-		System.out.println("Editor"+eid+" start.");
-
-		// Send All Command that is included CmdList.
-		sendAllCommand();
-
-		// MainLoop, 
-		while(running){
-			REPCommand cmd = cs.read();
-			if (cmd==null) continue;
-
-			//終了条件
-			if (checkQuit(cmd)){
-				System.out.println("\tEditor"+eid+" catch QUIT command emited by itself.");
-				translater.transReceiveCmd(cmd);
-				running=false; break;
-			}
-			System.out.println("\tEditor"+eid+" catch command:>> "+cmd.toString());
-			cmd = translater.transReceiveCmd(cmd);
-			if (isOwner&&cmd!=null) cmd.setThroughMaster(true);
-			if (cmd==null) continue;
-
-			text.edit(cmd);
-			cs.write(cmd);
-		}
-
-		System.out.println("Editor"+eid+" finish.");
-	}
-
-	private void sendAllCommand() {
-		for (REPCommand cmd: CmdList){
-			cmd.seq = seq;
-			cmd.eid = eid;
-			cmd.setString("this is inserted or replaced by Editor"+eid+":"+seq);
-			cmd = translater.transSendCmd(cmd);
-			if (isOwner) cmd.setThroughMaster(true);
-			text.edit(cmd);
-			cs.write(cmd);
-			seq++;
-		}
-
-		// Send Quit Command
-		cs.write( translater.transSendCmd( new REPCommand(REP.SMCMD_QUIT, 0, eid, seq++, 0, 0, "QUIT by Editor"+eid)));
-	}
-
-	private boolean checkQuit(REPCommand cmd) {
-		// 最初に全部のコマンドを送信するから、自分のQUITが来るのは最後
-		return (cmd.eid==eid && cmd.cmd==REP.SMCMD_QUIT);
-	}
-
-	public Text getText(){
-		return text;
-	}
-}
\ No newline at end of file
--- a/src/pathfinder/NetworkSimulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-package pathfinder;
-
-import java.util.LinkedList;
-import java.util.Queue;
-
-public class NetworkSimulator<P> {
-
-	/** Waiting connectionRequest to be accepted by SessionManager. */
-	private Queue<ChannelSimulator<P>> acceptList;
-	/** Established connection */
-	private Queue<ChannelSimulator<P>> connectedList;
-
-	public NetworkSimulator(){
-		acceptList = new LinkedList<ChannelSimulator<P>>();
-		connectedList = new LinkedList<ChannelSimulator<P>>();
-	}
-
-	/**
-	 * Establish connection. It's called by SeMa.
-	 * @return
-	 */
-	public ChannelSimulator<P> accept(){
-		ChannelSimulator<P> cs = acceptList.poll();
-		if (cs==null) return null;
-
-		connectedList.offer(cs);
-		return cs.getServerChannel();
-	}
-
-	/**
-	 * Request to connect.
-	 * Client editor use this method to connect SeMa. 
-	 * @param cs
-	 */
-	public ChannelSimulator<P> connect(){
-		ChannelSimulator<P> cs = new ChannelSimulator<P>(this);
-		acceptList.offer(cs);
-		return cs;
-	}
-
-	public synchronized P read(Queue<P>q) {
-		return q.poll();
-	}
-
-	public synchronized boolean write(Queue<P>q,P p) {
-		return q.offer(p);
-	}
-}
--- a/src/pathfinder/SeMaEmulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-package pathfinder;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SeMaEmulator<P> extends Thread {
-	private int MAX_PACKET;
-	private int MAX_CLIENT;
-	private boolean running=true;
-	private NetworkSimulator<P> ns;
-	private List<ChannelSimulator<P>> csList;
-
-	public SeMaEmulator(NetworkSimulator<P> _ns, int max_client, int max_packet){
-		ns = _ns;
-		MAX_CLIENT = max_client;
-		MAX_PACKET = max_packet;
-		csList = new ArrayList<ChannelSimulator<P>>();
-	}
-	public SeMaEmulator(NetworkSimulator<P> _ns){
-		this(_ns, 2, 0);
-	}
-
-	synchronized public void finish(){
-		running = false;
-	}
-
-	/**
-	 * Check whether the NetworkSimulator hold waiting connections.
-	 */
-	private void checkAccept(){
-		ChannelSimulator<P> cs;
-		while((cs=ns.accept())!=null){
-			csList.add(cs);
-		}
-	}
-
-	public void run(){
-		int i=0;
-		int count=0;
-		P packet;
-
-		while(csList.size()<MAX_CLIENT){ checkAccept(); Thread.yield(); }
-		System.out.println("SessionManager start.");
-
-		/* Main Loop */
-		ChannelSimulator<P> cs = csList.get(i);
-		while(running
-				&& MAX_PACKET==0 || count<MAX_PACKET){
-			packet=cs.read();          // [i]からread
-			//if(packet!=null) System.out.println("SeMa catch packet to "+i+":>> "+packet.toString());
-			i = (i+1)%csList.size();   // i++
-			cs = csList.get(i);        // 次のChennelをゲット
-			if (packet!=null) {
-				System.out.println("SeMa pass packet to "+i+":>> "+packet.toString());
-				cs.write(packet);      // readできていたならそれを書き込む
-				count++;
-			}
-			//if (i==0) checkAccept();   //全部回ったらaccept待ちをチェック
-		}
-		System.out.println("SessionManager finish.");
-	}
-}
--- a/src/pathfinder/Test.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-package pathfinder;
-
-
-public class Test {
-	private NetworkSimulator<String> ns;
-	
-	private ChannelSimulator<String>  client;
-	private ChannelSimulator<String>  server;
-	
-	public static void main(String [] arg)  {
-		Test test = new Test();
-		test.test();
-	}
-
-	void test() {
-		ns = new NetworkSimulator<String>();
-		client = ns.connect();
-		server = ns.accept();
-		
-		client.write("client0 write some thing");
-		
-		System.out.println(server.read());
-		
-	}
-
-	void thread() {
-		
-	}
-}
--- a/src/pathfinder/TestMerger.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-package pathfinder;
-
-import java.util.LinkedList;
-
-import remoteeditor.command.REPCommand;
-
-public class TestMerger {
-	private int N_editor;
-	private int N_packet;
-	private NetworkSimulator<REPCommand> ns;
-	private SeMaEmulator<REPCommand> sm;
-	private LinkedList<EditorEmulator> editors;
-
-	public TestMerger(int editor, int packet){
-		N_editor = editor;
-		N_packet = packet;
-		ns = new NetworkSimulator<REPCommand>();
-		sm = new SeMaEmulator<REPCommand>(ns, N_editor, N_editor*N_packet*N_editor);
-		editors = new LinkedList<EditorEmulator>();
-	}
-	
-	public static void main(String[] args){
-		TestMerger tm;
-		tm = new TestMerger(2, 3);
-		tm.startTest();
-	}
-
-	private void startTest() {
-		for (int i=0; i<N_editor; i++){
-			EditorEmulator ee = new EditorEmulator(i, ns, N_packet*N_editor, N_packet); 
-			editors.add(ee);
-			ee.start();
-		}
-		sm.start();
-
-		try {
-			sm.join();
-			for (EditorEmulator ee: editors){
-				//ee.finish();
-				ee.join();
-			}
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-	}
-
-}
--- a/src/pathfinder/TestMerger2.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-package pathfinder;
-
-import java.util.LinkedList;
-import remoteeditor.command.REPCommand;
-import remoteeditor.network.REP;
-
-public class TestMerger2 {
-	static public int cmdNO[] = { REP.REPCMD_INSERT, REP.REPCMD_REPLACE, REP.REPCMD_DELETE };
-	private int N_editor;
-	private int N_packet;
-	private NetworkSimulator<REPCommand> ns;
-	private SeMaEmulator<REPCommand> sm;
-	private LinkedList<EditorEmulator2> editors;
-
-	public TestMerger2(int editor, int packet){
-		N_editor = editor;
-		N_packet = packet;
-		ns = new NetworkSimulator<REPCommand>();
-		sm = new SeMaEmulator<REPCommand>(ns, N_editor, 0);
-		editors = new LinkedList<EditorEmulator2>();
-	}
-
-	public static void main(String[] args){
-		TestMerger2 tm;
-		tm = new TestMerger2(2, 3);
-		//tm.init();
-		//tm.test2cmd();
-		//tm.test1cmd();
-		tm.test0cmd();
-		tm.startTest();
-
-		tm.printAllTexts();
-		assert tm.checkEquality();
-	}
-	
-/*	private void init(){
-		for (int i=0; i<N_editor; i++){
-			int j;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			// 各エディタが送信するコマンド列を生成
-			for(j=0; j<N_packet; j++) {
-				REPCommand cmd = new REPCommand(cmdNO[Verify.random(2)],
-				                                0, i, j,
-				                                10, //Verify.random(text.size()-1), //size-1?
-				                                0, null);
-				cmds.add( cmd);
-			}
-			EditorEmulator2 ee = new EditorEmulator2(i, ns, cmds, "Editor"+i); 
-			editors.add(ee);
-		}
-	}
-*/	
-	private void test2cmd(){
-		for (int i=0; i<N_editor; i++){
-			int j=0;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			// 各エディタが送信するコマンド列を生成
-
-			String str = "created by Editor"+i+":"+j;
-			REPCommand cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-			str = "created by Editor"+i+":"+j;
-			cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-
-			EditorEmulator2 ee = new EditorEmulator2(i, ns, cmds, "Editor"+i);
-			if(i==0) ee.setOwner(true);
-			editors.add(ee);
-		}
-	}
-
-
-	private void test1cmd(){
-		for (int i=0; i<N_editor; i++){
-			int j=0;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			//各エディタが送信するコマンド列を生成
-			String str = "Editor"+i+":"+j;
-			REPCommand cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-			EditorEmulator2 ee = new EditorEmulator2(i, ns, cmds, "Editor"+i); 
-			if(i==0) ee.setOwner(true);
-			editors.add(ee);
-		}
-	}
-
-	private void test0cmd(){
-		for (int i=0; i<N_editor; i++){
-			int j=0;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			//各エディタが送信するコマンド列を生成
-			EditorEmulator2 ee = new EditorEmulator2(i, ns, cmds, "Editor"+i); 
-			if(i==0) ee.setOwner(true);
-			editors.add(ee);
-		}
-	}
-
-
-
-	private void startTest() {
-		for (EditorEmulator2 ee: editors){
-			ee.start();
-		}
-		sm.start();
-
-		try {
-			for (EditorEmulator2 ee: editors){
-				//ee.finish();
-				ee.join();
-			}
-			sm.finish();
-			sm.join();
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-	}
-
-	private void printAllTexts(){
-		for(EditorEmulator2 ee: editors){
-			System.out.println("--"+ee.getName()+"------------------------");
-			ee.getText().printAllText();
-		}
-	}
-
-	private boolean checkEquality(){
-		/*
-		Text ee0 = editors.remove().getText();
-		return editors.remove().getText().equals(ee0);
-		*/
-		Text text0 = editors.element().getText();
-		for(EditorEmulator2 ee: editors){
-			if (!text0.equals(ee.getText())) return false;
-		}
-		return true;
-	}
-}
--- a/src/pathfinder/TestNetwork.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-package pathfinder;
-
-import java.util.LinkedList;
-import java.util.List;
-
-public class TestNetwork {
-	private NetworkSimulator<String> ns;
-	private SeMaEmulator<String> sm;
-
-	private List<EditorEmulator1> editors;
-	private int N_editor;
-	
-	public static void main(String [] arg)  {
-		TestNetwork test = new TestNetwork(2);
-		test.startTest();
-	}
-
-	public TestNetwork(int _s){
-		N_editor = _s;
-		ns = new NetworkSimulator<String>();
-		sm = new SeMaEmulator<String>(ns);
-		editors = new LinkedList<EditorEmulator1>();
-	}
-
-	private void startTest() {
-		for (int i=0; i<N_editor; i++){
-			editors.add(new EditorEmulator1("editor"+i, ns));
-		}
-		
-		for (EditorEmulator1 ee: editors){
-			ee.init();
-			ee.start();
-		}
-		sm.start();
-
-		try {
-			for (EditorEmulator1 ee: editors)
-				ee.join();
-			sm.join();
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-	}
-/*
-	void test() {
-		ns = new NetworkSimulator<String>();
-		client = new ChannelSimulator<String>(ns);
-		ns.connect(client);
-		server = ns.accept();
-
-		client.write("client write some thing");
-
-		System.out.println(server.read());
-		
-	}
-*/
-}
-
-class EditorEmulator1 extends Thread{
-	private String name;
-	private NetworkSimulator<String> ns;
-	private ChannelSimulator<String> cs;
-	static private String[] text0 = {
-		"aaa", "bbb", "ccc", "ddd", "eee",
-		"fff", "ggg", "hhh", "iii", "jjj"
-		//"kkk", "lll", "mmm", "nnn", "ooo",
-		//"ppp", "qqq", "rrr", "sss", "ttt",
-		//"uuu", "vvv", "www", "xxx", "yyy", "zzz"
-	};
-
-
-	public EditorEmulator1(NetworkSimulator<String> _ns){
-		this("NoName", _ns);
-	}
-	public EditorEmulator1(String _name, NetworkSimulator<String> _ns) {
-		name = _name;
-		ns = _ns;
-	}
-
-	public void init(){
-		cs = ns.connect();
-	}
-	public void run(){
-		int count=0;
-		String str;
-		sendPackets();
-		System.out.println("thread "+name+" start.");
-		while(count<8){
-			str = cs.read();
-			if (str==null) continue;
-			System.out.println(name+": Catch String '"+str+"'"); count++;
-		}
-		System.out.println("thread "+name+" finish.");
-	}
-	
-	public void sendPackets(){
-		for(String str: EditorEmulator1.text0){
-			cs.write(str+" < from "+name);
-			System.out.println(name+": Send String '"+str+"'");
-		}
-	}
-}
--- a/src/pathfinder/Text.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-package pathfinder;
-
-import java.util.Arrays;
-import java.util.LinkedList;
-
-import remoteeditor.command.REPCommand;
-import remoteeditor.network.REP;
-
-public class Text {
-	static private String[] text0 = {
-		"aaa", "bbb", "ccc", "ddd", "eee",
-		"fff", "ggg", "hhh", "iii", "jjj",
-		"kkk", "lll", "mmm", "nnn", "ooo",
-		"ppp", "qqq", "rrr", "sss", "ttt",
-		"uuu", "vvv", "www", "xxx", "yyy", "zzz"
-	};
-	LinkedList<String> strList;
-
-	public Text(){
-		this(Text.text0);
-	}
-	public Text(String[] _strings){
-		strList = new LinkedList<String>(Arrays.asList(_strings));
-	}
-
-	synchronized public void insert(int i, String str){
-		assert 0<i && i<strList.size();
-		strList.add(i, str);
-	}
-	synchronized public void delete(int i){
-		assert 0<i && i<strList.size();
-		strList.remove(i);
-	}
-	synchronized public void replace(int i, String str){
-		assert 0<i && i<strList.size();
-		strList.set(i, str);
-	}
-	public String get(int i){
-		assert 0<i && i<strList.size();
-		return strList.get(i);
-	}
-	public void edit(REPCommand cmd){
-		if (cmd.cmd==REP.REPCMD_INSERT)        insert(cmd.lineno, cmd.string);
-		else if (cmd.cmd==REP.REPCMD_REPLACE)  replace(cmd.lineno, cmd.string);
-		else if (cmd.cmd==REP.REPCMD_DELETE)   delete(cmd.lineno);
-		//else assert false;
-	}
-
-	public int size(){
-		return strList.size();
-	}
-	public void printAllText(){
-		for( String str: strList){
-			System.out.println(str);
-		}
-	}
-	public boolean equals(Text _target){
-		return strList.equals(_target.strList);
-	}
-}
--- a/src/pathfinderQ/ChannelSimulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-package pathfinderQ;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.Queue;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.TimeUnit;
-
-public class ChannelSimulator<P> {
-	private SynchronousQueue<P> q0;
-	private SynchronousQueue<P> q1;
-
-	private NetworkSimulator<P> ns;
-/*
-	public ChannelSimulator(NetworkSimulator<P> ns){
-		q0 = new LinkedList<P>(); 
-		q1 = new LinkedList<P>(); 
-		this.ns = ns;
-	}
-*/
-	public ChannelSimulator(NetworkSimulator<P> _ns){
-		this(new SynchronousQueue<P>(), new SynchronousQueue<P>(), _ns);
-	}
-	public ChannelSimulator(SynchronousQueue<P> _a, SynchronousQueue<P> _b, NetworkSimulator<P> _ns){
-		q0 = _a;
-		q1 = _b;
-		ns = _ns;
-	}
-
-	public P read() {
-		try {
-			return q0.take();
-		} catch (InterruptedException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		return null;
-	}
-
-	public boolean write(P p){	
-		try {
-			return q1.offer(p,1, TimeUnit.NANOSECONDS);
-		} catch (InterruptedException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
-		return false;
-	}
-
-	public ChannelSimulator<P> getServerChannel() {
-		return new ChannelSimulator<P>(q1, q0,ns);
-	}
-	
-	public P poll() {
-		
-		return q0.poll();
-	}
-}
--- a/src/pathfinderQ/EditorEmulator2.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-package pathfinderQ;
-
-import java.util.Queue;
-
-import remoteeditor.command.REPCommand;
-import remoteeditor.network.REP;
-import sample.merge.Translater;
-
-public class EditorEmulator2 extends Thread{
-	private int eid;
-	private int seq;
-	private boolean isOwner;
-	private NetworkSimulator<REPCommand> ns;
-	private ChannelSimulator<REPCommand> cs;
-	private Queue<REPCommand> CmdList;
-	private Translater translater;
-	private pathfinder.Text text;
-	private boolean running=true;
-
-	public EditorEmulator2(int _eid, NetworkSimulator<REPCommand> _ns, Queue<REPCommand> q, String _name) {
-		super(_name);
-		eid = _eid;
-		ns = _ns;
-		CmdList = q;
-		translater = new Translater(_eid);
-		text = new pathfinder.Text();
-		cs = ns.connect();
-	}
-
-	public void setOwner(boolean f){
-		isOwner = f;
-	}
-	synchronized public void finish(){
-		running = false;
-	}
-
-	public void run(){
-		System.out.println("Editor"+eid+" start.");
-
-		// Send All Command that is included CmdList.
-		sendAllCommand();
-
-		// MainLoop, 
-		while(running){
-			REPCommand cmd = cs.read();
-			if (cmd==null) continue;
-
-			//I
-			if (checkQuit(cmd)){
-				System.out.println("\tEditor"+eid+" catch QUIT command emited by itself.");
-				translater.transReceiveCmd(cmd);
-				running=false; break;
-			}
-			System.out.println("\tEditor"+eid+" catch command:>> "+cmd.toString());
-			cmd = translater.transReceiveCmd(cmd);
-			if (isOwner&&cmd!=null) cmd.setThroughMaster(true);
-			if (cmd==null) continue;
-
-			text.edit(cmd);
-			cs.write(cmd);
-		}
-
-		System.out.println("Editor"+eid+" finish.");
-	}
-
-	private void sendAllCommand() {
-		for (REPCommand cmd: CmdList){
-			cmd.seq = seq;
-			cmd.eid = eid;
-			cmd.setString("this is inserted or replaced by Editor"+eid+":"+seq);
-			cmd = translater.transSendCmd(cmd);
-			if (isOwner) cmd.setThroughMaster(true);
-			text.edit(cmd);
-			cs.write(cmd);
-			seq++;
-		}
-
-		// Send Quit Command
-		cs.write( translater.transSendCmd( new REPCommand(REP.SMCMD_QUIT, 0, eid, seq++, 0, 0, "QUIT by Editor"+eid)));
-	}
-
-	private boolean checkQuit(REPCommand cmd) {
-		// ŏɑS̃R}h𑗐M邩AQUIT͍̂Ō
-		return (cmd.eid==eid && cmd.cmd==REP.SMCMD_QUIT);
-	}
-
-	public pathfinder.Text getText(){
-		return text;
-	}
-}
\ No newline at end of file
--- a/src/pathfinderQ/NetworkSimulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-package pathfinderQ;
-
-import java.util.LinkedList;
-import java.util.Queue;
-
-public class NetworkSimulator<P> {
-
-	/** Waiting connectionRequest to be accepted by SessionManager. */
-	private Queue<ChannelSimulator<P>> acceptList;
-	/** Established connection */
-	private Queue<ChannelSimulator<P>> connectedList;
-
-	public NetworkSimulator(){
-		acceptList = new LinkedList<ChannelSimulator<P>>();
-		connectedList = new LinkedList<ChannelSimulator<P>>();
-	}
-
-	/**
-	 * Establish connection. It's called by SeMa.
-	 * @return
-	 */
-	public ChannelSimulator<P> accept(){
-		ChannelSimulator<P> cs = acceptList.poll();
-		if (cs==null) return null;
-
-		connectedList.offer(cs);
-		return cs.getServerChannel();
-	}
-
-	/**
-	 * Request to connect.
-	 * Client editor use this method to connect SeMa. 
-	 * @param cs
-	 */
-	public ChannelSimulator<P> connect(){
-		ChannelSimulator<P> cs = new ChannelSimulator<P>(this);
-		acceptList.offer(cs);
-		return cs;
-	}
-}
--- a/src/pathfinderQ/SeMaEmulator.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-package pathfinderQ;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SeMaEmulator<P> extends Thread {
-	private int MAX_PACKET;
-	private int MAX_CLIENT;
-	private boolean running=true;
-	private NetworkSimulator<P> ns;
-	private List<ChannelSimulator<P>> csList;
-
-	public SeMaEmulator(NetworkSimulator<P> _ns, int max_client, int max_packet){
-		ns = _ns;
-		MAX_CLIENT = max_client;
-		MAX_PACKET = max_packet;
-		csList = new ArrayList<ChannelSimulator<P>>();
-	}
-	public SeMaEmulator(NetworkSimulator<P> _ns){
-		this(_ns, 2, 0);
-	}
-
-	synchronized public void finish(){
-		running = false;
-	}
-
-	/**
-	 * Check whether the NetworkSimulator hold waiting connections.
-	 */
-	private void checkAccept(){
-		ChannelSimulator<P> cs;
-		while((cs=ns.accept())!=null){
-			csList.add(cs);
-		}
-	}
-
-	public void run(){
-		int i=0;
-		int count=0;
-		P packet;
-
-		while(csList.size()<MAX_CLIENT){ checkAccept(); Thread.yield(); }
-		System.out.println("SessionManager start.");
-
-		/* Main Loop */
-		ChannelSimulator<P> cs = csList.get(i);
-		while(running
-				&& MAX_PACKET==0 || count<MAX_PACKET){
-			packet=cs.poll();          // [i]read
-			//if(packet!=null) System.out.println("SeMa catch packet to "+i+":>> "+packet.toString());
-			i = (i+1)%csList.size();   // i++
-			cs = csList.get(i);        // ChennelQbg
-			if (packet!=null) {
-				System.out.println("SeMa pass packet to "+i+":>> "+packet.toString());
-				cs.write(packet);      // readłĂȂ炻
-				count++;
-			}
-			//if (i==0) checkAccept();   //Saccept҂`FbN
-		}
-		System.out.println("SessionManager finish.");
-	}
-}
--- a/src/pathfinderQ/TestMerger2.java	Sat Dec 22 15:07:03 2007 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-package pathfinderQ;
-
-import java.util.LinkedList;
-import remoteeditor.command.REPCommand;
-import remoteeditor.network.REP;
-
-public class TestMerger2 {
-	static public int cmdNO[] = { REP.REPCMD_INSERT, REP.REPCMD_REPLACE, REP.REPCMD_DELETE };
-	private int N_editor;
-
-	private NetworkSimulator<REPCommand> ns;
-	private SeMaEmulator<REPCommand> sm;
-	private LinkedList<EditorEmulator2> editors;
-	private int N_packet;
-
-	public TestMerger2(int editor, int packet){
-		N_editor = editor;
-		N_packet = packet;
-		ns = new NetworkSimulator<REPCommand>();
-		sm = new SeMaEmulator<REPCommand>(ns, N_editor, 0);
-		editors = new LinkedList<EditorEmulator2>();
-	}
-
-	public static void main(String[] args){
-		TestMerger2 tm;
-		tm = new TestMerger2(2, 3);
-		//tm.init();
-		tm.test2cmd();
-		//tm.test1cmd();
-		//tm.test0cmd();
-		tm.startTest();
-
-		tm.printAllTexts();
-		assert tm.checkEquality();
-	}
-
-	/*
-	private void init(){
-		for (int i=0; i<N_editor; i++){
-			int j;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			// eGfB^MR}h𐶐
-			for(j=0; j<N_packet; j++) {
-				REPCommand cmd = new REPCommand(cmdNO[Verify.random(2)],
-				                                0, i, j,
-				                                10, //Verify.random(text.size()-1), //size-1?
-				                                0, null);
-				cmds.add( cmd);
-			}
-			EditorEmulator2 ee = new EditorEmulator2(i, ns, cmds, "Editor"+i); 
-			editors.add(ee);
-		}
-	}
-	*/
-	private void test2cmd(){
-		for (int i=0; i<N_editor; i++){
-			int j=0;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			// eGfB^MR}h𐶐
-
-			String str = "created by Editor"+i+":"+j;
-			REPCommand cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-			str = "created by Editor"+i+":"+j;
-			cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-
-			EditorEmulator2 ee = new EditorEmulator2(i, ns, cmds, "Editor"+i);
-			if(i==0) ee.setOwner(true);
-			editors.add(ee);
-		}
-	}
-
-
-	private void test1cmd(){
-		for (int i=0; i<N_editor; i++){
-			int j=0;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			//eGfB^MR}h𐶐
-			String str = "Editor"+i+":"+j;
-			REPCommand cmd = new REPCommand(REP.REPCMD_INSERT,
-					0, i, j++,
-					10, //Verify.random(text.size()-1), //size-1?
-					str.length(), str);
-			cmds.add( cmd);
-			EditorEmulator2 ee = new EditorEmulator2(i, ns, cmds, "Editor"+i); 
-			if(i==0) ee.setOwner(true);
-			editors.add(ee);
-		}
-	}
-
-	private void test0cmd(){
-		for (int i=0; i<N_editor; i++){
-			int j=0;
-			LinkedList<REPCommand> cmds = new LinkedList<REPCommand>();
-			//eGfB^MR}h𐶐
-			EditorEmulator2 ee = new EditorEmulator2(i, ns, cmds, "Editor"+i); 
-			if(i==0) ee.setOwner(true);
-			editors.add(ee);
-		}
-	}
-
-
-
-	private void startTest() {
-		for (EditorEmulator2 ee: editors){
-			ee.start();
-		}
-		sm.start();
-
-		try {
-			for (EditorEmulator2 ee: editors){
-				//ee.finish();
-				ee.join();
-			}
-			sm.finish();
-			sm.join();
-		} catch (InterruptedException e) {
-			e.printStackTrace();
-		}
-	}
-
-	private void printAllTexts(){
-		for(EditorEmulator2 ee: editors){
-			System.out.println("--"+ee.getName()+"------------------------");
-			ee.getText().printAllText();
-		}
-	}
-
-	private boolean checkEquality(){
-		/*
-		Text ee0 = editors.remove().getText();
-		return editors.remove().getText().equals(ee0);
-		*/
-		pathfinder.Text text0 = editors.element().getText();
-		for(EditorEmulator2 ee: editors){
-			if (!text0.equals(ee.getText())) return false;
-		}
-		return true;
-	}
-}