/*
 * Zorbage: an algebraic data hierarchy for use in numeric processing.
 *
 * Copyright (C) 2016 Barry DeZonia
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */
package zorbage.type.storage;

import zorbage.type.data.UnboundedIntMember;

/**
 * 
 * @author Barry DeZonia
 *
 * @param <U>
 */
public class ArrayStorageUnboundedInt
	implements Storage<UnboundedIntMember>
{

	private final UnboundedIntMember[] data;
	
	public ArrayStorageUnboundedInt(long size) {
		if (size < 0)
			throw new IllegalArgumentException("ArrayStorage cannot handle a negative request");
		if (size > Integer.MAX_VALUE)
			throw new IllegalArgumentException("ArrayStorage cannot handle such a large request");
		this.data = new UnboundedIntMember[(int)size];
		for (int i = 0; i < data.length; i++) {
			data[i] = new UnboundedIntMember();
		}
	}

	@Override
	public void put(long index, UnboundedIntMember value) {
		data[(int)index].setV( value.v() );
	}

	@Override
	public void get(long index, UnboundedIntMember value) {
		value.setV(data[(int)index].v());
	}
	
	@Override
	public long size() {
		return data.length;
	}

}

@@ -1450,16 +1450,46 @@
 orage;%0A%0A
+import java.math.BigInteger;%0A%0A
 import z
@@ -1525,16 +1525,16 @@
 Member;%0A
-
 %0A/**%0A * 
@@ -1676,32 +1676,24 @@
 e final 
-UnboundedIntMemb
+BigInteg
 er%5B%5D dat
@@ -1987,32 +1987,24 @@
 a = new 
-UnboundedIntMemb
+BigInteg
 er%5B(int)
@@ -2069,32 +2069,23 @@
 %5D = 
-new UnboundedIntMember()
+BigInteger.ZERO
 ;%0A%09%09
@@ -2176,22 +2176,18 @@
 t)index%5D
-.setV(
+ =
  value.v
@@ -2192,10 +2192,8 @@
 .v()
- )
 ;%0A%09%7D
@@ -2262,16 +2262,16 @@
 alue) %7B%0A
+
 %09%09value.
@@ -2291,20 +2291,16 @@
 t)index%5D
-.v()
 );%0A%09%7D%0A%09%0A

Make unbound int storage more efficient