|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgoodsjpi.Persistent
goodslib.AnyArray
goodslib.ArrayOfBoolean
ArrayOfBoolean
is just that, an array of booleans. For efficiency
they are stored in a byte[] internally.
Field Summary | |
protected byte[] |
array
array holds the booleans in a byte [] |
Fields inherited from class goodslib.AnyArray |
used |
Fields inherited from class goodsjpi.Persistent |
defaultMetaobject, metaobject |
Constructor Summary | |
ArrayOfBoolean(boolean[] src)
Creates a new ArrayOfBoolean instance, as a copy of the given
boolean[] |
|
ArrayOfBoolean(int size)
Creates a new ArrayOfBoolean instance. |
|
ArrayOfBoolean(int size,
int allocatedSize)
Creates a new ArrayOfBoolean instance. |
Method Summary | |
void |
append(boolean[] 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,
boolean[] src,
int srcIndex,
int count)
copy into this array from a destination, a given amount of values.
|
boolean |
getAt(int index)
Get a boolean at the specified index |
int |
indexOf(boolean val)
indexOf returns the first occurrence of val |
void |
insert(int index,
int count,
boolean value)
insert a "count" amount of values at a given index. |
int |
lastIndexOf(boolean val)
Find the lastIndexOf a given value |
boolean |
pop()
Use the array as a stack and pop a value. |
void |
push(boolean value)
Use the array as a stack with the push method. |
void |
putAt(int index,
boolean value)
Put a boolean value at a given index |
void |
remove(int index,
int count)
remove a number of values. |
boolean[] |
toArray()
toArray makes a Java boolean[] out of the values. |
boolean |
top()
Check the top boollean 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, onLoad |
Methods inherited from class java.lang.Object |
equals, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected byte[] array
array
holds the booleans in a byte []
Constructor Detail |
public ArrayOfBoolean(int size)
ArrayOfBoolean
instance.
size
- is the initial size, (length)public ArrayOfBoolean(int size, int allocatedSize)
ArrayOfBoolean
instance. (Full of false)
size
- size or length of the arrayallocatedSize
- is the size it can grow to without resizingpublic ArrayOfBoolean(boolean[] src)
ArrayOfBoolean
instance, as a copy of the given
boolean[]
src
- a boolean[]
that will be copiedMethod Detail |
public void putAt(int index, boolean value)
index
- an int
value, where the value should be setvalue
- the boolean
value to be setpublic boolean getAt(int index)
index
- of the boolean you want
boolean
value, at index "index"public void changeSize(int newSize)
newSize
- an int
denoting the new size.public void insert(int index, int count, boolean 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 boolean
value to insertpublic 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(boolean value)
push
method.
value
- , a boolean
to push to the stackpublic boolean pop()
pop
a value. (Value is removed)
IndexOutOfBoundsExceptions comes when array has hit 0 length.
boolean
valuepublic boolean top()
top
method. This returns what
pop
returns, just it doesn't remove the value. In other stack
implementations it may be called peek()
boolean
valuepublic void append(boolean[] tail)
append
add the given values to the end of the array
tail
- a boolean[]
that will be appendedpublic boolean[] toArray()
toArray
makes a Java boolean[] out of the values. Internally they
are stored in a byte[] for space efficiency
boolean[]
public void copy(int dstIndex, boolean[] 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 boolean[]
, where to copy fromsrcIndex
- an int
, where to start copying fromcount
- an int
, how many values to copypublic int indexOf(boolean val)
indexOf
returns the first occurrence of val
val
- a boolean
to be looked for
int
, where the value was found, or -1public int lastIndexOf(boolean val)
lastIndexOf
a given value
val
- a boolean
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 |