Package sleep.runtime
Interface ScalarArray
-
- All Superinterfaces:
java.io.Serializable
- All Known Implementing Classes:
ListContainer
public interface ScalarArray extends java.io.SerializableThis 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 Scalaradd(Scalar value, int index)add an element to the array at the specified indexScalargetAt(int index)get an element at the specified indexScalarpop()remove the topmost element from the arrayScalarpush(Scalar value)add an element onto the end of the arrayScalarremove(int index)remove an element at the specified indexvoidremove(Scalar value)remove all elements with the same identity as the specified scalarjava.util.IteratorscalarIterator()return an iteratorintsize()return the size of the arrayvoidsort(java.util.Comparator compare)sort this array with the specified comparatorScalarArraysublist(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
-
-