Mercurial > hg > RemoteEditor > Eclipse
changeset 167:f9b713ee3014
*** empty log message ***
author | tkaito |
---|---|
date | Thu, 28 Aug 2008 22:51:55 +0900 |
parents | dce4ee1fac57 |
children | 63b4e8098553 |
files | src/pathfinder/mergetest/test/RepCommandOptimizeTest.java |
diffstat | 1 files changed, 4 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/pathfinder/mergetest/test/RepCommandOptimizeTest.java Thu Aug 28 22:24:30 2008 +0900 +++ b/src/pathfinder/mergetest/test/RepCommandOptimizeTest.java Thu Aug 28 22:51:55 2008 +0900 @@ -14,7 +14,7 @@ static String[] test1 = { Integer.toString(REP.REPCMD_INSERT),"TEST0","3","1", Integer.toString(REP.REPCMD_INSERT),"TEST1","3","2", - Integer.toString(REP.REPCMD_DELETE),"TEST2","3","3", + Integer.toString(REP.REPCMD_DELETE),"TEST2","5","3", Integer.toString(REP.REPCMD_DELETE),"TEST0","3","4", Integer.toString(REP.REPCMD_INSERT),"TEST1","3","5", Integer.toString(REP.REPCMD_INSERT),"TEST2","2","6", @@ -61,13 +61,11 @@ LinkedList<REPCommand> optimize(LinkedList<REPCommand> inp){ LinkedList<REPCommand> output = new LinkedList<REPCommand>(); LinkedList<REPCommand> input = new LinkedList<REPCommand>(); - /*for(int i = 0; i < inp.size(); i++){ - output.add(inp.get(i)); - }*/ output = reverse(inp); input = reverse(inp); for(int i = 0; i < input.size(); i++){ REPCommand r = input.get(i); + //REPCommand d = output.get(i); switch(r.cmd){ case REP.REPCMD_INSERT: break; @@ -76,7 +74,6 @@ break; } } - //return input; return reverse(output); } @@ -89,23 +86,21 @@ } private void optimizedAddDelete(LinkedList<REPCommand> output, REPCommand r, int ln) { int lineno = r.lineno; + REPCommand d = output.get(ln); for(int i = ln; i < output.size(); i++){ REPCommand s = output.get(i); switch(s.cmd){ case REP.REPCMD_INSERT: if(s.lineno < lineno){ s.lineno ++; - if(s.lineno == lineno){ + output.remove(d); output.remove(s); i = output.size(); } } break; case REP.REPCMD_DELETE: - /*if(s.lineno == lineno){ - input.remove(s); - }*/ break; } }