diff src/alice/test/codesegment/api/StartCodeSegment.java @ 290:4074077d118d

Refactor iterating process with for-each sentence.
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Fri, 18 Oct 2013 03:26:38 +0900
parents e4a5da56b394
children
line wrap: on
line diff
--- a/src/alice/test/codesegment/api/StartCodeSegment.java	Fri Oct 18 03:22:37 2013 +0900
+++ b/src/alice/test/codesegment/api/StartCodeSegment.java	Fri Oct 18 03:26:38 2013 +0900
@@ -18,38 +18,35 @@
 
 	@Override
 	public void run() {
-		for (int i = 0;i<args.length;i++){
-			if ("-update".equals(args[i])){
+		for (String arg : args) {
+			if ("-update".equals(arg)) {
 				UpdateCodeSegment cs1 = new UpdateCodeSegment();
 				cs1.ds1.setKey("key");
 				int[] array = new int[65536];
 				array[0] = 0;
-				ods.update("local", "key", array); 
-				
-			} else if ("-put".equals(args[i])){
+				ods.update("local", "key", array);
+
+			} else if ("-put".equals(arg)) {
 				new PutCodeSegment().execute();
-				
-			} else if ("-take".equals(args[i])){
+
+			} else if ("-take".equals(arg)) {
 				new PutCodeSegment().execute();
 				new TakeCodeSegment("num");
-				
-			} else if ("-flip".equals(args[i])){
+
+			} else if ("-flip".equals(arg)) {
 				new FlipCodeSegment("key").execute();
-			} else if ("-peek".equals(args[i])){
+			} else if ("-peek".equals(arg)) {
 				System.out.println("start peek Test");
 				String key = "peek";
 				int size = 100000;
 				DataList list = new DataList(size);
 				Random rnd = new Random();
-				for (int cnt = 0; cnt < size; cnt++){
-					list.table[cnt] = rnd.nextInt(100000)+10;
+				for (int cnt = 0; cnt < size; cnt++) {
+					list.table[cnt] = rnd.nextInt(100000) + 10;
 				}
 				ods.put(key, list);
 				new PeekCodeSegment(key);
-				
 			}
-			
-			
 		}
 		 
 	}