org.joe_e.array
Class IntArray.Builder

java.lang.Object
  extended by org.joe_e.array.ConstArray.Builder<E>
      extended by org.joe_e.array.ImmutableArray.Builder<E>
          extended by org.joe_e.array.PowerlessArray.Builder<Integer>
              extended by org.joe_e.array.IntArray.Builder
All Implemented Interfaces:
ArrayBuilder<Integer>
Enclosing class:
IntArray

public static final class IntArray.Builder
extends PowerlessArray.Builder<Integer>

A IntArray factory.


Method Summary
 void append(int newInt)
          Append a int
 void append(int[] newInts)
          Append an array of ints
 void append(int[] newInts, int off, int len)
          Append a range of elements from an array of ints
 void append(Integer newInt)
          Append a Integer
 void append(Integer[] newInts)
          Append an array of Integers
 void append(Integer[] newInts, int off, int len)
          Append a range of elements from an array of Integers
 IntArray snapshot()
          Create a snapshot of the current content.
 
Methods inherited from class org.joe_e.array.ConstArray.Builder
length
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

append

public void append(Integer newInt)
Append a Integer

Specified by:
append in interface ArrayBuilder<Integer>
Overrides:
append in class PowerlessArray.Builder<Integer>
Parameters:
newInt - the element to add
Throws:
NegativeArraySizeException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(Integer[] newInts)
Append an array of Integers

Specified by:
append in interface ArrayBuilder<Integer>
Overrides:
append in class PowerlessArray.Builder<Integer>
Parameters:
newInts - the elements to add
Throws:
IndexOutOfBoundsException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(Integer[] newInts,
                   int off,
                   int len)
Append a range of elements from an array of Integers

Specified by:
append in interface ArrayBuilder<Integer>
Overrides:
append in class PowerlessArray.Builder<Integer>
Parameters:
newInts - the array to add elements from
off - the index of the first element to add
len - the number of elements to add
Throws:
IndexOutOfBoundsException - if an out-of-bounds index would be referenced or the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

snapshot

public IntArray snapshot()
Create a snapshot of the current content.

Specified by:
snapshot in interface ArrayBuilder<Integer>
Overrides:
snapshot in class PowerlessArray.Builder<Integer>
Returns:
a IntArray containing the elements so far

append

public void append(int newInt)
Append a int

Parameters:
newInt - the element to add
Throws:
NegativeArraySizeException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(int[] newInts)
Append an array of ints

Parameters:
newInts - the elements to add
Throws:
IndexOutOfBoundsException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(int[] newInts,
                   int off,
                   int len)
Append a range of elements from an array of ints

Parameters:
newInts - the array to add elements from
off - the index of the first element to add
len - the number of elements to add
Throws:
IndexOutOfBoundsException - if an out-of-bounds index would be referenced or the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.