Mercurial > hg > RemoteEditor > Eclipse
changeset 158:55bc9f6b0691
*** empty log message ***
author | tkaito |
---|---|
date | Tue, 26 Aug 2008 19:09:15 +0900 |
parents | 1a2269c820df |
children | a5c56bff6359 |
files | src/pathfinder/mergetest/test/RepCommandOptimizeTest.java |
diffstat | 1 files changed, 75 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pathfinder/mergetest/test/RepCommandOptimizeTest.java Tue Aug 26 19:09:15 2008 +0900 @@ -0,0 +1,75 @@ +package pathfinder.mergetest.test; + +import java.util.LinkedList; + +import pathfinder.mergetest.Text; + + +import remoteeditor.command.REPCommand; +import remoteeditor.network.REP; + + + +public class RepCommandOptimizeTest { + //テストコマンド (command,string,lineno,id) + static String[] test1 = { + Integer.toString(REP.REPCMD_INSERT),"TEST0","3","1", + Integer.toString(REP.REPCMD_INSERT),"TEST1","3","2", + Integer.toString(REP.REPCMD_INSERT),"TEST2","3","3" + + }; + + String[] test2 = new String[test1.length]; + + static LinkedList<REPCommand> cmdlist = new LinkedList<REPCommand>(); + Text text = new Text(); + + //REPコマンドの生成 + void makeCommand(String[] str){ + int seq = 0; + try{ + for( int i = 0;i < str.length; i+=4){ + int cmd = Integer.parseInt(str[i]); + int lineno = Integer.parseInt(str[i+2]); + + int sid = Integer.parseInt(str[i+3]); + int eid = sid; + cmdlist.add(new REPCommand(cmd, sid, eid, seq++, lineno, str[i+1].length(), str[i+1])); + } + }catch(Exception e){ + e.printStackTrace(); + } + } + //生成したコマンドのリストを表示 + void printCmdList(){ + System.out.println("---------- CmdList ----------"); + for(REPCommand r: cmdlist){ + System.out.println(r.toString()); + } + } + + void edit(){ + for(REPCommand r : cmdlist){ + text.edit(r); + } + } + + void printText(){ + System.out.println("------------ Text -----------"); + text.printAllText(); + } + + public static void main(String[] s){ + + RepCommandOptimizeTest rco = new RepCommandOptimizeTest(); + rco.makeCommand(test1); + java.util.Collections.shuffle(cmdlist); + rco.printCmdList(); + rco.edit(); + rco.printText(); + //java.util.Collections.shuffle(cmdlist); + for ( int i = 0; i < 10; ++i ) { + System.out.println(cmdlist.get(i)); + } + } +}