|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--goodsjpi.Persistent
|
+--goodslib.AnyArray
|
+--goodslib.ArrayOfObject
ArrayOfObject is just that, an array of Persistents. 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 goodsjpi.Persistent[] |
array
array holds the Persistents in an [] |
| Fields inherited from class goodslib.AnyArray |
used |
| Fields inherited from class goodsjpi.Persistent |
defaultMetaobject, metaobject |
| Constructor Summary | |
ArrayOfObject(int size)
Creates a new ArrayOfObject instance. |
|
ArrayOfObject(int size,
int allocatedSize)
Creates a new ArrayOfObject instance. |
|
ArrayOfObject(goodsjpi.Persistent[] src)
Creates a new ArrayOfObject instance, as a copy of the given
Persistent[] |
|
| Method Summary | |
void |
append(goodsjpi.Persistent[] 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,
goodsjpi.Persistent[] src,
int srcIndex,
int count)
copy into this array from a destination, a given amount of values.
|
goodsjpi.Persistent |
getAt(int index)
Get a Persistent at the specified index |
int |
indexOf(goodsjpi.Persistent obj)
indexOf returns the first occurrence of val |
void |
insert(int index,
int count,
goodsjpi.Persistent value)
insert a "count" amount of values at a given index. |
int |
lastIndexOf(goodsjpi.Persistent obj)
Find the lastIndexOf a given value |
goodsjpi.Persistent |
pop()
Use the array as a stack and pop a value. |
void |
push(goodsjpi.Persistent value)
Use the array as a stack with the push method. |
void |
putAt(int index,
goodsjpi.Persistent value)
Put a Persistent value at a given index |
void |
remove(int index,
int count)
remove a number of values. |
goodsjpi.Persistent[] |
toArray()
toArray converts the internal representation to a Persistent[] , of
correct size. |
goodsjpi.Persistent |
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 goodsjpi.Persistent[] array
array holds the Persistents in an []
| Constructor Detail |
public ArrayOfObject(int size)
ArrayOfObject instance.
size - is the initial size, (length)
public ArrayOfObject(int size,
int allocatedSize)
ArrayOfObject instance. (Full of false)
size - , or length of the arrayallocatedSize - is the size it can grow to without re-sizingpublic ArrayOfObject(goodsjpi.Persistent[] src)
ArrayOfObject instance, as a copy of the given
Persistent[]
src - a Persistent[] that will be copied| Method Detail |
public void putAt(int index,
goodsjpi.Persistent value)
index - an int value, where the value should be setvalue - the Persistent value to be setpublic goodsjpi.Persistent getAt(int index)
index - of the Persistent you want
Persistent value, at index "index"public void changeSize(int newSize)
newSize - an int denoting the new size.
public void insert(int index,
int count,
goodsjpi.Persistent 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 Persistent 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(goodsjpi.Persistent value)
push method.
value - , a Persistent to push to the stackpublic goodsjpi.Persistent pop()
pop a value. (Value is removed)
IndexOutOfBoundsExceptions comes when array has hit 0 length.
Persistent valuepublic goodsjpi.Persistent top()
top method. This returns what
pop returns, just it doesn't remove the value. In other stack
implementations it may be called peek()
Persistent valuepublic void append(goodsjpi.Persistent[] tail)
append add the given values to the end of the array
tail - a Persistent[] that will be appendedpublic goodsjpi.Persistent[] toArray()
toArray converts the internal representation to a Persistent[] , of
correct size. Ie: the .length of the return == this.size()
Persistent[] value
public void copy(int dstIndex,
goodsjpi.Persistent[] 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 Persistent[] , where to copy fromsrcIndex - an int , where to start copying fromcount - an int , how many values to copypublic int indexOf(goodsjpi.Persistent obj)
indexOf returns the first occurrence of val
obj - a Persistent to be looked for
int, where the value was found, or -1public int lastIndexOf(goodsjpi.Persistent obj)
lastIndexOf a given value
obj - a Persistent 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 | |||||||||