Mercurial > hg > RemoteEditor > Eclipse
changeset 58:0eaf3f3ecadb
*** empty log message ***
author | pin |
---|---|
date | Wed, 25 Jul 2007 14:49:02 +0900 |
parents | f055e65c7e3c |
children | aa47ea5bdac9 |
files | src/sample/merge/TestEditor.java src/sample/merge/TestTranslate2.java src/sample/merge/TestTranslate3.java |
diffstat | 3 files changed, 60 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/sample/merge/TestEditor.java Tue Jul 24 17:40:07 2007 +0900 +++ b/src/sample/merge/TestEditor.java Wed Jul 25 14:49:02 2007 +0900 @@ -30,6 +30,7 @@ List <String> myText = new LinkedList<String>(); private TestSessionManager sessionManager; + public static void main(String[] args){ TestEditor editorA = new TestEditor("EditorA"); editorA.init(); @@ -146,7 +147,7 @@ while(e.hasMoreElements()){ Integer[] a = (Integer[])e.nextElement(); for(int i = 0; i<a.length; i++){ - REPCommand command = new REPCommand(a[i].intValue(), 1, 1, myseq, 10, 1, myEditorName); myseq++; + REPCommand command = new REPCommand(a[i].intValue(), 1, 1, myseq, 10, 1, myEditorName + myseq); myseq++; send(command); } } @@ -155,9 +156,22 @@ public int getEID() { return myeid; } + + public void changeText(REPCommand command){ + switch(command.cmd){ + case REP.REP_INSERT_CMD: + myText.add(command.lineno, command.string); + break; + } + } public void setSessionManager(TestSessionManager sessionManager) { // TODO Auto-generated method stub this.sessionManager = sessionManager; } + + public String getEditorName() { + // TODO Auto-generated method stub + return myEditorName; + } }
--- a/src/sample/merge/TestTranslate2.java Tue Jul 24 17:40:07 2007 +0900 +++ b/src/sample/merge/TestTranslate2.java Wed Jul 25 14:49:02 2007 +0900 @@ -13,12 +13,31 @@ sessionManager.addEditor(editorA); sessionManager.addEditor(editorB); - Thread threadSM = new Thread(sessionManager); + //TestEditor[] editors = {editorA, editorB}; + + //Thread threadSM = new Thread(sessionManager); //threadSM.start(); Thread threadA = new Thread(editorA); Thread threadB = new Thread(editorB); + /* + Integer[] cmdkind = {REP.REP_INSERT_CMD, REP.REP_DELETE_CMD, REP.REP_REPLACE_CMD}; + Enumeration e = new PermEnum(cmdkind); + while(e.hasMoreElements()){ + Integer[] a = (Integer[])e.nextElement(); + for(int i =0; i<a.length; i++){ + Enumeration e2 = new PermEnum(editors); + while(e2.hasMoreElements()){ + TestEditor[] a2 = (TestEditor[])e2.nextElement(); + for(int j = 0; j<a2.length; j++){ + REPCommand command = new REPCommand(a[i].intValue(), 1, 1, 0, 10, 1, a2[j].getEditorName()); + a2[j].send(command); + } + } + } + }*/ + threadA.start(); threadB.start();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/sample/merge/TestTranslate3.java Wed Jul 25 14:49:02 2007 +0900 @@ -0,0 +1,25 @@ +package sample.merge; + +public class TestTranslate3 { + public static void main(String[] args){ + EditorTmp editorA = new EditorTmp("editorA"); + Thread thA = new Thread(editorA); + thA.start(); + + EditorTmp editorB = new EditorTmp("editorB"); + Thread thB = new Thread(editorB); + thB.start(); + } +} + +class EditorTmp implements Runnable{ + private String editorName; + + public EditorTmp(String string) { + editorName = string; + } + + public void run() { + System.out.println(editorName); + } +} \ No newline at end of file