org.joe_e.array
Class ShortArray.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<Short>
              extended by org.joe_e.array.ShortArray.Builder
All Implemented Interfaces:
ArrayBuilder<Short>
Enclosing class:
ShortArray

public static final class ShortArray.Builder
extends PowerlessArray.Builder<Short>

A ShortArray factory.


Method Summary
 void append(short newShort)
          Append a short
 void append(Short newShort)
          Append a Short
 void append(short[] newShorts)
          Append an array of shorts
 void append(Short[] newShorts)
          Append an array of Shorts
 void append(short[] newShorts, int off, int len)
          Append a range of elements from an array of shorts
 void append(Short[] newShorts, int off, int len)
          Append a range of elements from an array of Shorts
 ShortArray 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(Short newShort)
Append a Short

Specified by:
append in interface ArrayBuilder<Short>
Overrides:
append in class PowerlessArray.Builder<Short>
Parameters:
newShort - 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(Short[] newShorts)
Append an array of Shorts

Specified by:
append in interface ArrayBuilder<Short>
Overrides:
append in class PowerlessArray.Builder<Short>
Parameters:
newShorts - 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(Short[] newShorts,
                   int off,
                   int len)
Append a range of elements from an array of Shorts

Specified by:
append in interface ArrayBuilder<Short>
Overrides:
append in class PowerlessArray.Builder<Short>
Parameters:
newShorts - 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 ShortArray snapshot()
Create a snapshot of the current content.

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

append

public void append(short newShort)
Append a short

Parameters:
newShort - 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(short[] newShorts)
Append an array of shorts

Parameters:
newShorts - 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(short[] newShorts,
                   int off,
                   int len)
Append a range of elements from an array of shorts

Parameters:
newShorts - 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.