changeset 174:d234a9d2a172

*** empty log message ***
author tkaito
date Sat, 30 Aug 2008 11:35:11 +0900
parents b4f2c0aeb474
children db798192c966
files src/pathfinder/mergetest/test/RepCommandOptimizeTest.java
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/pathfinder/mergetest/test/RepCommandOptimizeTest.java	Sat Aug 30 01:55:39 2008 +0900
+++ b/src/pathfinder/mergetest/test/RepCommandOptimizeTest.java	Sat Aug 30 11:35:11 2008 +0900
@@ -107,6 +107,7 @@
 					}
 					output.remove(r);
 					output.remove(s);
+					lineNumberCorrection(output,minln,i);
 					break;
 				}
 				
@@ -119,19 +120,19 @@
 				System.out.println("There are no such commands.");
 			}
 		}	
-		lineNumberCorrection(output,minln);
+		
 	}
 	
-	private void lineNumberCorrection(LinkedList<REPCommand> opt, int ln) {
-		int i = 0;
-		for(REPCommand o : opt){
-			if(ln < o.lineno) i++;
+	private void lineNumberCorrection(LinkedList<REPCommand> opt, int ln, int count){
+		for(int i = 0; i < count; i++){
+			REPCommand o = opt.get(i);
+			if(ln < o.lineno) o.lineno -= 1;
 		}
-		if(i == opt.size()){
+		/*if(i == opt.size()){
 			for(REPCommand c : opt){
 				c.lineno -= 1;
 			}
-		}
+		}*/
 	}
 
 	void printCmdList(LinkedList<REPCommand> before){
@@ -178,7 +179,7 @@
 		
 		RepCommandOptimizeTest rco = new RepCommandOptimizeTest();
 		rco.makeCommand(test2);
-		java.util.Collections.shuffle(cmdlist);
+		//java.util.Collections.shuffle(cmdlist);
 		rco.printCmdList(cmdlist);
 		rco.edit(cmdlist,text1);
 		rco.printCmdList(rco.optimize(cmdlist));