Merged fullstack_staging branch into trunk
git-svn-id: https://hyracks.googlecode.com/svn/trunk@2372 123451ca-8445-de46-9d55-352943316053
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/pom.xml b/fullstack/hyracks/hyracks-data/hyracks-data-std/pom.xml
new file mode 100644
index 0000000..13128ac
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/pom.xml
@@ -0,0 +1,32 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>hyracks-data-std</artifactId>
+ <name>hyracks-data-std</name>
+
+ <parent>
+ <groupId>edu.uci.ics.hyracks</groupId>
+ <artifactId>hyracks-data</artifactId>
+ <version>0.2.2-SNAPSHOT</version>
+ </parent>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>edu.uci.ics.hyracks</groupId>
+ <artifactId>hyracks-api</artifactId>
+ <version>0.2.2-SNAPSHOT</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/PointableBinaryComparatorFactory.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/PointableBinaryComparatorFactory.java
new file mode 100644
index 0000000..bab393e
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/PointableBinaryComparatorFactory.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.accessors;
+
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparator;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryComparatorFactory;
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public class PointableBinaryComparatorFactory implements IBinaryComparatorFactory {
+ private static final long serialVersionUID = 1L;
+
+ private final IPointableFactory pf;
+
+ public static PointableBinaryComparatorFactory of(IPointableFactory pf) {
+ return new PointableBinaryComparatorFactory(pf);
+ }
+
+ public PointableBinaryComparatorFactory(IPointableFactory pf) {
+ this.pf = pf;
+ }
+
+ @Override
+ public IBinaryComparator createBinaryComparator() {
+ final IPointable p = pf.createPointable();
+ return new IBinaryComparator() {
+ @Override
+ public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {
+ p.set(b1, s1, l1);
+ return ((IComparable) p).compareTo(b2, s2, l2);
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/PointableBinaryHashFunctionFactory.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/PointableBinaryHashFunctionFactory.java
new file mode 100644
index 0000000..fddbe3d
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/PointableBinaryHashFunctionFactory.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.accessors;
+
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFactory;
+import edu.uci.ics.hyracks.data.std.api.IHashable;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public class PointableBinaryHashFunctionFactory implements IBinaryHashFunctionFactory {
+ private static final long serialVersionUID = 1L;
+
+ private final IPointableFactory pf;
+
+ public static PointableBinaryHashFunctionFactory of(IPointableFactory pf) {
+ return new PointableBinaryHashFunctionFactory(pf);
+ }
+
+ public PointableBinaryHashFunctionFactory(IPointableFactory pf) {
+ this.pf = pf;
+ }
+
+ @Override
+ public IBinaryHashFunction createBinaryHashFunction() {
+ final IPointable p = pf.createPointable();
+ return new IBinaryHashFunction() {
+ @Override
+ public int hash(byte[] bytes, int offset, int length) {
+ p.set(bytes, offset, length);
+ return ((IHashable) p).hash();
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/UTF8StringBinaryHashFunctionFamily.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/UTF8StringBinaryHashFunctionFamily.java
new file mode 100644
index 0000000..8fd0116
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/accessors/UTF8StringBinaryHashFunctionFamily.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.accessors;
+
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunction;
+import edu.uci.ics.hyracks.api.dataflow.value.IBinaryHashFunctionFamily;
+import edu.uci.ics.hyracks.data.std.primitive.UTF8StringPointable;
+
+public class UTF8StringBinaryHashFunctionFamily implements IBinaryHashFunctionFamily {
+ public static final IBinaryHashFunctionFamily INSTANCE = new UTF8StringBinaryHashFunctionFamily();
+
+ private static final long serialVersionUID = 1L;
+
+ static final int[] primeCoefficents = { 31, 23, 53, 97, 71, 337, 11, 877, 3, 29 };
+
+ private UTF8StringBinaryHashFunctionFamily() {
+ }
+
+ @Override
+ public IBinaryHashFunction createBinaryHashFunction(int seed) {
+ final int coefficient = primeCoefficents[seed % primeCoefficents.length];
+ final int r = primeCoefficents[(seed + 1) % primeCoefficents.length];
+
+ return new IBinaryHashFunction() {
+ @Override
+ public int hash(byte[] bytes, int offset, int length) {
+ int h = 0;
+ int utflen = UTF8StringPointable.getUTFLength(bytes, offset);
+ int sStart = offset + 2;
+ int c = 0;
+
+ while (c < utflen) {
+ char ch = UTF8StringPointable.charAt(bytes, sStart + c);
+ h = (coefficient * h + ch) % r;
+ c += UTF8StringPointable.charSize(bytes, sStart + c);
+ }
+ return h;
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/algorithms/BinarySearchAlgorithm.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/algorithms/BinarySearchAlgorithm.java
new file mode 100644
index 0000000..e631428
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/algorithms/BinarySearchAlgorithm.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.algorithms;
+
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.collections.api.IValueReferenceVector;
+
+/**
+ * Performs Binary Search over a vector of value references.
+ * Assumption: The items in the vector are sorted in ascending order with respect
+ * to the specified key.
+ *
+ * @author vinayakb
+ */
+public class BinarySearchAlgorithm {
+ private int index;
+
+ public BinarySearchAlgorithm() {
+ }
+
+ /**
+ * Perform binary search on the given vector for the specified key. It returns the result of the search
+ * and sets the {@link #index} value that is retrievable by calling {@link #getIndex()} to refer to
+ * the index in the array where the key was found (if it was found), and where it should have been (if
+ * not found).
+ *
+ * @param vector
+ * - Sorted vector of items
+ * @param key
+ * - Search key
+ * @return <code>true</code> if the key is found, <code>false</code> otherwise.
+ */
+ public boolean find(IValueReferenceVector vector, IComparable key) {
+ index = 0;
+ int left = 0;
+ int right = vector.getSize() - 1;
+ while (left <= right) {
+ index = (left + right) / 2;
+ int cmp = key.compareTo(vector.getBytes(index), vector.getStart(index), vector.getLength(index));
+ if (cmp > 0) {
+ left = index + 1;
+ index = left;
+ } else if (cmp < 0) {
+ right = index - 1;
+ index = left;
+ } else {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Get the index as a result of binary search.
+ *
+ * @return the index in the array where the key was found (if it was found), and where it should have been (if
+ * not found).
+ */
+ public int getIndex() {
+ return index;
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/AbstractPointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/AbstractPointable.java
new file mode 100644
index 0000000..3ee6b0e
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/AbstractPointable.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.api;
+
+public abstract class AbstractPointable implements IPointable {
+ protected byte[] bytes;
+
+ protected int start;
+
+ protected int length;
+
+ @Override
+ public void set(byte[] bytes, int start, int length) {
+ this.bytes = bytes;
+ this.start = start;
+ this.length = length;
+ }
+
+ @Override
+ public void set(IValueReference pointer) {
+ set(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
+ }
+
+ @Override
+ public byte[] getByteArray() {
+ return bytes;
+ }
+
+ @Override
+ public int getStartOffset() {
+ return start;
+ }
+
+ @Override
+ public int getLength() {
+ return length;
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IComparable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IComparable.java
new file mode 100644
index 0000000..d68f356
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IComparable.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.api;
+
+public interface IComparable {
+ public int compareTo(IPointable pointer);
+
+ public int compareTo(byte[] bytes, int start, int length);
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IDataOutputProvider.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IDataOutputProvider.java
new file mode 100644
index 0000000..d64a23a
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IDataOutputProvider.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.api;
+
+import java.io.DataOutput;
+
+public interface IDataOutputProvider {
+ public DataOutput getDataOutput();
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IHashable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IHashable.java
new file mode 100644
index 0000000..3385298
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IHashable.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.api;
+
+public interface IHashable {
+ public int hash();
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IMutableValueStorage.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IMutableValueStorage.java
new file mode 100644
index 0000000..173a4e6
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IMutableValueStorage.java
@@ -0,0 +1,5 @@
+package edu.uci.ics.hyracks.data.std.api;
+
+public interface IMutableValueStorage extends IValueReference, IDataOutputProvider {
+ public void reset();
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/INumeric.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/INumeric.java
new file mode 100644
index 0000000..72fc221
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/INumeric.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.api;
+
+public interface INumeric {
+ public byte byteValue();
+
+ public short shortValue();
+
+ public int intValue();
+
+ public long longValue();
+
+ public float floatValue();
+
+ public double doubleValue();
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IPointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IPointable.java
new file mode 100644
index 0000000..d3accba
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IPointable.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.api;
+
+public interface IPointable extends IValueReference {
+ public void set(byte[] bytes, int start, int length);
+
+ public void set(IValueReference pointer);
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IPointableFactory.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IPointableFactory.java
new file mode 100644
index 0000000..41895a1
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IPointableFactory.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.api;
+
+import java.io.Serializable;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+
+public interface IPointableFactory extends Serializable {
+ public IPointable createPointable();
+
+ public ITypeTraits getTypeTraits();
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IValueReference.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IValueReference.java
new file mode 100644
index 0000000..ebe8e1f
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/api/IValueReference.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.api;
+
+public interface IValueReference {
+ public byte[] getByteArray();
+
+ public int getStartOffset();
+
+ public int getLength();
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/collections/api/IValueReferenceVector.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/collections/api/IValueReferenceVector.java
new file mode 100644
index 0000000..090f9d4
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/collections/api/IValueReferenceVector.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.collections.api;
+
+/**
+ * Represents an immutable vector of ValueReferences. Users of this interface make the assumption
+ * that it provides random access to the items in it. In other words, each of the getXXX(index) calls
+ * have O(1) complexity.
+ *
+ * @author vinayakb
+ */
+public interface IValueReferenceVector {
+ /**
+ * Number of items in this vector.
+ *
+ * @return - the number of items in this vector.
+ */
+ public int getSize();
+
+ /**
+ * Get the byte array that contains the item referenced by <code>index</code>
+ *
+ * @param index
+ * - Index of the item in the vector
+ * @return Byte Array that contains the item.
+ */
+ public byte[] getBytes(int index);
+
+ /**
+ * Get the start offset of the item referenced by <code>index</code>
+ *
+ * @param index
+ * - Index of the item in the vector
+ * @return Start Offset in the Byte Array of the item
+ */
+ public int getStart(int index);
+
+ /**
+ * Get the length of the item referenced by <code>index</code>
+ *
+ * @param index
+ * - Index of the item in the vector
+ * @return Length in the Byte Array of the item
+ */
+ public int getLength(int index);
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/BooleanPointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/BooleanPointable.java
new file mode 100644
index 0000000..7a10a01
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/BooleanPointable.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.api.IHashable;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public final class BooleanPointable extends AbstractPointable implements IHashable, IComparable {
+ public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isFixedLength() {
+ return true;
+ }
+
+ @Override
+ public int getFixedLength() {
+ return 1;
+ }
+ };
+
+ public static final IPointableFactory FACTORY = new IPointableFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IPointable createPointable() {
+ return new BooleanPointable();
+ }
+
+ @Override
+ public ITypeTraits getTypeTraits() {
+ return TYPE_TRAITS;
+ }
+ };
+
+ public static boolean getBoolean(byte[] bytes, int start) {
+ return bytes[start] == 0 ? false : true;
+ }
+
+ public static void setBoolean(byte[] bytes, int start, boolean value) {
+ bytes[start] = (byte) (value ? 1 : 0);
+ }
+
+ public boolean getBoolean() {
+ return getBoolean(bytes, start);
+ }
+
+ public void setBoolean(boolean value) {
+ setBoolean(bytes, start, value);
+ }
+
+ @Override
+ public int compareTo(IPointable pointer) {
+ return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
+ }
+
+ @Override
+ public int compareTo(byte[] bytes, int start, int length) {
+ boolean b = getBoolean();
+ boolean ob = getBoolean(bytes, start);
+ return b == ob ? 0 : (b ? 1 : -1);
+ }
+
+ @Override
+ public int hash() {
+ return getBoolean() ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode();
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/BytePointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/BytePointable.java
new file mode 100644
index 0000000..a157d7e
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/BytePointable.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.api.IHashable;
+import edu.uci.ics.hyracks.data.std.api.INumeric;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public final class BytePointable extends AbstractPointable implements IHashable, IComparable, INumeric {
+ public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isFixedLength() {
+ return true;
+ }
+
+ @Override
+ public int getFixedLength() {
+ return 1;
+ }
+ };
+
+ public static final IPointableFactory FACTORY = new IPointableFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IPointable createPointable() {
+ return new BytePointable();
+ }
+
+ @Override
+ public ITypeTraits getTypeTraits() {
+ return TYPE_TRAITS;
+ }
+ };
+
+ public static byte getByte(byte[] bytes, int start) {
+ return bytes[start];
+ }
+
+ public static void setByte(byte[] bytes, int start, byte value) {
+ bytes[start] = value;
+ }
+
+ public byte getByte() {
+ return getByte(bytes, start);
+ }
+
+ public void setByte(byte value) {
+ setByte(bytes, start, value);
+ }
+
+ public byte preIncrement() {
+ byte v = getByte();
+ ++v;
+ setByte(v);
+ return v;
+ }
+
+ public byte postIncrement() {
+ byte v = getByte();
+ byte ov = v++;
+ setByte(v);
+ return ov;
+ }
+
+ @Override
+ public int compareTo(IPointable pointer) {
+ return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
+ }
+
+ @Override
+ public int compareTo(byte[] bytes, int start, int length) {
+ byte b = getByte();
+ byte ob = getByte(bytes, start);
+ return b < ob ? -1 : (b > ob ? 1 : 0);
+ }
+
+ @Override
+ public int hash() {
+ return getByte();
+ }
+
+ @Override
+ public byte byteValue() {
+ return getByte();
+ }
+
+ @Override
+ public short shortValue() {
+ return getByte();
+ }
+
+ @Override
+ public int intValue() {
+ return getByte();
+ }
+
+ @Override
+ public long longValue() {
+ return getByte();
+ }
+
+ @Override
+ public float floatValue() {
+ return getByte();
+ }
+
+ @Override
+ public double doubleValue() {
+ return getByte();
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/DoublePointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/DoublePointable.java
new file mode 100644
index 0000000..5267086
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/DoublePointable.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.api.IHashable;
+import edu.uci.ics.hyracks.data.std.api.INumeric;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public final class DoublePointable extends AbstractPointable implements IHashable, IComparable, INumeric {
+ public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isFixedLength() {
+ return true;
+ }
+
+ @Override
+ public int getFixedLength() {
+ return 8;
+ }
+ };
+
+ public static final IPointableFactory FACTORY = new IPointableFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IPointable createPointable() {
+ return new DoublePointable();
+ }
+
+ @Override
+ public ITypeTraits getTypeTraits() {
+ return TYPE_TRAITS;
+ }
+ };
+
+ public static long getLongBits(byte[] bytes, int start) {
+ return LongPointable.getLong(bytes, start);
+ }
+
+ public static double getDouble(byte[] bytes, int start) {
+ long bits = getLongBits(bytes, start);
+ return Double.longBitsToDouble(bits);
+ }
+
+ public static void setDouble(byte[] bytes, int start, double value) {
+ long bits = Double.doubleToLongBits(value);
+ LongPointable.setLong(bytes, start, bits);
+ }
+
+ public double getDouble() {
+ return getDouble(bytes, start);
+ }
+
+ public void setDouble(double value) {
+ setDouble(bytes, start, value);
+ }
+
+ public double preIncrement() {
+ double v = getDouble();
+ ++v;
+ setDouble(v);
+ return v;
+ }
+
+ public double postIncrement() {
+ double v = getDouble();
+ double ov = v++;
+ setDouble(v);
+ return ov;
+ }
+
+ @Override
+ public int compareTo(IPointable pointer) {
+ return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
+ }
+
+ @Override
+ public int compareTo(byte[] bytes, int start, int length) {
+ double v = getDouble();
+ double ov = getDouble(bytes, start);
+ return v < ov ? -1 : (v > ov ? 1 : 0);
+ }
+
+ @Override
+ public int hash() {
+ long bits = getLongBits(bytes, start);
+ return (int) (bits ^ (bits >>> 32));
+ }
+
+ @Override
+ public byte byteValue() {
+ return (byte) getDouble();
+ }
+
+ @Override
+ public short shortValue() {
+ return (short) getDouble();
+ }
+
+ @Override
+ public int intValue() {
+ return (int) getDouble();
+ }
+
+ @Override
+ public long longValue() {
+ return (long) getDouble();
+ }
+
+ @Override
+ public float floatValue() {
+ return (float) getDouble();
+ }
+
+ @Override
+ public double doubleValue() {
+ return getDouble();
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/FloatPointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/FloatPointable.java
new file mode 100644
index 0000000..c751f8b
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/FloatPointable.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.api.IHashable;
+import edu.uci.ics.hyracks.data.std.api.INumeric;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public final class FloatPointable extends AbstractPointable implements IHashable, IComparable, INumeric {
+ public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isFixedLength() {
+ return true;
+ }
+
+ @Override
+ public int getFixedLength() {
+ return 4;
+ }
+ };
+
+ public static final IPointableFactory FACTORY = new IPointableFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IPointable createPointable() {
+ return new FloatPointable();
+ }
+
+ @Override
+ public ITypeTraits getTypeTraits() {
+ return TYPE_TRAITS;
+ }
+ };
+
+ private static int getIntBits(byte[] bytes, int start) {
+ return IntegerPointable.getInteger(bytes, start);
+ }
+
+ public static float getFloat(byte[] bytes, int start) {
+ int bits = getIntBits(bytes, start);
+ return Float.intBitsToFloat(bits);
+ }
+
+ public static void setFloat(byte[] bytes, int start, float value) {
+ int bits = Float.floatToIntBits(value);
+ IntegerPointable.setInteger(bytes, start, bits);
+ }
+
+ public float getFloat() {
+ return getFloat(bytes, start);
+ }
+
+ public void setFloat(float value) {
+ setFloat(bytes, start, value);
+ }
+
+ public float preIncrement() {
+ float v = getFloat();
+ ++v;
+ setFloat(v);
+ return v;
+ }
+
+ public float postIncrement() {
+ float v = getFloat();
+ float ov = v++;
+ setFloat(v);
+ return ov;
+ }
+
+ @Override
+ public int compareTo(IPointable pointer) {
+ return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
+ }
+
+ @Override
+ public int compareTo(byte[] bytes, int start, int length) {
+ float v = getFloat();
+ float ov = getFloat(bytes, start);
+ return v < ov ? -1 : (v > ov ? 1 : 0);
+ }
+
+ @Override
+ public int hash() {
+ return getIntBits(bytes, start);
+ }
+
+ @Override
+ public byte byteValue() {
+ return (byte) getFloat();
+ }
+
+ @Override
+ public short shortValue() {
+ return (short) getFloat();
+ }
+
+ @Override
+ public int intValue() {
+ return (int) getFloat();
+ }
+
+ @Override
+ public long longValue() {
+ return (long) getFloat();
+ }
+
+ @Override
+ public float floatValue() {
+ return getFloat();
+ }
+
+ @Override
+ public double doubleValue() {
+ return getFloat();
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/IntegerPointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/IntegerPointable.java
new file mode 100644
index 0000000..f18ae09
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/IntegerPointable.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.api.IHashable;
+import edu.uci.ics.hyracks.data.std.api.INumeric;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public final class IntegerPointable extends AbstractPointable implements IHashable, IComparable, INumeric {
+ public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isFixedLength() {
+ return true;
+ }
+
+ @Override
+ public int getFixedLength() {
+ return 4;
+ }
+ };
+
+ public static final IPointableFactory FACTORY = new IPointableFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IPointable createPointable() {
+ return new IntegerPointable();
+ }
+
+ @Override
+ public ITypeTraits getTypeTraits() {
+ return TYPE_TRAITS;
+ }
+ };
+
+ public static int getInteger(byte[] bytes, int start) {
+ return ((bytes[start] & 0xff) << 24) + ((bytes[start + 1] & 0xff) << 16) + ((bytes[start + 2] & 0xff) << 8)
+ + ((bytes[start + 3] & 0xff) << 0);
+ }
+
+ public static void setInteger(byte[] bytes, int start, int value) {
+ bytes[start] = (byte) ((value >>> 24) & 0xFF);
+ bytes[start + 1] = (byte) ((value >>> 16) & 0xFF);
+ bytes[start + 2] = (byte) ((value >>> 8) & 0xFF);
+ bytes[start + 3] = (byte) ((value >>> 0) & 0xFF);
+ }
+
+ public int getInteger() {
+ return getInteger(bytes, start);
+ }
+
+ public void setInteger(int value) {
+ setInteger(bytes, start, value);
+ }
+
+ public int preIncrement() {
+ int v = getInteger();
+ ++v;
+ setInteger(v);
+ return v;
+ }
+
+ public int postIncrement() {
+ int v = getInteger();
+ int ov = v++;
+ setInteger(v);
+ return ov;
+ }
+
+ @Override
+ public int compareTo(IPointable pointer) {
+ return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
+ }
+
+ @Override
+ public int compareTo(byte[] bytes, int start, int length) {
+ int v = getInteger();
+ int ov = getInteger(bytes, start);
+ return v < ov ? -1 : (v > ov ? 1 : 0);
+ }
+
+ @Override
+ public int hash() {
+ return getInteger();
+ }
+
+ @Override
+ public byte byteValue() {
+ return (byte) getInteger();
+ }
+
+ @Override
+ public short shortValue() {
+ return (short) getInteger();
+ }
+
+ @Override
+ public int intValue() {
+ return getInteger();
+ }
+
+ @Override
+ public long longValue() {
+ return getInteger();
+ }
+
+ @Override
+ public float floatValue() {
+ return getInteger();
+ }
+
+ @Override
+ public double doubleValue() {
+ return getInteger();
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/LongPointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/LongPointable.java
new file mode 100644
index 0000000..89f9868
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/LongPointable.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.api.IHashable;
+import edu.uci.ics.hyracks.data.std.api.INumeric;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public final class LongPointable extends AbstractPointable implements IHashable, IComparable, INumeric {
+ public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isFixedLength() {
+ return true;
+ }
+
+ @Override
+ public int getFixedLength() {
+ return 8;
+ }
+ };
+
+ public static final IPointableFactory FACTORY = new IPointableFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IPointable createPointable() {
+ return new LongPointable();
+ }
+
+ @Override
+ public ITypeTraits getTypeTraits() {
+ return TYPE_TRAITS;
+ }
+ };
+
+ public static long getLong(byte[] bytes, int start) {
+ return (((long) (bytes[start] & 0xff)) << 56) + (((long) (bytes[start + 1] & 0xff)) << 48)
+ + (((long) (bytes[start + 2] & 0xff)) << 40) + (((long) (bytes[start + 3] & 0xff)) << 32)
+ + (((long) (bytes[start + 4] & 0xff)) << 24) + (((long) (bytes[start + 5] & 0xff)) << 16)
+ + (((long) (bytes[start + 6] & 0xff)) << 8) + (((long) (bytes[start + 7] & 0xff)) << 0);
+ }
+
+ public static void setLong(byte[] bytes, int start, long value) {
+ bytes[start] = (byte) ((value >>> 56) & 0xFF);
+ bytes[start + 1] = (byte) ((value >>> 48) & 0xFF);
+ bytes[start + 2] = (byte) ((value >>> 40) & 0xFF);
+ bytes[start + 3] = (byte) ((value >>> 32) & 0xFF);
+ bytes[start + 4] = (byte) ((value >>> 24) & 0xFF);
+ bytes[start + 5] = (byte) ((value >>> 16) & 0xFF);
+ bytes[start + 6] = (byte) ((value >>> 8) & 0xFF);
+ bytes[start + 7] = (byte) ((value >>> 0) & 0xFF);
+ }
+
+ public long getLong() {
+ return getLong(bytes, start);
+ }
+
+ public void setLong(long value) {
+ setLong(bytes, start, value);
+ }
+
+ public long preIncrement() {
+ long v = getLong();
+ ++v;
+ setLong(v);
+ return v;
+ }
+
+ public long postIncrement() {
+ long v = getLong();
+ long ov = v++;
+ setLong(v);
+ return ov;
+ }
+
+ @Override
+ public int compareTo(IPointable pointer) {
+ return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
+ }
+
+ @Override
+ public int compareTo(byte[] bytes, int start, int length) {
+ long v = getLong();
+ long ov = getLong(bytes, start);
+ return v < ov ? -1 : (v > ov ? 1 : 0);
+ }
+
+ @Override
+ public int hash() {
+ long v = getLong();
+ return (int) (v ^ (v >>> 32));
+ }
+
+ @Override
+ public byte byteValue() {
+ return (byte) getLong();
+ }
+
+ @Override
+ public short shortValue() {
+ return (short) getLong();
+ }
+
+ @Override
+ public int intValue() {
+ return (int) getLong();
+ }
+
+ @Override
+ public long longValue() {
+ return getLong();
+ }
+
+ @Override
+ public float floatValue() {
+ return getLong();
+ }
+
+ @Override
+ public double doubleValue() {
+ return getLong();
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/ShortPointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/ShortPointable.java
new file mode 100644
index 0000000..c9022ab
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/ShortPointable.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.api.IHashable;
+import edu.uci.ics.hyracks.data.std.api.INumeric;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public final class ShortPointable extends AbstractPointable implements IHashable, IComparable, INumeric {
+ public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isFixedLength() {
+ return true;
+ }
+
+ @Override
+ public int getFixedLength() {
+ return 2;
+ }
+ };
+
+ public static final IPointableFactory FACTORY = new IPointableFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IPointable createPointable() {
+ return new ShortPointable();
+ }
+
+ @Override
+ public ITypeTraits getTypeTraits() {
+ return TYPE_TRAITS;
+ }
+ };
+
+ public static short getShort(byte[] bytes, int start) {
+ return (short) (((bytes[start] & 0xff) << 8) + (bytes[start + 1] & 0xff));
+ }
+
+ public static void setShort(byte[] bytes, int start, short value) {
+ bytes[start] = (byte) ((value >>> 8) & 0xFF);
+ bytes[start + 1] = (byte) ((value >>> 0) & 0xFF);
+ }
+
+ public short getShort() {
+ return getShort(bytes, start);
+ }
+
+ public void setShort(short value) {
+ setShort(bytes, start, value);
+ }
+
+ public short preIncrement() {
+ short v = getShort();
+ ++v;
+ setShort(v);
+ return v;
+ }
+
+ public short postIncrement() {
+ short v = getShort();
+ short ov = v++;
+ setShort(v);
+ return ov;
+ }
+
+ @Override
+ public int compareTo(IPointable pointer) {
+ return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
+ }
+
+ @Override
+ public int compareTo(byte[] bytes, int start, int length) {
+ short v = getShort();
+ short ov = getShort(bytes, start);
+ return v < ov ? -1 : (v > ov ? 1 : 0);
+ }
+
+ @Override
+ public int hash() {
+ return getShort();
+ }
+
+ @Override
+ public byte byteValue() {
+ return (byte) getShort();
+ }
+
+ @Override
+ public short shortValue() {
+ return getShort();
+ }
+
+ @Override
+ public int intValue() {
+ return getShort();
+ }
+
+ @Override
+ public long longValue() {
+ return getShort();
+ }
+
+ @Override
+ public float floatValue() {
+ return getShort();
+ }
+
+ @Override
+ public double doubleValue() {
+ return getShort();
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/UTF8StringPointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/UTF8StringPointable.java
new file mode 100644
index 0000000..f6d6093
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/UTF8StringPointable.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IComparable;
+import edu.uci.ics.hyracks.data.std.api.IHashable;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public final class UTF8StringPointable extends AbstractPointable implements IHashable, IComparable {
+ public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isFixedLength() {
+ return false;
+ }
+
+ @Override
+ public int getFixedLength() {
+ return 0;
+ }
+ };
+
+ public static final IPointableFactory FACTORY = new IPointableFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IPointable createPointable() {
+ return new UTF8StringPointable();
+ }
+
+ @Override
+ public ITypeTraits getTypeTraits() {
+ return TYPE_TRAITS;
+ }
+ };
+
+ /**
+ * Returns the character at the given byte offset. The caller is responsible for making sure that
+ * the provided offset is within bounds and points to the beginning of a valid UTF8 character.
+ *
+ * @param offset
+ * - Byte offset
+ * @return Character at the given offset.
+ */
+ public char charAt(int offset) {
+ return charAt(bytes, start + offset);
+ }
+
+ public static char charAt(byte[] b, int s) {
+ int c = b[s] & 0xff;
+ switch (c >> 4) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ return (char) c;
+
+ case 12:
+ case 13:
+ return (char) (((c & 0x1F) << 6) | ((b[s + 1]) & 0x3F));
+
+ case 14:
+ return (char) (((c & 0x0F) << 12) | (((b[s + 1]) & 0x3F) << 6) | (((b[s + 2]) & 0x3F) << 0));
+
+ default:
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public int charSize(int offset) {
+ return charSize(bytes, start + offset);
+ }
+
+ public static int charSize(byte[] b, int s) {
+ int c = b[s] & 0xff;
+ switch (c >> 4) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ case 6:
+ case 7:
+ return 1;
+
+ case 12:
+ case 13:
+ return 2;
+
+ case 14:
+ return 3;
+ }
+ throw new IllegalStateException();
+ }
+
+ public static int getModifiedUTF8Len(char c) {
+ if (c >= 0x0000 && c <= 0x007F) {
+ return 1;
+ } else if (c <= 0x07FF) {
+ return 2;
+ } else {
+ return 3;
+ }
+ }
+
+ /**
+ * Gets the length of the string in characters.
+ *
+ * @return length of string in characters
+ */
+ public int getStringLength() {
+ return getStringLength(bytes, start);
+ }
+
+ public static int getStringLength(byte[] b, int s) {
+ int pos = s + 2;
+ int end = pos + getUTFLength(b, s);
+ int charCount = 0;
+ while (pos < end) {
+ charCount++;
+ pos += charSize(b, pos);
+ }
+ return charCount;
+ }
+
+ /**
+ * Gets the length of the UTF-8 encoded string in bytes.
+ *
+ * @return length of UTF-8 encoded string in bytes
+ */
+ public int getUTFLength() {
+ return getUTFLength(bytes, start);
+ }
+
+ public static int getUTFLength(byte[] b, int s) {
+ return ((b[s] & 0xff) << 8) + ((b[s + 1] & 0xff) << 0);
+ }
+
+ @Override
+ public int compareTo(IPointable pointer) {
+ return compareTo(pointer.getByteArray(), pointer.getStartOffset(), pointer.getLength());
+ }
+
+ @Override
+ public int compareTo(byte[] bytes, int start, int length) {
+ int utflen1 = getUTFLength(this.bytes, this.start);
+ int utflen2 = getUTFLength(bytes, start);
+
+ int c1 = 0;
+ int c2 = 0;
+
+ int s1Start = this.start + 2;
+ int s2Start = start + 2;
+
+ while (c1 < utflen1 && c2 < utflen2) {
+ char ch1 = charAt(this.bytes, s1Start + c1);
+ char ch2 = charAt(bytes, s2Start + c2);
+
+ if (ch1 != ch2) {
+ return ch1 - ch2;
+ }
+ c1 += charSize(this.bytes, s1Start + c1);
+ c2 += charSize(bytes, s2Start + c2);
+ }
+ return utflen1 - utflen2;
+ }
+
+ @Override
+ public int hash() {
+ int h = 0;
+ int utflen = getUTFLength(bytes, start);
+ int sStart = start + 2;
+ int c = 0;
+
+ while (c < utflen) {
+ char ch = charAt(bytes, sStart + c);
+ h = 31 * h + ch;
+ c += charSize(bytes, sStart + c);
+ }
+ return h;
+ }
+
+ public static void toString(StringBuilder buffer, byte[] bytes, int start) {
+ int utfLen = getUTFLength(bytes, start);
+ int offset = 2;
+ while (utfLen > 0) {
+ char c = charAt(bytes, start + offset);
+ buffer.append(c);
+ int cLen = UTF8StringPointable.getModifiedUTF8Len(c);
+ offset += cLen;
+ utfLen -= cLen;
+ }
+ }
+
+ public void toString(StringBuilder buffer) {
+ toString(buffer, bytes, start);
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/UTF8StringWriter.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/UTF8StringWriter.java
new file mode 100644
index 0000000..4eb489f
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/UTF8StringWriter.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.UTFDataFormatException;
+
+public class UTF8StringWriter {
+ private byte[] tempBytes;
+
+ public void writeUTF8String(CharSequence str, DataOutput out) throws IOException {
+ int strlen = str.length();
+ int utflen = 0;
+ int c, count = 0;
+
+ for (int i = 0; i < strlen; i++) {
+ c = str.charAt(i);
+ if ((c >= 0x0001) && (c <= 0x007F)) {
+ utflen++;
+ } else if (c > 0x07FF) {
+ utflen += 3;
+ } else {
+ utflen += 2;
+ }
+ }
+
+ if (utflen > 65535) {
+ throw new UTFDataFormatException("encoded string too long: " + utflen + " bytes");
+ }
+
+ if (tempBytes == null || tempBytes.length < utflen + 2) {
+ tempBytes = new byte[utflen + 2];
+ }
+
+ tempBytes[count++] = (byte) ((utflen >>> 8) & 0xFF);
+ tempBytes[count++] = (byte) ((utflen >>> 0) & 0xFF);
+
+ int i = 0;
+ for (i = 0; i < strlen; i++) {
+ c = str.charAt(i);
+ if (!((c >= 0x0001) && (c <= 0x007F))) {
+ break;
+ }
+ tempBytes[count++] = (byte) c;
+ }
+
+ for (; i < strlen; i++) {
+ c = str.charAt(i);
+ if ((c >= 0x0001) && (c <= 0x007F)) {
+ tempBytes[count++] = (byte) c;
+ } else if (c > 0x07FF) {
+ tempBytes[count++] = (byte) (0xE0 | ((c >> 12) & 0x0F));
+ tempBytes[count++] = (byte) (0x80 | ((c >> 6) & 0x3F));
+ tempBytes[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
+ } else {
+ tempBytes[count++] = (byte) (0xC0 | ((c >> 6) & 0x1F));
+ tempBytes[count++] = (byte) (0x80 | ((c >> 0) & 0x3F));
+ }
+ }
+ out.write(tempBytes, 0, utflen + 2);
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/VoidPointable.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/VoidPointable.java
new file mode 100644
index 0000000..4faf606
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/primitive/VoidPointable.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.primitive;
+
+import edu.uci.ics.hyracks.api.dataflow.value.ITypeTraits;
+import edu.uci.ics.hyracks.data.std.api.AbstractPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointable;
+import edu.uci.ics.hyracks.data.std.api.IPointableFactory;
+
+public final class VoidPointable extends AbstractPointable {
+ public static final ITypeTraits TYPE_TRAITS = new ITypeTraits() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isFixedLength() {
+ return false;
+ }
+
+ @Override
+ public int getFixedLength() {
+ return 0;
+ }
+ };
+
+ public static final IPointableFactory FACTORY = new IPointableFactory() {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public IPointable createPointable() {
+ return new VoidPointable();
+ }
+
+ @Override
+ public ITypeTraits getTypeTraits() {
+ return TYPE_TRAITS;
+ }
+ };
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/util/ArrayBackedValueStorage.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/util/ArrayBackedValueStorage.java
new file mode 100644
index 0000000..e8dc9b4
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/util/ArrayBackedValueStorage.java
@@ -0,0 +1,56 @@
+package edu.uci.ics.hyracks.data.std.util;
+
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+
+import edu.uci.ics.hyracks.data.std.api.IMutableValueStorage;
+import edu.uci.ics.hyracks.data.std.api.IValueReference;
+
+public class ArrayBackedValueStorage implements IMutableValueStorage {
+ private final ByteArrayAccessibleOutputStream baaos;
+ private final DataOutputStream dos;
+
+ public ArrayBackedValueStorage() {
+ baaos = new ByteArrayAccessibleOutputStream();
+ dos = new DataOutputStream(baaos);
+ }
+
+ @Override
+ public void reset() {
+ baaos.reset();
+ }
+
+ @Override
+ public DataOutput getDataOutput() {
+ return dos;
+ }
+
+ @Override
+ public byte[] getByteArray() {
+ return baaos.getByteArray();
+ }
+
+ @Override
+ public int getStartOffset() {
+ return 0;
+ }
+
+ @Override
+ public int getLength() {
+ return baaos.size();
+ }
+
+ public void append(IValueReference value) {
+ try {
+ dos.write(value.getByteArray(), value.getStartOffset(), value.getLength());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void assign(IValueReference value) {
+ reset();
+ append(value);
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
new file mode 100644
index 0000000..8508287
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/hyracks-data-std/src/main/java/edu/uci/ics/hyracks/data/std/util/ByteArrayAccessibleOutputStream.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2009-2010 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package edu.uci.ics.hyracks.data.std.util;
+
+import java.io.ByteArrayOutputStream;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class ByteArrayAccessibleOutputStream extends ByteArrayOutputStream {
+ private static final Logger LOGGER = Logger.getLogger(ByteArrayAccessibleOutputStream.class.getName());
+
+ public byte[] getByteArray() {
+ return buf;
+ }
+
+ public void write(int b) {
+ if (LOGGER.isLoggable(Level.FINEST)) {
+ LOGGER.finest("write(byte) value: " + b);
+ }
+ super.write(b);
+ }
+
+ @Override
+ public void write(byte[] bytes, int offset, int length) {
+ if (LOGGER.isLoggable(Level.FINEST)) {
+ LOGGER.finest("write(byte[], int, int) offset: " + offset + " length" + length);
+ }
+ super.write(bytes, offset, length);
+ }
+}
\ No newline at end of file
diff --git a/fullstack/hyracks/hyracks-data/pom.xml b/fullstack/hyracks/hyracks-data/pom.xml
new file mode 100644
index 0000000..62de9b2
--- /dev/null
+++ b/fullstack/hyracks/hyracks-data/pom.xml
@@ -0,0 +1,16 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>hyracks-data</artifactId>
+ <packaging>pom</packaging>
+ <name>hyracks-data</name>
+
+ <parent>
+ <groupId>edu.uci.ics.hyracks</groupId>
+ <artifactId>hyracks</artifactId>
+ <version>0.2.2-SNAPSHOT</version>
+ </parent>
+
+ <modules>
+ <module>hyracks-data-std</module>
+ </modules>
+</project>