[Swift-commit] r7170 - branches/release-0.94/src/org/griphyn/vdl/karajan/lib/swiftscript
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Wed Oct 16 14:26:07 CDT 2013
Author: hategan
Date: 2013-10-16 14:26:06 -0500 (Wed, 16 Oct 2013)
New Revision: 7170
Modified:
branches/release-0.94/src/org/griphyn/vdl/karajan/lib/swiftscript/WriteData.java
Log:
fixed assumption that keys are strings representing integers in writeData() (bug 1107)
Modified: branches/release-0.94/src/org/griphyn/vdl/karajan/lib/swiftscript/WriteData.java
===================================================================
--- branches/release-0.94/src/org/griphyn/vdl/karajan/lib/swiftscript/WriteData.java 2013-10-16 16:23:02 UTC (rev 7169)
+++ branches/release-0.94/src/org/griphyn/vdl/karajan/lib/swiftscript/WriteData.java 2013-10-16 19:26:06 UTC (rev 7170)
@@ -131,7 +131,7 @@
ExecutionException {
// this scheme currently only works properly if the keys are strings
Map<Comparable<?>, DSHandle> m = ((AbstractDataNode) src).getArrayValue();
- Map<Comparable<?>, DSHandle> c = new TreeMap<Comparable<?>, DSHandle>(new ArrayIndexComparator());
+ Map<Comparable<?>, DSHandle> c = new TreeMap<Comparable<?>, DSHandle>();
c.putAll(m);
for (DSHandle h : c.values()) {
br.write(h.getValue().toString());
@@ -143,7 +143,7 @@
ExecutionException {
writeStructHeader(src.getType().itemType(), br);
Map<Comparable<?>, DSHandle> m = ((AbstractDataNode) src).getArrayValue();
- Map<Comparable<?>, DSHandle> c = new TreeMap<Comparable<?>, DSHandle>(new ArrayIndexComparator());
+ Map<Comparable<?>, DSHandle> c = new TreeMap<Comparable<?>, DSHandle>();
c.putAll(m);
for (DSHandle h : c.values()) {
writeStruct(br, h);
@@ -172,14 +172,4 @@
throw new ExecutionException("Unexpectedly invalid path", e);
}
}
-
- class ArrayIndexComparator implements Comparator<Comparable<?>> {
- public int compare(Comparable<?> o1, Comparable<?> o2) {
- int i1 = Integer.parseInt(String.valueOf(o1));
- int i2 = Integer.parseInt(String.valueOf(o2));
- if(i1 < i2) return -1;
- if(i1 > i2) return 1;
- return 0;
- }
- }
}
More information about the Swift-commit
mailing list