asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject asterixdb git commit: Moved array list classes to hyracks-storage-common.
Date Thu, 14 Jul 2016 23:23:05 GMT
Repository: asterixdb
Updated Branches:
  refs/heads/master 61ec12893 -> 8166898f7


Moved array list classes to hyracks-storage-common.

* The move allows more projects to reused the array list code.

Change-Id: I9c7a3568f35abb392c1de91ddf9bcabb0cac0a7b
Reviewed-on: https://asterix-gerrit.ics.uci.edu/996
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/8166898f
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/8166898f
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/8166898f

Branch: refs/heads/master
Commit: 8166898f7b96af7a8b70db3e38f556f869679418
Parents: 61ec128
Author: Preston Carman <prestonc@apache.org>
Authored: Thu Jul 14 09:42:11 2016 -0700
Committer: Preston Carman <prestonc@apache.org>
Committed: Thu Jul 14 16:22:36 2016 -0700

----------------------------------------------------------------------
 .../asterix/builders/AbstractListBuilder.java   |   2 +-
 .../storage/am/btree/impls/BTreeOpContext.java  |   4 +-
 .../am/common/ophelpers/DoubleArrayList.java    | 102 ------------------
 .../am/common/ophelpers/IntArrayList.java       | 102 ------------------
 .../am/common/ophelpers/LongArrayList.java      | 103 -------------------
 .../common/util/TreeIndexBufferCacheWarmup.java |   2 +-
 .../storage/am/rtree/impls/PathList.java        |   4 +-
 .../linearize/HilbertDoubleComparator.java      |   4 +-
 .../rtree/linearize/ZCurveDoubleComparator.java |   2 +-
 .../am/rtree/linearize/ZCurveIntComparator.java |   2 +-
 .../common/arraylist/DoubleArrayList.java       | 102 ++++++++++++++++++
 .../storage/common/arraylist/IntArrayList.java  | 102 ++++++++++++++++++
 .../storage/common/arraylist/LongArrayList.java | 103 +++++++++++++++++++
 13 files changed, 317 insertions(+), 317 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/asterixdb/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
b/asterixdb/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
index bb79ea2..b3cb416 100644
--- a/asterixdb/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
+++ b/asterixdb/asterix-om/src/main/java/org/apache/asterix/builders/AbstractListBuilder.java
@@ -29,7 +29,7 @@ import org.apache.asterix.om.util.NonTaggedFormatUtil;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.data.std.api.IValueReference;
 import org.apache.hyracks.data.std.util.GrowableArray;
