You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2014/03/05 02:57:37 UTC
[11/14] git commit: Converted a search method to a hashing method.
Small improvement.
Converted a search method to a hashing method. Small improvement.
Project: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/commit/b3aee305
Tree: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/tree/b3aee305
Diff: http://git-wip-us.apache.org/repos/asf/incubator-vxquery/diff/b3aee305
Branch: refs/heads/prestonc/parser
Commit: b3aee30500fd262dd869aa4325a6effabb2fa823
Parents: 0383734
Author: Preston Carman <pr...@apache.org>
Authored: Mon Feb 17 08:55:02 2014 -0800
Committer: Preston Carman <pr...@apache.org>
Committed: Thu Feb 27 14:23:54 2014 -0800
----------------------------------------------------------------------
.../builders/nodes/DictionaryBuilder.java | 21 ++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-vxquery/blob/b3aee305/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
index db7ecf7..67a7ff8 100644
--- a/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
+++ b/vxquery-core/src/main/java/org/apache/vxquery/datamodel/builders/nodes/DictionaryBuilder.java
@@ -19,9 +19,13 @@ package org.apache.vxquery.datamodel.builders.nodes;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
-import java.util.Map.Entry;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
import java.util.TreeMap;
+import javax.swing.text.html.HTMLDocument.Iterator;
+
import org.apache.vxquery.util.GrowableIntArray;
import edu.uci.ics.hyracks.data.std.algorithms.BinarySearchAlgorithm;
@@ -42,6 +46,10 @@ public class DictionaryBuilder {
private final ByteArrayAccessibleOutputStream tempStringData;
+ private final DataOutput tempOut;
+
+ private final UTF8StringPointable tempStringPointable;
+
private final TreeMap<String, Integer> hashSlotIndexes;
private final IValueReferenceVector sortedStringsVector = new IValueReferenceVector() {
@@ -75,6 +83,8 @@ public class DictionaryBuilder {
dataBuffer = new ByteArrayAccessibleOutputStream();
dataBufferOut = new DataOutputStream(dataBuffer);
tempStringData = new ByteArrayAccessibleOutputStream();
+ tempOut = new DataOutputStream(tempStringData);
+ tempStringPointable = (UTF8StringPointable) UTF8StringPointable.FACTORY.createPointable();
hashSlotIndexes = new TreeMap<String, Integer>();
}
@@ -102,9 +112,16 @@ public class DictionaryBuilder {
out.writeInt(sortedOffsets[i]);
}
} else {
- for (Entry<String, Integer> me : hashSlotIndexes.entrySet()) {
+ // Get a set of the entries
+ Set set = hashSlotIndexes.entrySet();
+ // Get an iterator
+ java.util.Iterator it = set.iterator();
+ // Display elements
+ while (it.hasNext()) {
+ Map.Entry me = (Map.Entry) it.next();
out.writeInt((Integer) me.getValue());
}
+
}
out.write(dataBuffer.getByteArray(), 0, dataBuffer.size());
IntegerPointable.setInteger(abvs.getByteArray(), sizeOffset, abvs.getLength() - sizeOffset);