|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.inria.oadymppac.utils.DynamicIntArray
Field Summary | |
static int |
NONE
Comment for NONE
This defines the NONE value for the DynamicArrayList.
|
Constructor Summary | |
DynamicIntArray()
build a default dynamic integer array : The initial capacity is set to DEFAULT_EXTEND The default block size for extension is set to the DEFAULT_EXTEND |
|
DynamicIntArray(int reserve)
build a new dynamic integer array : |
|
DynamicIntArray(int[] values)
build a new dynamic integer array with predefined values |
|
DynamicIntArray(int reserve,
int extend)
build a new dynamic integer array : |
Method Summary | |
void |
add(int element)
Append a new element at the end of the array |
void |
add(int[] elements)
Append a set a of new elements at the end of the array |
void |
clear()
Clear the array : the content is reset but the array remains usable Its capacity remains avalilable to store new elements. |
int |
clear(int index)
Clear the value of the array at index |
void |
clear(int from,
int to)
Clear the values contained by the array between index from and index to; the rest of the array is not |
java.lang.Object |
clone()
Clone the Array (i.e. build a copy) |
int |
count()
count the number of values different from NONE |
int |
get(int index)
query the array to get the value stored at index |
int |
getExtend()
Query the array to get it current block size for extension |
int[] |
getValues()
|
void |
insert(int index,
int[] elements)
Insert into the array a set a of new elements at the given index |
int |
last()
gives index of a significant value |
void |
remove(int element)
remove all occurence of the given element from the array |
void |
remove(int indexFrom,
int indexTo)
Remove the element stored between index from and index to |
void |
removeAt(int index)
Remove the element stored at index in the array |
int |
set(int index,
int element)
Store the given element at the given index |
void |
setExtend(int extend)
Set the block size for extension; |
void |
shrink()
collect the NONE values NOTE : calling this method |
int[] |
toArray()
Build a copy of the array limited to the last element |
java.lang.String |
toString()
Convert the dynamic array into a string |
java.lang.String |
toStringContent()
Convert the content of the array into a string |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int NONE
NONE
This defines the NONE value for the DynamicArrayList.
This particular value is used to mark removed element
or to fill the unused space of the array
Constructor Detail |
public DynamicIntArray()
public DynamicIntArray(int reserve)
reserve
- : the initial capacity of the array
The default block size for extension is set to the DEFAULT_EXTENDpublic DynamicIntArray(int reserve, int extend)
reserve
- = the initial capacityextend
- = the default block size for extensionpublic DynamicIntArray(int[] values)
values
- : the intial values of this array;Method Detail |
public void add(int element)
element
- : the integer appendedpublic void add(int[] elements)
elements
- : elements to appentdpublic void insert(int index, int[] elements)
elements
- : elements to append
NOTE: The previous constant is first shifted
and then elements are insertedpublic final void clear()
public int clear(int index)
index
- : the index to be cleared;
public void clear(int from, int to)
public final java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
The content is also cloned
public final int count()
public final int get(int index)
index
- : the index of the value
public final int getExtend()
public int last()
public void remove(int element)
element
- : the value to remove from the arraypublic void remove(int indexFrom, int indexTo)
indexFrom
- : the first index of element to be removedpublic void removeAt(int index)
index
- : the index of the removedremove(int from , int to);
public int set(int index, int element)
index
- : the storage indexelement
- : the element to store
public final void setExtend(int extend)
extend
- : the new size for extensionpublic final int[] toArray()
public java.lang.String toString()
Object.toString()
public java.lang.String toStringContent()
public void shrink()
public int[] getValues()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |