|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--jumbo.euclid.Status
|
+--jumbo.euclid.IntArray
IntArray - array of ints
IntArray represents a 1-dimensional vector/array of ints and is basically a wrapper for int[] in Java There are a lot of useful member functions (sorting, ranges, parallel operations, etc. - have a look)
The default is an array with zero points. All arrays are valid objects.
Attempting to create an array with < 0 points creates a default array (zero points).
Since int[] knows its length (unlike C), there are many cases where int[] can be safely used. However it is not a first-class object and IntArray supplies this feature. int[] is referenceable through getArray().
| Constructor Summary | |
IntArray()
default is an array of zero points |
|
IntArray(int n)
creates n-element array initialised to 0 |
|
IntArray(int[] arr)
from an existing int[] (which knows its length) |
|
IntArray(IntArray m)
copy constructor |
|
IntArray(IntArray ref,
IntArray sub)
use another IntArray to subscript this one; i.e. |
|
IntArray(IntArray m,
int low,
int high)
subarray of another array - inclusive; if low > high or other silly indices, creates default array |
|
IntArray(int n,
int elem1)
set all elements of the array to a given value |
|
IntArray(int n,
int[] arr)
Formed by feeding in an existing array; requires the size. |
|
IntArray(int n,
int elem1,
int delta)
This gives a nelem-element array initialised to elem1+(i-1)*delta |
|
IntArray(int nn,
java.lang.String shape,
int maxval)
Create a given 'shape' of array for data filtering. |
|
IntArray(java.lang.String string)
from a String with space-separated strings representing Ints |
|
IntArray(java.lang.String[] strings)
from an array of Strings (which must represent Ints) |
|
| Method Summary | |
int |
absSumAllElements()
absolute sum of all elements |
void |
addArray(IntArray f)
append elements |
void |
addElement(int f)
append element |
IntArray |
applyFilter(IntArray filter)
apply filter (i.e. |
void |
clearArray()
clear all elements of array |
java.lang.Object |
clone()
clones another IntArray |
static int[] |
copy(int[] f)
copy a int[] into a new one |
IntArray |
cumulativeSum()
cumulative sum of array (new RA contains elem[i] = sum(k = 0 to i) f[k] |
void |
deleteElement(int elem)
delete element and close up; if outside range, take no action |
static int[] |
deleteElements(int[] f,
int low,
int hi)
delete elements (lo - > hi inclusive) in a float[] and close up; if hi >= float.length hi is reset to float.length-1. |
void |
deleteElements(int low,
int high)
delete elements and close up; if outside range take no action |
int |
dotProduct(IntArray f)
dot product of two IntArrays - if of same length - else zero |
int |
elementAt(int elem)
extracts a given element from the array |
boolean |
equals(IntArray f)
are two arrays equal in all elements? (use epsilon as tolerance) |
int[] |
getArray()
return the array as a int[]; 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 |
getReorderedArray(IntSet idx)
reorder by index in IntSet; does NOT modify array |
int[] |
getReverseArray()
return the elements in reverse order as int[] |
java.lang.String[] |
getStringValues()
returns values as strings |
IntArray |
getSubArray(int start,
int end)
RHS: get a subIntArray from element start to end |
int |
indexOfLargestElement()
index of largest element; returns -1 if zero element array |
int |
indexOfSmallestElement()
index of smallest element |
IntSet |
indexSortAscending()
|
IntSet |
indexSortDescending()
sort array into descending order via indexes; array NOT MODIFIED |
int |
innerProduct()
inner product - same as dotProduct |
IntSet |
inRange(IntRange r)
return index of elements within a given range |
void |
insertArray(int elem,
IntArray f)
insert a IntArray at position elem and expand |
void |
insertElementAt(int elem,
int f)
insert element and expand; if outside range, take no action |
boolean |
isClear()
is the array filled with zeros? |
int |
largestElement()
value of largest element |
static void |
main(java.lang.String[] args)
|
IntArray |
multiplyBy(int f)
array multiplication by a scalar; does NOT modify 'this' |
void |
negative()
change the sign of all elements; MODIFIES this |
IntSet |
outOfRange(IntRange r)
return index of elements outside a given range |
IntArray |
plus(IntArray f)
array addition - adds conformable arrays |
IntRange |
range()
range of array (default IntRange for zero array) |
void |
reverse()
MODIFIES array to be in reverse order |
void |
setAllElements(int f)
initialise array to given int[] |
void |
setElementAt(int elem,
int f)
set a given element into the array; must be less than current max index |
void |
setElements(int start,
int[] 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(IntArray m)
shallowCopy |
int |
size()
get actual number of elements |
int |
smallestElement()
value of smallest element |
void |
sortAscending()
MODIFIES array to be in ascending order |
void |
sortDescending()
MODIFIES array to be in ascending order |
IntArray |
subtract(IntArray f)
array subtraction - subtracts conformable arrays |
int |
sumAllElements()
sum all elements |
static void |
test()
|
java.lang.String |
toString()
concatenates values with spaces |
| Methods inherited from class jumbo.euclid.Status |
NYI |
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public IntArray()
public IntArray(int n)
public IntArray(int n,
int elem1,
int delta)
public IntArray(int n,
int elem1)
public IntArray(int n,
int[] arr)
public IntArray(int[] arr)
public IntArray(IntArray m,
int low,
int high)
public IntArray(IntArray ref,
IntArray sub)
throws java.lang.IllegalArgumentException
public IntArray(IntArray m)
public IntArray(int nn,
java.lang.String shape,
int maxval)
public IntArray(java.lang.String[] strings)
throws java.lang.NumberFormatException
public IntArray(java.lang.String string)
throws java.lang.NumberFormatException
| Method Detail |
public java.lang.Object clone()
public void shallowCopy(IntArray m)
public int elementAt(int elem)
throws java.lang.ArrayIndexOutOfBoundsException
public int size()
public int[] getArray()
public void clearArray()
public int[] getReverseArray()
public void setMaxIndex(int max)
public boolean equals(IntArray f)
throws UnequalArraysException
public IntArray plus(IntArray f)
throws UnequalArraysException
public IntArray subtract(IntArray f)
throws UnequalArraysException
public void negative()
public IntArray multiplyBy(int f)
public void setElementAt(int elem,
int f)
throws java.lang.ArrayIndexOutOfBoundsException
public IntArray getSubArray(int start,
int end)
public void setElements(int start,
int[] a)
public boolean isClear()
public void setAllElements(int f)
public int sumAllElements()
public int absSumAllElements()
public int innerProduct()
public int dotProduct(IntArray f)
throws UnequalArraysException
public IntArray cumulativeSum()
does not modify 'this'
public IntArray applyFilter(IntArray filter)
The filter can be created with a IntArray constructor
public int indexOfLargestElement()
public int indexOfSmallestElement()
public int largestElement()
public int smallestElement()
public IntRange range()
public void deleteElement(int elem)
public void deleteElements(int low,
int high)
public void insertElementAt(int elem,
int f)
public void insertArray(int elem,
IntArray f)
public void addElement(int f)
public void addArray(IntArray f)
public IntArray getReorderedArray(IntSet idx)
throws BadSubscriptException
public IntSet inRange(IntRange r)
public IntSet outOfRange(IntRange r)
public java.lang.String[] getStringValues()
public java.lang.String toString()
public static int[] deleteElements(int[] f,
int low,
int hi)
public static int[] copy(int[] f)
public void sortAscending()
public void sortDescending()
public void reverse()
public IntSet indexSortAscending()
public IntSet indexSortDescending()
public static void test()
public static void main(java.lang.String[] args)
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||