# HG changeset patch # User sugi # Date 1364550835 -32400 # Node ID 2cc9f1e0cb4344adb0db4efe467b663504571761 # Parent bc451bb72d5a526da77fcbffb80bc4e8638f9153 refactor and add comment diff -r bc451bb72d5a -r 2cc9f1e0cb43 src/alice/test/codesegment/local/bitonicsort/OddPhase.java --- a/src/alice/test/codesegment/local/bitonicsort/OddPhase.java Fri Mar 29 18:33:11 2013 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -package alice.test.codesegment.local.bitonicsort; - -import alice.codesegment.CodeSegment; -import alice.datasegment.CommandType; -import alice.datasegment.Receiver; - -public class OddPhase extends CodeSegment{ - private Receiver info0 = ids.create(CommandType.PEEK); // range - private Receiver info1; // Array1 - private Receiver info2; // Array2 - private Receiver info3 = ids.create(CommandType.PEEK); // block_num - //private Receiver info4 = ids.create(CommandType.PEEK); // last_block_num - private Receiver info5 = ids.create(CommandType.PEEK); // sort_count - private Receiver info6 = ids.create(CommandType.TAKE); // count - - - public OddPhase(String key0,String key1,String key2,int index,String key6){ - info0.setKey(key0); - info1 = ids.create(CommandType.TAKE); - info1.setKey(key1,index); - info2 = ids.create(CommandType.TAKE); - info2.setKey(key2,index); - info3.setKey("block_num"); - info5.setKey("sort_count"); - info6.setKey(key6); - } - - @Override - public void run() { - RangeInfo info = info0.asClass(RangeInfo.class); - DataList list1 = info1.asClass(DataList.class); - DataList list2 = info2.asClass(DataList.class); - int sort_count = info5.asInteger(); - int count = info6.asInteger(); - - int i = info.range; - //System.out.println("CS"+i+" "+info1.key+" "+info2.key+" dataIndex "+info1.index +" count "+count); - Sort.quickSort(list1); - Sort.quickSort(list2); - DataList.merge(list1,list2); - - if (count%2==0&&i==0){ - ods.flip(info1); - } else if (count%2==0&&info.lastFlag){ - ods.flip(info2); - } - - ods.flip(info1); - ods.flip(info2); - - if (count+1>=sort_count/2){ - - } else if (count%2==0&&info.lastFlag&&count+2=sort_count/2){ + + } else if (count%2==0&&info.lastFlag&&count+2