|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--jumbo.euclid.Status
|
+--jumbo.euclid.ObjectArray
ObjectArray - array of Objects.
ObjectArray represents a 1-dimensional vector/array of Objects, and is used in SpreadSheets, etc. The class is designed with the idea that all Objects are of the same type, but this is not enforced, and you may wish to experiment.
There is provision for 2 homegenous arrays, INT and REAL , for compatibility with RealArray and IntArray In some cases the type of the Object (e.g. integer) might lead to additional features.
It can be sorted if all Objects are of type Sortable.
Hacked from RealArray - it shares a number of functions.
| Field Summary | |
static int |
INT
|
static int |
OBJECT
|
static int |
REAL
|
| Constructor Summary | |
ObjectArray()
default is an array of zero points |
|
ObjectArray(int n)
creates n-element array initialised to null |
|
ObjectArray(IntArray ia)
convert an IntArray to a ObjectArray |
|
ObjectArray(int n,
java.lang.Object elem1)
set all elements of the array to a given Object |
|
ObjectArray(ObjectArray m)
copy constructor |
|
ObjectArray(ObjectArray m,
int low,
int high)
subarray of another array - inclusive; if low > high or other silly indices, creates default array |
|
ObjectArray(RealArray ra)
convert an RealArray to a ObjectArray |
|
| Method Summary | |
void |
addArray(ObjectArray f)
append elements |
void |
addElement(java.lang.Object f)
append element |
void |
clearArray()
clear all elements of array to null (or 0 or 0.0) |
static java.lang.Object[] |
copy(java.lang.Object[] f)
copy a Object[] into a new one |
void |
deleteElement(int elem)
delete element and close up; if outside range, take no action |
void |
deleteElements(int low,
int high)
delete elements and close up; if outside range take no action |
java.lang.Object |
elementAt(int elem)
extracts a given element from the array |
boolean |
equals(ObjectArray f)
are two arrays equal in all elements? |
java.lang.Object[] |
getArray()
return the array as a Object[]; this has to resize the array to the precise length used , or confusion will result! Note that this gives the user access to the actual array, so that they can alter its contents. |
IntArray |
getIntArray()
return contents as a IntArray if INT, else null |
java.lang.Class |
getObjectClass()
get the Class of the objects, if this is common to all, else null. |
int |
getObjectType()
get the type of the Objects as INT, etc |
RealArray |
getRealArray()
return contents as a RealArray if REAL , else null |
ObjectArray |
getReorderedArray(IntSet idx)
reorder by index in IntSet; does NOT modify array |
java.lang.Object[] |
getReverseArray()
return the elements in reverse order as Object[] |
java.lang.String[] |
getStringValues()
returns values as strings |
ObjectArray |
getSubArray(int start,
int end)
RHS: get a subObjectArray from element start to end |
IntSet |
indexSortAscending()
|
IntSet |
indexSortDescending()
sort array into descending order via indexes; array NOT MODIFIED |
void |
insertArray(int elem,
ObjectArray f)
insert a ObjectArray at position elem and expand |
void |
insertElementAt(int elem,
java.lang.Object f)
insert element and expand; if outside range, take no action |
boolean |
isHomogeneous()
|
static void |
main(java.lang.String[] args)
|
void |
reverse()
MODIFIES ObjectArray to be in reverse order |
void |
setElementAt(int elem,
java.lang.Object f)
set a given element into the array; must be less than current max index |
void |
setElements(int start,
java.lang.Object[] a)
copy a smaller array into the array statrting at start |
void |
setMaxIndex(int max)
reset the maximum index (for when poking elements) (no other effect) |
void |
shallowCopy(ObjectArray m)
shallowCopy |
int |
size()
get actual number of elements |
void |
sortAscending()
MODIFIES ObjectArray to be in ascending order |
void |
sortDescending()
MODIFIES ObjectArray to be in descending order |
java.lang.String |
toString()
concatenates values with spaces |
| Methods inherited from class jumbo.euclid.Status |
NYI |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final int OBJECT
public static final int INT
public static final int REAL
| Constructor Detail |
public ObjectArray()
public ObjectArray(int n)
public ObjectArray(int n,
java.lang.Object elem1)
public ObjectArray(IntArray ia)
public ObjectArray(RealArray ra)
public ObjectArray(ObjectArray m,
int low,
int high)
public ObjectArray(ObjectArray m)
| Method Detail |
public java.lang.Class getObjectClass()
public boolean isHomogeneous()
public int getObjectType()
public void shallowCopy(ObjectArray m)
public java.lang.Object elementAt(int elem)
throws java.lang.ArrayIndexOutOfBoundsException
public int size()
public java.lang.Object[] getArray()
public RealArray getRealArray()
public IntArray getIntArray()
public void clearArray()
public java.lang.Object[] getReverseArray()
public void setMaxIndex(int max)
public boolean equals(ObjectArray f)
throws UnequalArraysException
public void setElementAt(int elem,
java.lang.Object f)
throws java.lang.ArrayIndexOutOfBoundsException
public ObjectArray getSubArray(int start,
int end)
public void setElements(int start,
java.lang.Object[] a)
public void deleteElement(int elem)
public void deleteElements(int low,
int high)
public void insertElementAt(int elem,
java.lang.Object f)
public void insertArray(int elem,
ObjectArray f)
public void addElement(java.lang.Object f)
public void addArray(ObjectArray f)
public ObjectArray getReorderedArray(IntSet idx)
throws BadSubscriptException
public java.lang.String[] getStringValues()
public java.lang.String toString()
public static java.lang.Object[] copy(java.lang.Object[] f)
public void sortAscending()
public void sortDescending()
public void reverse()
public IntSet indexSortAscending()
public IntSet indexSortDescending()
public static void main(java.lang.String[] args)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||