ref_send API 2.17
defensive programming in Java

org.joe_e.array
Class PowerlessArray.Builder<E>

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<E>
All Implemented Interfaces:
ArrayBuilder<E>
Direct Known Subclasses:
BooleanArray.Builder, ByteArray.Builder, CharArray.Builder, DoubleArray.Builder, FloatArray.Builder, IntArray.Builder, LongArray.Builder, ShortArray.Builder
Enclosing class:
PowerlessArray<E>

public static class PowerlessArray.Builder<E>
extends ImmutableArray.Builder<E>

A PowerlessArray factory.


Method Summary
 void append(E newE)
          Appends an element to the Array
 void append(E[] newEs)
          Appends all elements from a Java array to the Array
 void append(E[] newEs, int off, int len)
          Appends a range of elements from a Java array to the Array
 PowerlessArray<E> 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

append

public void append(E newE)
Appends an element to the Array

Specified by:
append in interface ArrayBuilder<E>
Overrides:
append in class ImmutableArray.Builder<E>
Parameters:
newE - the element to append
Throws:
java.lang.ClassCastException - if the newE is not powerless
java.lang.NegativeArraySizeException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(E[] newEs)
Appends all elements from a Java array to the Array

Specified by:
append in interface ArrayBuilder<E>
Overrides:
append in class ImmutableArray.Builder<E>
Parameters:
newEs - the element to append
Throws:
java.lang.ClassCastException - if the newEs are not powerless
java.lang.IndexOutOfBoundsException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(E[] newEs,
                   int off,
                   int len)
Appends a range of elements from a Java array to the Array

Specified by:
append in interface ArrayBuilder<E>
Overrides:
append in class ImmutableArray.Builder<E>
Parameters:
newEs - the source array
off - the index of the first element to append
len - the number of elements to append
Throws:
java.lang.ClassCastException - if the newEs is not powerless
java.lang.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 PowerlessArray<E> snapshot()
Create a snapshot of the current content.

Specified by:
snapshot in interface ArrayBuilder<E>
Overrides:
snapshot in class ImmutableArray.Builder<E>
Returns:
a PowerlesstArray containing the elements so far

ref_send API 2.17
defensive programming in Java

Submit a bug or feature, or get help

Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.