Package sleep.runtime
Interface ScalarArray
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
ListContainer
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Scalar
add(Scalar value, int index)
add an element to the array at the specified indexScalar
getAt(int index)
get an element at the specified indexScalar
pop()
remove the topmost element from the arrayScalar
push(Scalar value)
add an element onto the end of the arrayScalar
remove(int index)
remove an element at the specified indexvoid
remove(Scalar value)
remove all elements with the same identity as the specified scalarjava.util.Iterator
scalarIterator()
return an iteratorint
size()
return the size of the arrayvoid
sort(java.util.Comparator compare)
sort this array with the specified comparatorScalarArray
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
-
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
-
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
-
-