sleep.runtime
Interface ScalarArray

All Superinterfaces:
java.io.Serializable

public interface ScalarArray
extends java.io.Serializable

This interface lets you implement your own data structure behind a scalar array.

To instantiate a custom scalar array:

Scalar temp = SleepUtils.getArrayScalar(new MyScalarArray());

When implementing the following interface, keep in mind you are implementing an interface to an array data structure.


Method Summary
 Scalar add(Scalar value, int index)
          add an element to the array at the specified index
 Scalar getAt(int index)
          get an element at the specified index
 Scalar pop()
          remove the topmost element from the array
 Scalar push(Scalar value)
          add an element onto the end of the array
 Scalar remove(int index)
          remove an element at the specified index
 void remove(Scalar value)
          remove all elements with the same identity as the specified scalar
 java.util.Iterator scalarIterator()
          return an iterator
 int size()
          return the size of the array
 void sort(java.util.Comparator compare)
          sort this array with the specified comparator
 ScalarArray sublist(int start, int end)
          return a view into the array, ideally one that uses the same backing store
 

Method Detail

pop

Scalar pop()
remove the topmost element from the array


push

Scalar push(Scalar value)
add an element onto the end of the array


size

int size()
return the size of the array


getAt

Scalar getAt(int index)
get an element at the specified index


scalarIterator

java.util.Iterator scalarIterator()
return an iterator


add

Scalar add(Scalar value,
           int index)
add an element to the array at the specified index


remove

void remove(Scalar value)
remove all elements with the same identity as the specified scalar


remove

Scalar remove(int index)
remove an element at the specified index


sort

void sort(java.util.Comparator compare)
sort this array with the specified comparator


sublist

ScalarArray sublist(int start,
                    int end)
return a view into the array, ideally one that uses the same backing store