|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--org.abora.white.xpp.basic.Heaper
|
+--org.abora.white.collection.arrays.PrimArray
Array object of a fixed size composed of elements of the same type.
| Constructor Summary | |
protected |
PrimArray()
Construct a new array. |
| Method Summary | |
abstract boolean |
contentsEqual(PrimArray other)
Whether the two ranges contain semantically the same values. |
int |
contentsHash()
A hash of the entire contents of the array. |
PrimArray |
copy()
Return a copy of this. |
PrimArray |
copy(int count)
Return a copy of this including just the first count elements. |
PrimArray |
copy(int count,
int start)
Return a copy of this including just the elements specified by the index range. |
PrimArray |
copy(int count,
int start,
int before)
Return a copy of this including just the elements specified by the index range prepended by before number of null or 0 elements. |
PrimArray |
copy(int count,
int start,
int before,
int after)
Return a copy of this including just the elements specified by the index range prepended by before, and postpended by after
number of null or 0 elements. |
protected void |
copyElements(int to,
PrimArray other,
int from,
int count)
Copy the respective elements of other to this over the specified index range. |
PrimArray |
copyGrow(int after)
Return a copy of this with after null/0 elements
postpended to the copied elements. |
abstract int |
count()
Return the number of elements the array can hold. |
boolean |
elementsEqual(int here,
PrimArray other)
|
boolean |
elementsEqual(int here,
PrimArray other,
int there)
|
abstract boolean |
elementsEqual(int here,
PrimArray other,
int there,
int n)
Whether the two ranges contain the same values, using the criteria defined in contentsEqual |
int |
elementsHash()
|
int |
elementsHash(int count)
|
abstract int |
elementsHash(int count,
int start)
A hash of the range of values out of the array. |
abstract Heaper |
fetchValue(int index)
Fetch a value; may be a Heaper, null, or a PrimValue as appropriate to PrimArray subclass. |
Heaper |
getValue(int index)
Fetch a value; may be a Heaper or a PrimValue as appropriate to PrimArray subclass, or throw an exception if value is null. |
int |
indexOf(Heaper value)
Return the index of the first occurrence of the given value, or -1 if there is none. |
int |
indexOf(Heaper value,
int start)
Return the index of the first occurrence of the given value at or after (before if nth is negative) the given index, or -1 if there is none. |
abstract int |
indexOf(Heaper value,
int start,
int n)
Return the index of the nth occurrence of the given value at or after (before if nth is negative) the given index, or -1 if there is none. |
int |
indexOfElements(PrimArray other)
Return the index of the first occurrence of other in this
or -1 if there is none. |
int |
indexOfElements(PrimArray other,
int otherCount)
Return the index of the first occurrence of the given sequence of values of other in this, or -1 if there is none.at or after (before if nth is negative) the given |
int |
indexOfElements(PrimArray other,
int otherCount,
int otherStart)
Return the index of the first occurrence of the given sequence of values of other in this, or -1 if there is none.at or after (before if nth is negative) the given |
int |
indexOfElements(PrimArray other,
int otherCount,
int otherStart,
int start)
Return the index of the first occurrence of the given sequence of values of other at or after the given index
index in this, or -1 if there is none. |
int |
indexOfElements(PrimArray other,
int otherCount,
int otherStart,
int start,
int nth)
Return the index of the nth occurrence of the given sequence
of values of other at or after (before if nth is negative) the given
index in this, or -1 if there is none. |
int |
indexPast(Heaper value)
Return the index of the first occurrence of anything but the given value, or -1 if there is none. |
int |
indexPast(Heaper value,
int start)
Return the index of the first occurrence of anything but the given value at or after (before if nth is negative) the given index, or -1 if there is none. |
abstract int |
indexPast(Heaper value,
int start,
int n)
Return the index of the nth occurrence of anything but the given value at or after (before if nth is negative) the given index, or -1 if there is none. |
boolean |
isEqual(Heaper other)
Return true if the two objects are equal. |
protected abstract PrimArray |
makeNew(int size,
PrimArray source,
int sourceOffset,
int count,
int destOffset)
Return a new array of the same type as this
initialized with the elements of source specified by
the index range, prepended by destOffset and postpended by
null or 0 elements. |
protected void |
printElementOn(int index,
java.io.PrintWriter oo)
Print a representation of the element at the given index. |
void |
printOn(java.io.PrintWriter oo)
This should rarely be overridden. |
abstract PrimSpec |
spec()
A description of the kinds of things which can be stored in this array |
void |
storeAll(Heaper value)
Fill every element of this to value or null or 0 depending on the type of array. |
void |
storeAll(Heaper value,
int count)
|
abstract void |
storeAll(Heaper value,
int count,
int start)
Fill a consequitive range of elements with the supplied value. |
void |
storeMany(int to,
PrimArray other)
Copy n elements from the other array into this one. |
void |
storeMany(int to,
PrimArray other,
int count)
Copy n elements from the other array into this one. |
void |
storeMany(int to,
PrimArray other,
int count,
int from)
Copy the respective elements of other to this over the specified index range. |
abstract void |
storeValue(int index,
Heaper value)
Store a value; may be a Heaper, null, or a PrimValue as appropriate to PrimArray subclass. |
protected abstract Heaper |
zeroElement()
Return a suitable immutable zero element for this type of array; either 0 or null. |
void |
zeroElements()
|
void |
zeroElements(int from)
|
void |
zeroElements(int from,
int count)
|
| Methods inherited from class org.abora.white.xpp.basic.Heaper |
actualHashForEqual, destroy, destruct, equals, hashForEqual, printContentsOn, sendSelfTo, toString |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
protected PrimArray()
| Method Detail |
protected abstract PrimArray makeNew(int size,
PrimArray source,
int sourceOffset,
int count,
int destOffset)
this
initialized with the elements of source specified by
the index range, prepended by destOffset and postpended by
null or 0 elements.
size - size of new array.source - source of elements to be initialized with in the new array.sourceOffset - first index of the source array to be included in the range.count - number of elements of source to include in the new arraydestOffset - first index of new array to be initialized with source elements.
public abstract int count()
public abstract PrimSpec spec()
public abstract void storeValue(int index,
Heaper value)
this can hold.
It is expected that most PrimArray clients will want to use less abstract access methods
index - index in array the element will be stored at.value - heaper to store in this.
java.lang.ClassCastException - if value is not compatible with the elements of this array
java.lang.IllegalArgumentException - if value can not be held by this arraypublic abstract Heaper fetchValue(int index)
It is expected that most PrimArray clients will want to use less abstract access methods.
index - index in array whose element will be returned
index.public Heaper getValue(int index)
It is expected that most PrimArray clients will want to use less abstract access methods.
index - index in array whose element will be returned.
index.
NotInTableException - if a null value was fetched.public boolean isEqual(Heaper other)
Heaper
isEqual in class Heaperpublic abstract boolean contentsEqual(PrimArray other)
public int contentsHash()
public abstract boolean elementsEqual(int here,
PrimArray other,
int there,
int n)
public boolean elementsEqual(int here,
PrimArray other,
int there)
public boolean elementsEqual(int here,
PrimArray other)
public abstract int elementsHash(int count,
int start)
public int elementsHash(int count)
public int elementsHash()
public abstract void storeAll(Heaper value,
int count,
int start)
value.
value - to store within range or 0.0 if null.count - number of consequentive elements in range or all
elements from start if -1.start - index of first element in range.
java.lang.ClassCastException - if other is not compatible with this array
java.lang.IllegalArgumentException - if others elements can not be held by this array
public void storeAll(Heaper value,
int count)
public void storeAll(Heaper value)
public void storeMany(int to,
PrimArray other,
int count,
int from)
other to this over the specified index range.
The other array must be of a compatible type.
to - first index of receiver to be included in the receivers range..other - other elements to be copied into this.count - number of elements from the other array included in range, or -1 for
all others elements starting at from. Fail if count is
greater than number of available elements.from - first index of the other array to be included in the range.
java.lang.ClassCastException - if other is not compatible with this array
java.lang.IllegalArgumentException - if others elements can not be held by this array
public void storeMany(int to,
PrimArray other,
int count)
public void storeMany(int to,
PrimArray other)
public PrimArray copy(int count,
int start,
int before,
int after)
before, and postpended by after
number of null or 0 elements.
If before == 10, then the the resulting array with be 10 elements
larger and the copied elements would start at index 10.
count - number of elements to copy, or -1 for all from and after startstart - index of first element to copy frombefore - number of leading null or 0 elements to include before the copied
elements in the returned array.after - number of trailing null or 0 elements to include after the copied
elements in the returned array.
public PrimArray copy(int count,
int start,
int before)
before number of null or 0 elements.
If before == 10, then the the resulting array with be 10 elements
larger and the copied elements would start at index 10.
count - number of elements to copy, or -1 for all from and after startstart - index of first element to copy frombefore - number of leading null or 0 elements in include before the copied
elements in the returned array.
public PrimArray copy(int count,
int start)
count - number of elements to copy, or -1 for all from and after startstart - index of first element to copy from
public PrimArray copy(int count)
count -
public PrimArray copy()
public PrimArray copyGrow(int after)
after null/0 elements
postpended to the copied elements.
after - number of trailing null or 0 elements to include after the copied
elements in the returned array.
protected void copyElements(int to,
PrimArray other,
int from,
int count)
other to this over the specified index range.
The other array must be of a compatible type.
to - first index of receiver to be included in the receivers range..other - other elements to be copied into this.from - first index of the other array to be included in the range.count - number of elements from the other array included in range, or -1 for
all others elements starting at from. Fail if count is
greater than number of available elements.
public abstract int indexOf(Heaper value,
int start,
int n)
value - element that is to be matchedstart - index to start the search. If positive start from that index,
if negative start from relatie to end of array
public int indexOf(Heaper value,
int start)
value - element that is to be matchedstart - index to start the search. If positive start from that index,
if negative start from relatie to end of array
public int indexOf(Heaper value)
value - element that is to be matched
public abstract int indexPast(Heaper value,
int start,
int n)
value - anything except this element that is to be matchedstart - index to start the search. If positive start from that index,
if negative start from relatie to end of array
public int indexPast(Heaper value,
int start)
value - anything except this element that is to be matchedstart - index to start the search. If positive start from that index,
if negative start from relatie to end of array
public int indexPast(Heaper value)
value - anything except this element that is to be matched
public int indexOfElements(PrimArray other,
int otherCount,
int otherStart,
int start,
int nth)
nth occurrence of the given sequence
of values of other at or after (before if nth is negative) the given
index in this, or -1 if there is none. Negative numbers for start are
relative to the end of the array.
other - array of elements that is being searched for in this.otherCount - number of elements from other that is being
searched for, or -1 to include all elements after otherStart.otherStart - index of first element of other to start searching for.start - index to start the search from. If positive start from that index,
if negative start from relative to end of array where -1 is the last valid index.nth - nth occurrence of the matched value at or after the start if
positive, or at or before if negative. A 0 nth immediately fails.
public int indexOfElements(PrimArray other,
int otherCount,
int otherStart,
int start)
other at or after the given index
index in this, or -1 if there is none. Negative numbers for start are
relative to the end of the array.
other - array of elements that is being searched for in this.otherCount - number of elements from other that is being
searched for, or -1 to include all elements after otherStart.otherStart - index of first element of other to start searching for.start - index to start the search from. If positive start from that index,
if negative start from relative to end of array where -1 is the last valid index.
public int indexOfElements(PrimArray other,
int otherCount,
int otherStart)
other in this, or -1 if there is none.at or after (before if nth is negative) the given
other - array of elements that is being searched for in this.otherCount - number of elements from other that is being
searched for, or -1 to include all elements after otherStart.otherStart - index of first element of other to start searching for.
public int indexOfElements(PrimArray other,
int otherCount)
other in this, or -1 if there is none.at or after (before if nth is negative) the given
other - array of elements that is being searched for in this.otherCount - number of elements from other that is being
searched for, or -1 to include all elements.
public int indexOfElements(PrimArray other)
other in this
or -1 if there is none.
other - array of elements that is being searched for in this.
public void printOn(java.io.PrintWriter oo)
Heaper
printOn in class Heaper
protected void printElementOn(int index,
java.io.PrintWriter oo)
index.
index - index of element to be printed.oo - print stream to write element representation to.
public void zeroElements(int from,
int count)
public void zeroElements(int from)
public void zeroElements()
protected abstract Heaper zeroElement()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||