-import org.apache.hyracks.storage.am.common.ophelpers.IntArrayList;
+import org.apache.hyracks.storage.common.arraylist.IntArrayList;
 
 public abstract class AbstractListBuilder implements IAsterixListBuilder {
     protected final GrowableArray outputStorage;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
index 3649433..f894c70 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-btree/src/main/java/org/apache/hyracks/storage/am/btree/impls/BTreeOpContext.java
@@ -41,9 +41,9 @@ import org.apache.hyracks.storage.am.common.api.ITreeIndexFrameFactory;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexMetaDataFrame;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexTupleReference;
 import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
-import org.apache.hyracks.storage.am.common.ophelpers.IntArrayList;
-import org.apache.hyracks.storage.am.common.ophelpers.LongArrayList;
 import org.apache.hyracks.storage.am.common.ophelpers.MultiComparator;
+import org.apache.hyracks.storage.common.arraylist.IntArrayList;
+import org.apache.hyracks.storage.common.arraylist.LongArrayList;
 import org.apache.hyracks.storage.common.buffercache.IExtraPageBlockHelper;
 
 public class BTreeOpContext implements IIndexOperationContext, IExtraPageBlockHelper {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/DoubleArrayList.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/DoubleArrayList.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/DoubleArrayList.java
deleted file mode 100644
index 2a95f1e..0000000
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/DoubleArrayList.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.hyracks.storage.am.common.ophelpers;
-
-public class DoubleArrayList {
-    private double[] data;
-    private int size;
-    private int first;
-    private final int growth;
-
-    public DoubleArrayList(int initialCapacity, int growth) {
-        data = new double[initialCapacity];
-        size = 0;
-        first = 0;
-        this.growth = growth;
-    }
-
-    public int size() {
-        return size;
-    }
-
-    public int first() {
-        return first;
-    }
-
-    public void add(double i) {
-        if (size == data.length) {
-            double[] newData = new double[data.length + growth];
-            System.arraycopy(data, 0, newData, 0, data.length);
-            data = newData;
-        }
-
-        data[size++] = i;
-    }
-
-    public void addFirst(double i) {
-        double[] newData = new double[data.length + 1];
-        System.arraycopy(data, 0, newData, 0, first);
-        System.arraycopy(data, first, newData, first + 1, size - first);
-        data = newData;
-        data[first] = i;
-        size++;
-    }
-
-    public void removeLast() {
-        if (size > 0)
-            size--;
-    }
-
-    // WARNING: caller is responsible for checking size > 0
-    public double getLast() {
-        return data[size - 1];
-    }
-
-    public double get(int i) {
-        return data[i];
-    }
-
-    // WARNING: caller is responsible for checking i < size
-    public void set(int i, int value) {
-        data[i] = value;
-
-    }
-
-    public double getFirst() {
-        return data[first];
-    }
-
-    public void moveFirst() {
-        first++;
-    }
-
-    public void clear() {
-        size = 0;
-        first = 0;
-    }
-
-    public boolean isLast() {
-        return size == first;
-    }
-
-    public boolean isEmpty() {
-        return size == 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/IntArrayList.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/IntArrayList.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/IntArrayList.java
deleted file mode 100644
index 25ca93c..0000000
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/IntArrayList.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.hyracks.storage.am.common.ophelpers;
-
-public class IntArrayList {
-    private int[] data;
-    private int size;
-    private int first;
-    private final int growth;
-
-    public IntArrayList(int initialCapacity, int growth) {
-        data = new int[initialCapacity];
-        size = 0;
-        first = 0;
-        this.growth = growth;
-    }
-
-    public int size() {
-        return size;
-    }
-
-    public int first() {
-        return first;
-    }
-
-    public void add(int i) {
-        if (size == data.length) {
-            int[] newData = new int[data.length + growth];
-            System.arraycopy(data, 0, newData, 0, data.length);
-            data = newData;
-        }
-
-        data[size++] = i;
-    }
-
-    public void addFirst(int i) {
-        int[] newData = new int[data.length + 1];
-        System.arraycopy(data, 0, newData, 0, first);
-        System.arraycopy(data, first, newData, first + 1, size - first);
-        data = newData;
-        data[first] = i;
-        size++;
-    }
-
-    public void removeLast() {
-        if (size > 0)
-            size--;
-    }
-
-    // WARNING: caller is responsible for checking size > 0
-    public int getLast() {
-        return data[size - 1];
-    }
-
-    public int get(int i) {
-        return data[i];
-    }
-
-    // WARNING: caller is responsible for checking i < size
-    public void set(int i, int value) {
-        data[i] = value;
-
-    }
-
-    public int getFirst() {
-        return data[first];
-    }
-
-    public void moveFirst() {
-        first++;
-    }
-
-    public void clear() {
-        size = 0;
-        first = 0;
-    }
-
-    public boolean isLast() {
-        return size == first;
-    }
-
-    public boolean isEmpty() {
-        return size == 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/LongArrayList.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/LongArrayList.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/LongArrayList.java
deleted file mode 100644
index 1da4f46..0000000
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/ophelpers/LongArrayList.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you 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 at
- *
- *   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 org.apache.hyracks.storage.am.common.ophelpers;
-
-public class LongArrayList {
-    private long[] data;
-    private int size;
-    private int first;
-    private final int growth;
-
-    public LongArrayList(int initialCapacity, int growth) {
-        data = new long[initialCapacity];
-        size = 0;
-        first = 0;
-        this.growth = growth;
-    }
-
-    public int size() {
-        return size;
-    }
-
-    public int first() {
-        return first;
-    }
-
-    public void addFirst(long i) {
-        long[] newData = new long[data.length + 1];
-        System.arraycopy(data, 0, newData, 0, first);
-        System.arraycopy(data, first, newData, first + 1, size - first);
-        data = newData;
-        data[first] = i;
-        size++;
-    }
-
-
-    public void add(long i) {
-        if (size == data.length) {
-            long[] newData = new long[data.length + growth];
-            System.arraycopy(data, 0, newData, 0, data.length);
-            data = newData;
-        }
-
-        data[size++] = i;
-    }
-
-    public void removeLast() {
-        if (size > 0)
-            size--;
-    }
-
-    // WARNING: caller is responsible for checking size > 0
-    public long getLast() {
-        return data[size - 1];
-    }
-
-    public long get(int i) {
-        return data[i];
-    }
-
-    // WARNING: caller is responsible for checking i < size
-    public void set(int i, long value) {
-        data[i] = value;
-
-    }
-
-    public long getFirst() {
-        return data[first];
-    }
-
-    public void moveFirst() {
-        first++;
-    }
-
-    public void clear() {
-        size = 0;
-        first = 0;
-    }
-
-    public boolean isLast() {
-        return size == first;
-    }
-
-    public boolean isEmpty() {
-        return size == 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/TreeIndexBufferCacheWarmup.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/TreeIndexBufferCacheWarmup.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/TreeIndexBufferCacheWarmup.java
index ff76c5a..d18db01 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/TreeIndexBufferCacheWarmup.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/util/TreeIndexBufferCacheWarmup.java
@@ -26,7 +26,7 @@ import org.apache.hyracks.util.MathUtil;
 import org.apache.hyracks.storage.am.common.api.IMetaDataPageManager;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexFrame;
 import org.apache.hyracks.storage.am.common.api.ITreeIndexMetaDataFrame;
-import org.apache.hyracks.storage.am.common.ophelpers.IntArrayList;
+import org.apache.hyracks.storage.common.arraylist.IntArrayList;
 import org.apache.hyracks.storage.common.buffercache.IBufferCache;
 import org.apache.hyracks.storage.common.buffercache.ICachedPage;
 import org.apache.hyracks.storage.common.file.BufferedFileHandle;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/PathList.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/PathList.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/PathList.java
index 6d59351..9056848 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/PathList.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/impls/PathList.java
@@ -19,8 +19,8 @@
 
 package org.apache.hyracks.storage.am.rtree.impls;
 
-import org.apache.hyracks.storage.am.common.ophelpers.IntArrayList;
-import org.apache.hyracks.storage.am.common.ophelpers.LongArrayList;
+import org.apache.hyracks.storage.common.arraylist.IntArrayList;
+import org.apache.hyracks.storage.common.arraylist.LongArrayList;
 
 public class PathList {
     private IntArrayList pageIds;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/HilbertDoubleComparator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/HilbertDoubleComparator.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/HilbertDoubleComparator.java
index cd380e1..5a3a88f 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/HilbertDoubleComparator.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/HilbertDoubleComparator.java
@@ -22,9 +22,9 @@ import org.apache.hyracks.api.dataflow.value.ILinearizeComparator;
 import org.apache.hyracks.data.std.primitive.DoublePointable;
 import org.apache.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProvider;
-import org.apache.hyracks.storage.am.common.ophelpers.DoubleArrayList;
-import org.apache.hyracks.storage.am.common.ophelpers.IntArrayList;
 import org.apache.hyracks.storage.am.rtree.impls.DoublePrimitiveValueProviderFactory;
+import org.apache.hyracks.storage.common.arraylist.DoubleArrayList;
+import org.apache.hyracks.storage.common.arraylist.IntArrayList;
 
 /*
  * This compares two points based on the hilbert curve. Currently, it only supports

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveDoubleComparator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveDoubleComparator.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveDoubleComparator.java
index 0280ba5..9678289 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveDoubleComparator.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveDoubleComparator.java
@@ -22,8 +22,8 @@ import org.apache.hyracks.api.dataflow.value.ILinearizeComparator;
 import org.apache.hyracks.data.std.primitive.DoublePointable;
 import org.apache.hyracks.dataflow.common.data.marshalling.DoubleSerializerDeserializer;
 import org.apache.hyracks.storage.am.common.api.IPrimitiveValueProvider;
-import org.apache.hyracks.storage.am.common.ophelpers.DoubleArrayList;
 import org.apache.hyracks.storage.am.rtree.impls.DoublePrimitiveValueProviderFactory;
+import org.apache.hyracks.storage.common.arraylist.DoubleArrayList;
 
 /*
  * This compares two points based on the z curve. For doubles, we cannot use

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveIntComparator.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveIntComparator.java
b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveIntComparator.java
index 2f372e2..1edcd2a 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveIntComparator.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-rtree/src/main/java/org/apache/hyracks/storage/am/rtree/linearize/ZCurveIntComparator.java
@@ -21,7 +21,7 @@ package org.apache.hyracks.storage.am.rtree.linearize;
 import org.apache.hyracks.api.dataflow.value.ILinearizeComparator;
 import org.apache.hyracks.data.std.primitive.DoublePointable;
 import org.apache.hyracks.data.std.primitive.IntegerPointable;
-import org.apache.hyracks.storage.am.common.ophelpers.DoubleArrayList;
+import org.apache.hyracks.storage.common.arraylist.DoubleArrayList;
 
 /*
  * This compares two points based on the z curve. For doubles, we cannot use

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/DoubleArrayList.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/DoubleArrayList.java
b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/DoubleArrayList.java
new file mode 100644
index 0000000..fd2bdec
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/DoubleArrayList.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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 org.apache.hyracks.storage.common.arraylist;
+
+public class DoubleArrayList {
+    private double[] data;
+    private int size;
+    private int first;
+    private final int growth;
+
+    public DoubleArrayList(int initialCapacity, int growth) {
+        data = new double[initialCapacity];
+        size = 0;
+        first = 0;
+        this.growth = growth;
+    }
+
+    public int size() {
+        return size;
+    }
+
+    public int first() {
+        return first;
+    }
+
+    public void add(double i) {
+        if (size == data.length) {
+            double[] newData = new double[data.length + growth];
+            System.arraycopy(data, 0, newData, 0, data.length);
+            data = newData;
+        }
+
+        data[size++] = i;
+    }
+
+    public void addFirst(double i) {
+        double[] newData = new double[data.length + 1];
+        System.arraycopy(data, 0, newData, 0, first);
+        System.arraycopy(data, first, newData, first + 1, size - first);
+        data = newData;
+        data[first] = i;
+        size++;
+    }
+
+    public void removeLast() {
+        if (size > 0)
+            size--;
+    }
+
+    // WARNING: caller is responsible for checking size > 0
+    public double getLast() {
+        return data[size - 1];
+    }
+
+    public double get(int i) {
+        return data[i];
+    }
+
+    // WARNING: caller is responsible for checking i < size
+    public void set(int i, int value) {
+        data[i] = value;
+
+    }
+
+    public double getFirst() {
+        return data[first];
+    }
+
+    public void moveFirst() {
+        first++;
+    }
+
+    public void clear() {
+        size = 0;
+        first = 0;
+    }
+
+    public boolean isLast() {
+        return size == first;
+    }
+
+    public boolean isEmpty() {
+        return size == 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/IntArrayList.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/IntArrayList.java
b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/IntArrayList.java
new file mode 100644
index 0000000..84885ca
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/IntArrayList.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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 org.apache.hyracks.storage.common.arraylist;
+
+public class IntArrayList {
+    private int[] data;
+    private int size;
+    private int first;
+    private final int growth;
+
+    public IntArrayList(int initialCapacity, int growth) {
+        data = new int[initialCapacity];
+        size = 0;
+        first = 0;
+        this.growth = growth;
+    }
+
+    public int size() {
+        return size;
+    }
+
+    public int first() {
+        return first;
+    }
+
+    public void add(int i) {
+        if (size == data.length) {
+            int[] newData = new int[data.length + growth];
+            System.arraycopy(data, 0, newData, 0, data.length);
+            data = newData;
+        }
+
+        data[size++] = i;
+    }
+
+    public void addFirst(int i) {
+        int[] newData = new int[data.length + 1];
+        System.arraycopy(data, 0, newData, 0, first);
+        System.arraycopy(data, first, newData, first + 1, size - first);
+        data = newData;
+        data[first] = i;
+        size++;
+    }
+
+    public void removeLast() {
+        if (size > 0)
+            size--;
+    }
+
+    // WARNING: caller is responsible for checking size > 0
+    public int getLast() {
+        return data[size - 1];
+    }
+
+    public int get(int i) {
+        return data[i];
+    }
+
+    // WARNING: caller is responsible for checking i < size
+    public void set(int i, int value) {
+        data[i] = value;
+
+    }
+
+    public int getFirst() {
+        return data[first];
+    }
+
+    public void moveFirst() {
+        first++;
+    }
+
+    public void clear() {
+        size = 0;
+        first = 0;
+    }
+
+    public boolean isLast() {
+        return size == first;
+    }
+
+    public boolean isEmpty() {
+        return size == 0;
+    }
+}

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/8166898f/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/LongArrayList.java
----------------------------------------------------------------------
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/LongArrayList.java
b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/LongArrayList.java
new file mode 100644
index 0000000..2811641
--- /dev/null
+++ b/hyracks-fullstack/hyracks/hyracks-storage-common/src/main/java/org/apache/hyracks/storage/common/arraylist/LongArrayList.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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 at
+ *
+ *   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 org.apache.hyracks.storage.common.arraylist;
+
+public class LongArrayList {
+    private long[] data;
+    private int size;
+    private int first;
+    private final int growth;
+
+    public LongArrayList(int initialCapacity, int growth) {
+        data = new long[initialCapacity];
+        size = 0;
+        first = 0;
+        this.growth = growth;
+    }
+
+    public int size() {
+        return size;
+    }
+
+    public int first() {
+        return first;
+    }
+
+    public void addFirst(long i) {
+        long[] newData = new long[data.length + 1];
+        System.arraycopy(data, 0, newData, 0, first);
+        System.arraycopy(data, first, newData, first + 1, size - first);
+        data = newData;
+        data[first] = i;
+        size++;
+    }
+
+
+    public void add(long i) {
+        if (size == data.length) {
+            long[] newData = new long[data.length + growth];
+            System.arraycopy(data, 0, newData, 0, data.length);
+            data = newData;
+        }
+
+        data[size++] = i;
+    }
+
+    public void removeLast() {
+        if (size > 0)
+            size--;
+    }
+
+    // WARNING: caller is responsible for checking size > 0
+    public long getLast() {
+        return data[size - 1];
+    }
+
+    public long get(int i) {
+        return data[i];
+    }
+
+    // WARNING: caller is responsible for checking i < size
+    public void set(int i, long value) {
+        data[i] = value;
+
+    }
+
+    public long getFirst() {
+        return data[first];
+    }
+
+    public void moveFirst() {
+        first++;
+    }
+
+    public void clear() {
+        size = 0;
+        first = 0;
+    }
+
+    public boolean isLast() {
+        return size == first;
+    }
+
+    public boolean isEmpty() {
+        return size == 0;
+    }
+}


Mime
View raw message