|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--goodsjpi.Persistent
|
+--goodslib.AnyArray
|
+--goodslib.ArrayOfShort
ArrayOfShort is just that, an array of shorts. It is fully
persistent, as it it's derived from Persistent. All reads cause a fetch of the
data, all writes mark it dirty and to be saved.
| Field Summary | |
protected short[] |
array
array holds the shorts in an [] |
| Fields inherited from class goodslib.AnyArray |
used |
| Fields inherited from class goodsjpi.Persistent |
defaultMetaobject, metaobject |
| Constructor Summary | |
ArrayOfShort(int size)
Creates a new ArrayOfShort instance. |
|
ArrayOfShort(int size,
int allocatedSize)
Creates a new ArrayOfShort instance. |
|
ArrayOfShort(short[] src)
Creates a new ArrayOfShort instance, as a copy of the given
short[] |
|
| Method Summary | |
void |
append(short[] tail)
append add the given values to the end of the array |
void |
changeSize(int newSize)
Resize the amount of space taken by the array. |
void |
copy(int dstIndex,
short[] src,
int srcIndex,
int count)
copy into this array from a destination, a given amount of values.
|
short |
getAt(int index)
Get a short at the specified index |
int |
indexOf(short val)
indexOf returns the first occurrence of val |
void |
insert(int index,
int count,
short value)
insert a "count" amount of values at a given index. |
int |
lastIndexOf(short val)
Find the lastIndexOf a given value |
short |
pop()
Use the array as a stack and pop a value. |
void |
push(short value)
Use the array as a stack with the push method. |
void |
putAt(int index,
short value)
Put a short value at a given index |
void |
remove(int index,
int count)
remove a number of values. |
short[] |
toArray()
toArray converts the internal representation to a short[] , of
correct size. |
short |
top()
Check the top boolean with the top method. |
| Methods inherited from class goodslib.AnyArray |
length |
| Methods inherited from class goodsjpi.Persistent |
attachToStorage, clone, clusterWith, finalize, getDatabase, getOid, getStorageId, hashCode |
| Methods inherited from class java.lang.Object |
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected short[] array
array holds the shorts in an []
| Constructor Detail |
public ArrayOfShort(int size)
ArrayOfShort instance.
size - is the initial size, (length)
public ArrayOfShort(int size,
int allocatedSize)
ArrayOfShort instance. (Full of false)
size - , or length of the arrayallocatedSize - is the size it can grow to without re-sizingpublic ArrayOfShort(short[] src)
ArrayOfShort instance, as a copy of the given
short[]
src - a short[] that will be copied| Method Detail |
public void putAt(int index,
short value)
index - an int value, where the value should be setvalue - the short value to be setpublic short getAt(int index)
index - of the short you want
short value, at index "index"public void changeSize(int newSize)
newSize - an int denoting the new size.
public void insert(int index,
int count,
short value)
insert a "count" amount of values at a given index. Throws an
IndexOutOfBoundsException for too small (<0) or too big (>length) count or index.
index - , where to start inserting value(s)count - , how many values to insertvalue - a short value to insert
public void remove(int index,
int count)
remove a number of values. The array shrinks in it's length, but no
resizing is done. Get an IndexOutOfBoundsException for inappropriate index or
count values.
index - , where to start removingcount - , how many values to removepublic void push(short value)
push method.
value - , a short to push to the stackpublic short pop()
pop a value. (Value is removed)
IndexOutOfBoundsExceptions comes when array has hit 0 length.
short valuepublic short top()
top method. This returns what
pop returns, just it doesn't remove the value. In other stack
implementations it may be called peek()
short valuepublic void append(short[] tail)
append add the given values to the end of the array
tail - a short[] that will be appendedpublic short[] toArray()
toArray converts the internal representation to a short[] , of
correct size. Ie: the .length of the return == this.size()
short[] value
public void copy(int dstIndex,
short[] src,
int srcIndex,
int count)
copy into this array from a destination, a given amount of values.
Get a IndexOutOfBounds if the src or count don't fit
dstIndex - , the index (of this array) where to copy tosrc - a short[] , where to copy fromsrcIndex - an int , where to start copying fromcount - an int , how many values to copypublic int indexOf(short val)
indexOf returns the first occurrence of val
val - a short to be looked for
int, where the value was found, or -1public int lastIndexOf(short val)
lastIndexOf a given value
val - a short value to be found (from the back)
int , where the value was found, or -1
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||