Mercurial > hg > Members > tatsuki > Alice
changeset 216:21bd8af1cf26 working
change asClass method
line wrap: on
line diff
--- a/src/alice/codesegment/ReceiveLocalData.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/codesegment/ReceiveLocalData.java Wed Mar 27 19:38:33 2013 +0900 @@ -32,7 +32,7 @@ } @SuppressWarnings("unchecked") - public <T> T asClass(Receiver receiver, Class<T> clazz) { + public <T> T asClass(Class<T> clazz) { return (T) obj; } @@ -51,4 +51,5 @@ public Object getObj() { return obj; } + }
--- a/src/alice/datasegment/ReceiveRemoteData.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/datasegment/ReceiveRemoteData.java Wed Mar 27 19:38:33 2013 +0900 @@ -46,7 +46,7 @@ return null; } - public <T> T asClass(Receiver receiver, Class<T> clazz) { + public <T> T asClass(Class<T> clazz) { try { return SingletonMessage.getInstance().convert(val, clazz); } catch (IOException e) {
--- a/src/alice/datasegment/Receiver.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/datasegment/Receiver.java Wed Mar 27 19:38:33 2013 +0900 @@ -72,8 +72,8 @@ return data.getVal(); } - public <T> T asClass(Receiver receiver, Class<T> clazz) { - return data.asClass(receiver, clazz); + public <T> T asClass(Class<T> clazz) { + return data.asClass(clazz); } public int asInteger(Receiver receiver) {
--- a/src/alice/datasegment/ReceiverData.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/datasegment/ReceiverData.java Wed Mar 27 19:38:33 2013 +0900 @@ -9,7 +9,7 @@ public int asInteger(Receiver receiver); public Float asFloat(Receiver receiver) ; public ArrayValue asArray(Receiver receiver); - public <T> T asClass(Receiver receiver, Class<T> clazz); + public <T> T asClass(Class<T> clazz); public Value getVal(); public Object getObj();
--- a/src/alice/test/codesegment/local/bitonicsort/MakeData.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/MakeData.java Wed Mar 27 19:38:33 2013 +0900 @@ -19,8 +19,8 @@ @Override public void run() { // This conversion over head should be remove. - SortConfig conf = info1.asClass(info1, SortConfig.class); - DataList list = info2.asClass(info2, DataList.class); + SortConfig conf = info1.asClass(SortConfig.class); + DataList list = info2.asClass(DataList.class); int size = conf.getLength(); Random rnd = new Random(); for (int i = 0; i < size; i++){
--- a/src/alice/test/codesegment/local/bitonicsort/OddPhase.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/OddPhase.java Wed Mar 27 19:38:33 2013 +0900 @@ -27,15 +27,15 @@ @Override public void run() { - RangeInfo info = info0.asClass(info0, RangeInfo.class); + RangeInfo info = info0.asClass(RangeInfo.class); int sort_count = info5.asInteger(info5); int count = info6.asInteger(info6); //System.out.println("count is " +count); int i = info.range; if (count<sort_count){ - DataList list1 = info1.asClass(info1, DataList.class); - DataList list2 = info2.asClass(info1, DataList.class); + DataList list1 = info1.asClass(DataList.class); + DataList list2 = info2.asClass(DataList.class); Sort.quickSort(list1,0,list1.table.length-1); Sort.quickSort(list2,0,list2.table.length-1);
--- a/src/alice/test/codesegment/local/bitonicsort/SetTask.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/SetTask.java Wed Mar 27 19:38:33 2013 +0900 @@ -16,8 +16,8 @@ @Override public void run() { - SortConfig conf = info1.asClass(info1, SortConfig.class); - DataList list = info2.asClass(info1, DataList.class); + SortConfig conf = info1.asClass(SortConfig.class); + DataList list = info2.asClass(DataList.class); int sort_count = conf.getSplitNum()*2; ods.put("sort_count", sort_count*2);
--- a/src/alice/test/codesegment/local/bitonicsort/ShowData.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/codesegment/local/bitonicsort/ShowData.java Wed Mar 27 19:38:33 2013 +0900 @@ -26,7 +26,7 @@ int size = 0; for (int i= 0;i < cnt; i++){ - DataList dlist = info[i].asClass(info[i], DataList.class); + DataList dlist = info[i].asClass(DataList.class); size += dlist.table.length; } @@ -34,7 +34,7 @@ int start = 0; for (int i= 0;i < cnt; i++){ - DataList dlist = info[i].asClass(info[i], DataList.class); + DataList dlist = info[i].asClass(DataList.class); System.arraycopy(dlist.table, 0, list.table, start, dlist.table.length); start += dlist.table.length; }
--- a/src/alice/test/topology/aquarium/AutoIncrement.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/topology/aquarium/AutoIncrement.java Wed Mar 27 19:38:33 2013 +0900 @@ -19,7 +19,7 @@ @Override public void run() { max = this.number.data.asInteger(this.number)*2-1+0.3f; - FishPoint fp = this.position.data.asClass(this.position, FishPoint.class); + FishPoint fp = this.position.data.asClass(FishPoint.class); if (fp.getX()+0.01>max){ fp.setXYZ(min, fp.getY(), fp.getZ()); } else if (fp.getX()+0.01< min){
--- a/src/alice/test/topology/aquarium/CheckLocalIndex.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/topology/aquarium/CheckLocalIndex.java Wed Mar 27 19:38:33 2013 +0900 @@ -17,7 +17,7 @@ @Override public void run() { - RoutingTable rt = this.list.data.asClass(this.list, RoutingTable.class); + RoutingTable rt = this.list.asClass(RoutingTable.class); for (Routing r : rt.table) { if (!r.name.equals(this.data.from)){ ods.update(r.name, data.key, this.data.getVal());
--- a/src/alice/test/topology/aquarium/SendLocation.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/topology/aquarium/SendLocation.java Wed Mar 27 19:38:33 2013 +0900 @@ -21,7 +21,7 @@ @Override public void run() { - FishPoint fp = this.position.data.asClass(this.position, FishPoint.class); + FishPoint fp = this.position.data.asClass(FishPoint.class); fp.setXYZ(fp.getX()+x, fp.getY()+y, fp.getZ()+z); ods.update("local", "fish", fp);
--- a/src/alice/test/topology/aquarium/SetLocation.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/topology/aquarium/SetLocation.java Wed Mar 27 19:38:33 2013 +0900 @@ -19,7 +19,7 @@ @Override public void run(){ - FishPoint fp = this.position.data.asClass(this.position, FishPoint.class); + FishPoint fp = this.position.asClass(FishPoint.class); obj.setLocation(fp.getX(), fp.getY(), fp.getZ()); new SetLocation(obj, position.key, position.index, range);
--- a/src/alice/test/topology/fish/AsignStartX.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/topology/fish/AsignStartX.java Wed Mar 27 19:38:33 2013 +0900 @@ -19,7 +19,7 @@ public void run() { System.out.println("AsignStartX: " + startX); - RoutingTable routing = this.routing.asClass(this.routing, RoutingTable.class); + RoutingTable routing = this.routing.asClass(RoutingTable.class); int x = startX; System.out.println("RoutingTable: " + this.routing.getVal()); if (this.index >= this.routing.index) {
--- a/src/alice/test/topology/fish/WidthReceiver.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/topology/fish/WidthReceiver.java Wed Mar 27 19:38:33 2013 +0900 @@ -16,7 +16,7 @@ public void run() { int width = this.widths.asInteger(this.widths); String from = this.widths.from; - RoutingTable routing = this.routing.asClass(this.routing, RoutingTable.class); + RoutingTable routing = this.routing.asClass(RoutingTable.class); Routing newRouting = new Routing(from, width); boolean update = false; for (Routing r : routing.table) {
--- a/src/alice/test/topology/share/CheckLocalIndex.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/topology/share/CheckLocalIndex.java Wed Mar 27 19:38:33 2013 +0900 @@ -22,7 +22,7 @@ @Override public void run() { - RoutingTable rt = this.list.data.asClass(this.list, RoutingTable.class); + RoutingTable rt = this.list.asClass(RoutingTable.class); int count = 0; boolean flag = false; for (Routing r : rt.table) {
--- a/src/alice/test/topology/share/LookUpData.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/test/topology/share/LookUpData.java Wed Mar 27 19:38:33 2013 +0900 @@ -24,7 +24,7 @@ @Override public void run(){ new LookUpData(this.key,this.data.index); - DataInfo di = data.data.asClass(data, DataInfo.class); + DataInfo di = data.data.asClass(DataInfo.class); System.out.println(System.nanoTime()-di.getTime()); }
--- a/src/alice/topology/manager/IncomingHosts.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/topology/manager/IncomingHosts.java Wed Mar 27 19:38:33 2013 +0900 @@ -24,7 +24,7 @@ @Override public void run() { - HostMessage host = this.host.data.asClass(this.host, HostMessage.class); + HostMessage host = this.host.asClass(HostMessage.class); String nodeName = nodeNames.poll(); // Manager connect to Node DataSegment.connect(nodeName, "", host.name, host.port);
--- a/src/alice/topology/node/IncomingConnectionInfo.java Wed Mar 27 18:35:43 2013 +0900 +++ b/src/alice/topology/node/IncomingConnectionInfo.java Wed Mar 27 19:38:33 2013 +0900 @@ -24,7 +24,7 @@ return; } - HostMessage hostInfo = this.hostInfo.asClass(this.hostInfo, HostMessage.class); + HostMessage hostInfo = this.hostInfo.asClass(HostMessage.class); DataSegment.connect(hostInfo.connectionName, hostInfo.reverseName, hostInfo.name, hostInfo.port); ods.put(hostInfo.connectionName, "reverseKey", hostInfo.reverseName);