Mercurial > hg > Members > tatsuki > Alice
changeset 215:1fd7067f0044 working
remove conversion flag
author | one |
---|---|
date | Wed, 27 Mar 2013 18:35:43 +0900 |
parents | fec0726bb126 |
children | 21bd8af1cf26 |
files | src/alice/codesegment/OutputDataSegment.java src/alice/codesegment/ReceiveLocalData.java src/alice/datasegment/LocalDataSegmentManager.java src/alice/datasegment/ReceiveRemoteData.java src/alice/datasegment/Receiver.java src/alice/datasegment/ReceiverData.java src/alice/test/codesegment/api/FlipCodeSegment.java src/alice/test/codesegment/local/bitonicsort/MakeData.java src/alice/test/codesegment/local/bitonicsort/SetInfo.java src/alice/test/codesegment/local/bitonicsort/SetTask.java |
diffstat | 10 files changed, 119 insertions(+), 94 deletions(-) [+] |
line wrap: on
line diff
--- a/src/alice/codesegment/OutputDataSegment.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/codesegment/OutputDataSegment.java Wed Mar 27 18:35:43 2013 +0900 @@ -10,129 +10,139 @@ import alice.datasegment.Receiver; public class OutputDataSegment { - + /** * for local */ - public <T> void put(String key, T val,Boolean covertFlag) { - if (covertFlag){ - put(key, val); - } else { - DataSegment.getLocal().put(key, val); - } + + public void flip(Receiver receiver) { + DataSegment.getLocal().putObject(receiver.key, receiver.getObj()); } - - public <T> void update(String key, T val,Boolean covertFlag) { - if (covertFlag){ - update(key, val); - } else { - DataSegment.getLocal().update(key, val); - } + + public void put(String key, String val) { + DataSegment.getLocal().putObject(key, val); } - - public void flip(Receiver receiver) { - DataSegment.getLocal().put(receiver.key, receiver.getVal()); - } - - public void put(String key, Value val) { - DataSegment.getLocal().put(key, val); + + public void put(String key, byte[] val) { + DataSegment.getLocal().putObject(key, val); } - - public void put(String key, String val) { - DataSegment.getLocal().put(key, ValueFactory.createRawValue(val)); - } - - public void put(String key, byte[] val) { - DataSegment.getLocal().put(key, ValueFactory.createRawValue(val, true)); + + public void put(String key, int val) { + DataSegment.getLocal().putObject(key, val); } - - public void put(String key, int val) { - DataSegment.getLocal().put(key, ValueFactory.createIntegerValue(val)); - } - + public <T> void put(String key, T val) { - DataSegment.getLocal().put(key, (Object)val); + DataSegment.getLocal().putObject(key, val); } - - public void update(String key, Value val) { - DataSegment.getLocal().update(key, val); - } - + public void update(String key, String val) { - DataSegment.getLocal().update(key, ValueFactory.createRawValue(val)); + DataSegment.getLocal().updateObject(key, val); } - + public void update(String key, byte[] val) { - DataSegment.getLocal().update(key, ValueFactory.createRawValue(val, true)); + DataSegment.getLocal().updateObject(key, val); } - + public void update(String key, int val) { - DataSegment.getLocal().update(key, ValueFactory.createIntegerValue(val)); + DataSegment.getLocal().updateObject(key, val); } - + public <T> void update(String key, T val) { - DataSegment.getLocal().update(key, (Object)val); + DataSegment.getLocal().updateObject(key, val); } - - + + /** * for remote */ - + public void put(String managerKey, String key, Value val) { DataSegment.get(managerKey).put(key, val); } - + public void put(String managerKey, String key, String val) { - DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val)); - } - - public void put(String managerKey, String key, byte[] val) { - DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val, true)); + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val)); + } else { + put(key, val); + } + } - - public void put(String managerKey, String key, int val) { - DataSegment.get(managerKey).put(key, ValueFactory.createIntegerValue(val)); - } - - public <T> void put(String managerKey, String key, T val) { - try { - DataSegment.get(managerKey).put(key, SingletonMessage.getInstance().unconvert(val)); - } catch (IOException e) { - e.printStackTrace(); + + public void put(String managerKey, String key, byte[] val) { + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).put(key, ValueFactory.createRawValue(val, true)); + } else { + put(key, val); } } - + + public void put(String managerKey, String key, int val) { + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).put(key, ValueFactory.createIntegerValue(val)); + } else { + put(key, val); + } + } + + public <T> void put(String managerKey, String key, T val) { + if (!managerKey.equals("local")){ + try { + DataSegment.get(managerKey).put(key, SingletonMessage.getInstance().unconvert(val)); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + put(key, val); + } + } + public void update(String managerKey, String key, Value val) { DataSegment.get(managerKey).update(key, val); } - + public void update(String managerKey, String key, String val) { - DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val)); - } - - public void update(String managerKey, String key, byte[] val) { - DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val, true)); + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val)); + } else { + update(key, val); + } } - - public void update(String managerKey, String key, int val) { - DataSegment.get(managerKey).update(key, ValueFactory.createIntegerValue(val)); - } - - public <T> void update(String managerKey, String key, T val) { - try { - DataSegment.get(managerKey).update(key, SingletonMessage.getInstance().unconvert(val)); - } catch (IOException e) { - e.printStackTrace(); + + public void update(String managerKey, String key, byte[] val) { + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).update(key, ValueFactory.createRawValue(val, true)); + } else { + update(key, val); } } - + + public void update(String managerKey, String key, int val) { + if (!managerKey.equals("local")){ + DataSegment.get(managerKey).update(key, ValueFactory.createIntegerValue(val)); + } else { + update(key, val); + } + } + + public <T> void update(String managerKey, String key, T val) { + if (!managerKey.equals("local")){ + try { + DataSegment.get(managerKey).update(key, SingletonMessage.getInstance().unconvert(val)); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + update(key, val); + } + } + /** * kill the Alice process after send other messages. * * @param managerKey */ - + public void finish(String managerKey) { DataSegment.get(managerKey).finish(); } @@ -142,13 +152,13 @@ * * @param managerKey */ - + public void close(String managerKey) { DataSegment.get(managerKey).close(); } - + - + }
--- a/src/alice/codesegment/ReceiveLocalData.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/codesegment/ReceiveLocalData.java Wed Mar 27 18:35:43 2013 +0900 @@ -46,4 +46,9 @@ } return null; } + + @Override + public Object getObj() { + return obj; + } }
--- a/src/alice/datasegment/LocalDataSegmentManager.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/datasegment/LocalDataSegmentManager.java Wed Mar 27 18:35:43 2013 +0900 @@ -68,7 +68,7 @@ logger.debug(cmd.getCommandString()); } - public void put(String key, Object obj) { + public void putObject(String key, Object obj) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); Command cmd = new Command(CommandType.PUT, null, key, obj, 0, 0, null, null, reverseKey); addCommand(dataSegmentKey, cmd); @@ -88,7 +88,7 @@ logger.debug(cmd.getCommandString()); } - public void update(String key, Object val) { + public void updateObject(String key, Object val) { DataSegmentKey dataSegmentKey = getDataSegmentKey(key); Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, null, null, reverseKey); addCommand(dataSegmentKey, cmd);
--- a/src/alice/datasegment/ReceiveRemoteData.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/datasegment/ReceiveRemoteData.java Wed Mar 27 18:35:43 2013 +0900 @@ -60,5 +60,10 @@ public Value getVal() { return val; } + + @Override + public Object getObj() { + return val; + } } \ No newline at end of file
--- a/src/alice/datasegment/Receiver.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/datasegment/Receiver.java Wed Mar 27 18:35:43 2013 +0900 @@ -79,5 +79,9 @@ public int asInteger(Receiver receiver) { return data.asInteger(receiver); } + + public Object getObj() { + return data.getObj(); + } }
--- a/src/alice/datasegment/ReceiverData.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/datasegment/ReceiverData.java Wed Mar 27 18:35:43 2013 +0900 @@ -11,5 +11,6 @@ public ArrayValue asArray(Receiver receiver); public <T> T asClass(Receiver receiver, Class<T> clazz); public Value getVal(); + public Object getObj(); } \ No newline at end of file
--- a/src/alice/test/codesegment/api/FlipCodeSegment.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/test/codesegment/api/FlipCodeSegment.java Wed Mar 27 18:35:43 2013 +0900 @@ -12,7 +12,7 @@ @Override public void run() { Integer num = new Integer(0); - ods.put(key, num, false); + ods.put(key, num); //System.out.println("Key is " +key); new FlipTest(key);
--- a/src/alice/test/codesegment/local/bitonicsort/MakeData.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/MakeData.java Wed Mar 27 18:35:43 2013 +0900 @@ -26,6 +26,6 @@ for (int i = 0; i < size; i++){ list.table[i] = rnd.nextInt(100000); } - ods.update("list", list, false); + ods.update("list", list); } }
--- a/src/alice/test/codesegment/local/bitonicsort/SetInfo.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/SetInfo.java Wed Mar 27 18:35:43 2013 +0900 @@ -16,7 +16,7 @@ @Override public void run() { ods.put("sortconf", conf); - ods.put("data", new DataList(conf.length), false); + ods.put("data", new DataList(conf.length)); // sortconf and datasegments should be passed directory. create_keys();
--- a/src/alice/test/codesegment/local/bitonicsort/SetTask.java Wed Mar 27 18:16:34 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/SetTask.java Wed Mar 27 18:35:43 2013 +0900 @@ -35,8 +35,8 @@ for (i = 0;i< sort_count/2; i++){ // anonymas datasegmaents should be used. ods.put(SetInfo.range[i], new RangeInfo(i,i==sort_count-1)); - ods.update(SetInfo.array[i*2], list.createDataList(i*2*block_num, block_num) ,false); - ods.update(SetInfo.array[i*2+1], list.createDataList((i*2+1)*block_num, block_num) ,false); + ods.update(SetInfo.array[i*2], list.createDataList(i*2*block_num, block_num)); + ods.update(SetInfo.array[i*2+1], list.createDataList((i*2+1)*block_num, block_num)); ods.update(SetInfo.count[i], 0); new OddPhase(SetInfo.range[i],SetInfo.array[i*2],SetInfo.array[i*2+1],0,SetInfo.count[i]); }