# HG changeset patch # User pin # Date 1199770748 -32400 # Node ID 75fc44fda58350a1353e48d8a3dfb6a7120f6fee # Parent 6f174e2b75038e1a454141bd8081dd8f9be65d58 *** empty log message *** diff -r 6f174e2b7503 -r 75fc44fda583 src/pathfinder/BlockingQnoSeMa/ChannelSimulator.java --- a/src/pathfinder/BlockingQnoSeMa/ChannelSimulator.java Mon Jan 07 05:41:45 2008 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -package pathfinder.BlockingQnoSeMa; - -import java.util.concurrent.BlockingQueue; - -public class ChannelSimulator
{ - private BlockingQueue
qread; - private BlockingQueue
qwrite; - - public ChannelSimulator(BlockingQueue
_a, BlockingQueue
_b){ - qread = _a; - qwrite = _b; - } - - public P read(){ - try { - return qread.take(); - } catch (InterruptedException e) { - e.printStackTrace(); - return null; - } - } - - public boolean write(P p){ - try { - qwrite.put(p); - return true; - } catch (InterruptedException e) { - e.printStackTrace(); - return false; - } - } - - public BlockingQueue
getReadQ(){ - return qread; - } - public BlockingQueue
getWriteQ(){ - return qwrite; - } - public void setReadQ(BlockingQueue
bq){ - qread = bq; - } - public void setWriteQ(BlockingQueue
bq){
- qwrite = bq;
- }
-
- public boolean readQisEmpty() {
- return qread.isEmpty();
- }
- public boolean writeQisEmpty() {
- return qwrite.isEmpty();
- }
-}
diff -r 6f174e2b7503 -r 75fc44fda583 src/pathfinder/BlockingQnoSeMa/EditorSimulator.java
--- a/src/pathfinder/BlockingQnoSeMa/EditorSimulator.java Mon Jan 07 05:41:45 2008 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-package pathfinder.BlockingQnoSeMa;
-
-import java.util.Queue;
-
-import remoteeditor.command.REPCommand;
-import remoteeditor.network.REP;
-import sample.merge.Translater;
-import sample.merge.TranslaterImp1;
-
-public class EditorSimulator extends Thread{
- private int eid;
- private int seq;
- private boolean isOwner;
- private NetworkSimulator connect(){
- ChannelSimulator cs;
- if (connectedList.isEmpty()){
- BlockingQueue q = new LinkedBlockingQueue ();
- cs = new ChannelSimulator (q, q);
- }else{
- BlockingQueue rq = connectedList.getLast().getWriteQ();
- BlockingQueue wq = new LinkedBlockingQueue ();
- connectedList.getFirst().setReadQ(wq);
-
-/* ChannelSimulator lastcs = connectedList.getLast();
- BlockingQueue rq = lastcs.getWriteQ();
-
- BlockingQueue wq = new LinkedBlockingQueue ();
- ChannelSimulator firstcs = connectedList.getFirst();
- firstcs.setReadQ(wq);
-*/
- cs = new ChannelSimulator (rq, wq);
- }
-
- connectedList.addLast(cs);
- return cs;
- }
-
- public boolean checkAllCS(){
- for(ChannelSimulator cs: connectedList){
- if(!cs.readQisEmpty()) return false;
- }
- return true;
- }
-}
diff -r 6f174e2b7503 -r 75fc44fda583 src/pathfinder/BlockingQnoSeMa/NetworkSimulator_withoutSeMa.java
--- a/src/pathfinder/BlockingQnoSeMa/NetworkSimulator_withoutSeMa.java Mon Jan 07 05:41:45 2008 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-package pathfinder.BlockingQnoSeMa;
-
-import java.util.LinkedList;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-public class NetworkSimulator_withoutSeMa {
- /** Established connection */
- private LinkedList connect(){
- ChannelSimulator cs;
- if (connectedList.isEmpty()){
- BlockingQueue q = new LinkedBlockingQueue ();
- cs = new ChannelSimulator (q, q);
- }else{
- BlockingQueue rq = connectedList.getLast().getWriteQ();
- BlockingQueue wq = new LinkedBlockingQueue ();
- connectedList.getFirst().setReadQ(wq);
-
-/* ChannelSimulator lastcs = connectedList.getLast();
- BlockingQueue rq = lastcs.getWriteQ();
-
- BlockingQueue wq = new LinkedBlockingQueue ();
- ChannelSimulator firstcs = connectedList.getFirst();
- firstcs.setReadQ(wq);
-*/
- cs = new ChannelSimulator (rq, wq);
- }
-
- connectedList.addLast(cs);
- return cs;
- }
-
- public boolean checkAllCS(){
- for(ChannelSimulator cs: connectedList){
- if(!cs.readQisEmpty()) return false;
- }
- return true;
- }
-}
diff -r 6f174e2b7503 -r 75fc44fda583 src/pathfinder/BlockingQnoSeMa/TestMerger.java
--- a/src/pathfinder/BlockingQnoSeMa/TestMerger.java Mon Jan 07 05:41:45 2008 +0900
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-package pathfinder.BlockingQnoSeMa;
-
-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 NetworkSimulator