Package ints
Interface IntArray
-
- All Known Subinterfaces:
DuplicatesGTRec,GTRec,RefGTRec
- All Known Implementing Classes:
BasicGTRec,BitSetGTRec,BitSetRefGTRec,CharArray,IndexArray,LowMafDiallelicGTRec,LowMafGTRec,LowMafRefDiallelicGTRec,LowMafRefGTRec,PackedIntArray,SeqCodedRefGTRec,UnsignedByteArray,VcfRec,WrappedIntArray
public interface IntArrayInterface
Instances of classIntArrayrepresents an immutableint[]array.IntArrayare required to be immutable.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static java.lang.StringasString(IntArray ia)Returns a string representation of thisIntArrayby applyingjava.utils.Arrays.toString()to an equivalentint[]object.static IntArraycreate(int[] ia, int valueSize)Returns a newIntArrayinstance that has the same sequence of integers as the specified array.static IntArraycreate(IntList il, int valueSize)Returns a newIntArrayinstance that has the same sequence of integers as the specified list.static booleanequals(IntArray a, IntArray b)Returnstrueif the specifiedIntArrayobjects represent the same sequence of integer values, and returnsfalseotherwise.intget(int index)Returns the specified array element.static intmax(IntArray ia)Returns the maximum element, orInteger.MIN_VALUEifthis.size() == 0.static intmin(IntArray ia)Returns the minimum element, orInteger.MAX_VALUEifthis.size() == 0.intsize()Returns the number of elements in thisIntArray.static int[]toArray(IntArray ia)Returns a copy of the specified array.
-
-
-
Method Detail
-
size
int size()
Returns the number of elements in thisIntArray.- Returns:
- the number of elements in this
IntArray
-
get
int get(int index)
Returns the specified array element.- Parameters:
index- an array index- Returns:
- the specified array element
- Throws:
java.lang.IndexOutOfBoundsException- ifindex < 0 || index >= this.size()
-
toArray
static int[] toArray(IntArray ia)
Returns a copy of the specified array.- Parameters:
ia- a list of integers- Returns:
- a copy of the specified array
- Throws:
java.lang.NullPointerException- ifia == null
-
asString
static java.lang.String asString(IntArray ia)
Returns a string representation of thisIntArrayby applyingjava.utils.Arrays.toString()to an equivalentint[]object.- Parameters:
ia- a list of integers- Returns:
- a string representation of this
IntArray. - Throws:
java.lang.NullPointerException- ifia == null
-
equals
static boolean equals(IntArray a, IntArray b)
Returnstrueif the specifiedIntArrayobjects represent the same sequence of integer values, and returnsfalseotherwise.- Parameters:
a- a sequence of integer valuesb- a sequence of integer values- Returns:
trueif the specifiedIntArrayobjects represent the same sequence of integer values
-
max
static int max(IntArray ia)
Returns the maximum element, orInteger.MIN_VALUEifthis.size() == 0.- Parameters:
ia- a list of integers- Returns:
- the maximum element
- Throws:
java.lang.NullPointerException- ifia == null
-
min
static int min(IntArray ia)
Returns the minimum element, orInteger.MAX_VALUEifthis.size() == 0.- Parameters:
ia- a list of integers- Returns:
- the minimum element
- Throws:
java.lang.NullPointerException- ifia == null
-
create
static IntArray create(int[] ia, int valueSize)
Returns a newIntArrayinstance that has the same sequence of integers as the specified array.- Parameters:
ia- the array of integers to be copiedvalueSize- the exclusive end of the range of non-negative array values- Returns:
- a new
IntArrayinstance that has the same sequence of integers as the specified array - Throws:
java.lang.IllegalArgumentException- ifvalueSize < 1java.lang.IllegalArgumentException- if(ia[j] < 0 || ia[j] > valueSize)for any indexjsatisfying(j >= 0 && j < ia.length)java.lang.NullPointerException- ifia == null
-
create
static IntArray create(IntList il, int valueSize)
Returns a newIntArrayinstance that has the same sequence of integers as the specified list.- Parameters:
il- the list of integers to be copiedvalueSize- the exclusive end of the range of non-negative array values- Returns:
- a new
IntArrayinstance that has the same sequence of integers as the specified list - Throws:
java.lang.IllegalArgumentException- ifvalueSize < 1java.lang.IllegalArgumentException- if(ia[j] < 0 || ia[j] > valueSize)for any indexjsatisfying(j >= 0 && j < ia.length)java.lang.NullPointerException- ifia == null
-
-