|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.util.IntArray
This is a utility for storing an expandable array of integers. Similar to a Vector but for int values instead.
| Field Summary | |
int[] |
data
This is the array of integers itself. |
int |
growSize
This specifies the number of values to increase by when expansion is needed. |
int |
length
This specifies the number of valid values in the array. |
| Constructor Summary | |
IntArray()
Creates an IntArray with an initial size of 100 and a grow size of 100. |
|
IntArray(int initialSize,
int growSize)
Creates an IntArray with the specified initial size and grow size. |
|
| Method Summary | |
void |
add(int value)
Append a value to the end of the array. |
void |
append(int value)
|
void |
append(int[] values,
int offset,
int length)
|
int[] |
appendTo(int[] dest)
Append all values in this IntArray to the specified destination array. |
int[] |
appendTo(int[] dest,
boolean reverse)
Append all values in this IntArray to the specified destination array with the option of reversing the order of integers in this IntArray before appending. |
void |
clear()
Clears the IntArray completely. |
void |
copyInto(int[] dest,
int offset)
Copy all values into the destination array at the specified offset. |
Object |
getCopy()
Return a copy of this object. |
int |
indexOf(int value)
Find the index of the specified value. |
void |
insert(int[] values,
int offset,
int length,
int where)
|
void |
insert(int value,
int index)
Insert a value at the specified index. |
boolean |
makeSpace(int where,
int num)
This adds space to the IntArray at the specified index, increasing the length value by num. |
void |
remove(int value)
Remove the value if it is in the array. |
void |
removeAtIndex(int index)
Remove the value at the specified index. |
int[] |
toIntArray()
Return a copy of the array of integers whose length exactly holds all added integers. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public int[] data
public int length
public int growSize
| Constructor Detail |
public IntArray()
public IntArray(int initialSize,
int growSize)
| Method Detail |
public Object getCopy()
Copyable
getCopy in interface Copyablepublic void clear()
public void add(int value)
public void append(int value)
public boolean makeSpace(int where,
int num)
public void insert(int[] values,
int offset,
int length,
int where)
public void append(int[] values,
int offset,
int length)
public void insert(int value,
int index)
public int indexOf(int value)
public void remove(int value)
public void removeAtIndex(int index)
public int[] toIntArray()
public void copyInto(int[] dest,
int offset)
public int[] appendTo(int[] dest)
public int[] appendTo(int[] dest,
boolean reverse)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||