[Swift-commit] r4748 - trunk/src/org/griphyn/vdl/mapping
hategan at ci.uchicago.edu
hategan at ci.uchicago.edu
Sun Jul 3 01:49:23 CDT 2011
Author: hategan
Date: 2011-07-03 01:49:23 -0500 (Sun, 03 Jul 2011)
New Revision: 4748
Modified:
trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
Log:
why were we instantiating an empty HashMap (5*pointer + one [16] array) for non-composite data?
Modified: trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java 2011-07-03 05:55:00 UTC (rev 4747)
+++ trunk/src/org/griphyn/vdl/mapping/AbstractDataNode.java 2011-07-03 06:49:23 UTC (rev 4748)
@@ -5,6 +5,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -22,6 +23,7 @@
import org.griphyn.vdl.util.VDL2Config;
+
public abstract class AbstractDataNode implements DSHandle {
static final String DATASET_URI_PREFIX = "dataset:";
@@ -61,7 +63,12 @@
protected AbstractDataNode(Field field) {
this.field = field;
- handles = new HashMap<Comparable<?>, DSHandle>();
+ if (field.getType().isComposite()) {
+ handles = new HashMap<Comparable<?>, DSHandle>();
+ }
+ else {
+ handles = Collections.emptyMap();
+ }
}
public void init(Map<String, Object> params) {
Modified: trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java 2011-07-03 05:55:00 UTC (rev 4747)
+++ trunk/src/org/griphyn/vdl/mapping/RootArrayDataNode.java 2011-07-03 06:49:23 UTC (rev 4748)
@@ -23,8 +23,7 @@
* Instantiate a root array data node with specified type.
*/
public RootArrayDataNode(Type type) {
- super(Field.Factory.newInstance(), null, null);
- getField().setType(type);
+ super(Field.Factory.createField(null, type), null, null);
}
public void init(Map<String, Object> params) {
Modified: trunk/src/org/griphyn/vdl/mapping/RootDataNode.java
===================================================================
--- trunk/src/org/griphyn/vdl/mapping/RootDataNode.java 2011-07-03 05:55:00 UTC (rev 4747)
+++ trunk/src/org/griphyn/vdl/mapping/RootDataNode.java 2011-07-03 06:49:23 UTC (rev 4748)
@@ -31,8 +31,7 @@
}
public RootDataNode(Type type) {
- super(Field.Factory.newInstance());
- getField().setType(type);
+ super(Field.Factory.createField(null, type));
}
public void init(Map<String,Object> params) {
More information about the Swift-commit
mailing list