Removed superfluous System.out in WordTokenizerTest. Added ArrayTupleReference for convenience.

git-svn-id: https://hyracks.googlecode.com/svn/trunk@605 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/ArrayTupleReference.java b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/ArrayTupleReference.java
new file mode 100644
index 0000000..b265283
--- /dev/null
+++ b/hyracks/hyracks-dataflow-common/src/main/java/edu/uci/ics/hyracks/dataflow/common/comm/io/ArrayTupleReference.java
@@ -0,0 +1,41 @@
+package edu.uci.ics.hyracks.dataflow.common.comm.io;
+
+import edu.uci.ics.hyracks.dataflow.common.data.accessors.ITupleReference;
+
+/**
+ * An ArrayTupleReference provides access to a tuple that is not serialized into
+ * a frame. It is meant to be reset directly with the field slots and tuple data
+ * provided by ArrayTupleBuilder. The purpose is to avoid coping the built tuple
+ * into a frame before being able to use it as an ITupleReference.
+ * 
+ * @author alexander.behm
+ */
+public class ArrayTupleReference implements ITupleReference {
+	private int[] fEndOffsets;
+	private byte[] tupleData;
+
+	public void reset(int[] fEndOffsets, byte[] tupleData) {
+		this.fEndOffsets = fEndOffsets;
+		this.tupleData = tupleData;
+	}
+	
+	@Override
+	public int getFieldCount() {
+		return fEndOffsets.length;
+	}
+
+	@Override
+	public byte[] getFieldData(int fIdx) {
+		return tupleData;
+	}
+
+	@Override
+	public int getFieldStart(int fIdx) {
+		return (fIdx == 0) ? 0 : fEndOffsets[fIdx - 1]; 
+	}
+
+	@Override
+	public int getFieldLength(int fIdx) {
+		return (fIdx == 0) ? fEndOffsets[0] : fEndOffsets[fIdx] - fEndOffsets[fIdx - 1];
+	}
+}
diff --git a/hyracks/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/WordTokenizerTest.java b/hyracks/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/WordTokenizerTest.java
index b31205f..53fb96d 100644
--- a/hyracks/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/WordTokenizerTest.java
+++ b/hyracks/hyracks-tests/hyracks-storage-am-invertedindex-test/src/test/java/edu/uci/ics/hyracks/storage/am/invertedindex/WordTokenizerTest.java
@@ -139,8 +139,6 @@
 
             Integer hashedToken = in.readInt();
 
-            // System.out.println(hashedToken);
-
             Assert.assertEquals(hashedToken, expectedCountedHashedUTF8Tokens.get(tokenCount));
 
             tokenCount++;
@@ -173,8 +171,6 @@
 
             Integer hashedToken = in.readInt();
 
-            // System.out.println(hashedToken);
-
             Assert.assertEquals(expectedHashedUTF8Tokens.get(tokenCount), hashedToken);
 
             tokenCount++;
@@ -207,23 +203,19 @@
 
             String strToken = in.readUTF();
 
-            // System.out.println(strToken);
-
             Assert.assertEquals(expectedUTF8Tokens.get(tokenCount), strToken);
 
             tokenCount++;
         }
     }
 
-    // JAQL
+    // JAQL Hash
     public int tokenHash(String token, int tokenCount) {
         int h = AbstractUTF8Token.GOLDEN_RATIO_32;
         for (int i = 0; i < token.length(); i++) {
-            System.out.print((int)token.charAt(i) + " ");
         	h ^= token.charAt(i);
             h *= AbstractUTF8Token.GOLDEN_RATIO_32;
         }
-        System.out.println("CHK");
         return h + tokenCount;
     }
 }