public class IntTuples extends Object
IntTuples.result
tuple as the last parameter. Unless otherwise noted, this tuple will be
returned by the function call. If the given result tuple is
null, then a new tuple will be created and returned.result tuple may be identical
to any of the input tuples.
null| Modifier and Type | Method and Description |
|---|---|
static MutableIntTuple |
add(IntTuple t0,
int value,
MutableIntTuple result)
Add the given value to all elements of the given input
tuples, and store the result in the given result tuple.
|
static MutableIntTuple |
add(IntTuple t0,
IntTuple t1,
MutableIntTuple result)
Add the given input tuples, and store the result in
the given result tuple.
|
static MutableIntTuple |
addScaled(IntTuple t0,
int factor,
IntTuple t1,
MutableIntTuple result)
Computes
t0+factor*t1, and stores the result in the given
result tuple. |
static boolean |
areElementsGreaterThan(IntTuple t,
int value)
Returns whether all elements of the given tuple
are greater than the given value.
|
static boolean |
areElementsGreaterThan(IntTuple t0,
IntTuple t1)
Returns whether one tuple is element-wise
greater than the other.
|
static boolean |
areElementsGreaterThanOrEqual(IntTuple t,
int value)
Returns whether all elements of the given tuple
are greater than or equal to the given value.
|
static boolean |
areElementsGreaterThanOrEqual(IntTuple t0,
IntTuple t1)
Returns whether one tuple is element-wise
greater than or equal to the other.
|
static boolean |
areElementsLessThan(IntTuple t,
int value)
Returns whether all elements of the given tuple
are less than the given value.
|
static boolean |
areElementsLessThan(IntTuple t0,
IntTuple t1)
Returns whether one tuple is element-wise
less than the other
|
static boolean |
areElementsLessThanOrEqual(IntTuple t,
int value)
Returns whether all elements of the given tuple
are less than or equal to the given value.
|
static boolean |
areElementsLessThanOrEqual(IntTuple t0,
IntTuple t1)
Returns whether one tuple is element-wise
less than or equal to the other
|
static List<Integer> |
asList(IntTuple t)
Returns a view on the given tuple as an unmodifiable list.
|
static List<Integer> |
asList(MutableIntTuple t)
Returns a view on the given tuple as a list that does not
allow structural modifications.
|
static MutableIntTuple |
clamp(IntTuple t,
int min,
int max,
MutableIntTuple result)
Clamp the components of the given tuple to be in the specified range,
and write the result into the given result tuple.
|
static MutableIntTuple |
clamp(IntTuple t,
IntTuple min,
IntTuple max,
MutableIntTuple result)
Clamp the components of the given tuple to be in the specified range,
and write the result into the given result tuple.
|
static Comparator<IntTuple> |
comparator(Order order)
Returns a comparator that compares tuples based on the specified
Order. |
static int |
compareColexicographically(IntTuple t0,
IntTuple t1)
Compares two tuples colexicographically, starting with
the elements of the highest index.
|
static int |
compareLexicographically(IntTuple t0,
IntTuple t1)
Compares two tuples lexicographically, starting with
the elements of the lowest index.
|
static IntTuple |
constant(int size,
int value)
Returns a tuple with the specified size, where each
element is the given value.
|
static MutableIntTuple |
copy(IntTuple other)
Creates a new tuple which is a copy of
the given one.
|
static MutableIntTuple |
create(int size)
Creates a new tuple with the given size.
|
static MutableIntTuple |
divide(IntTuple t0,
IntTuple t1,
MutableIntTuple result)
Divide the elements of the given input tuples, and store
the results in the given result tuple.
|
static int |
dot(IntTuple t0,
IntTuple t1)
Computes the dot product of the given tuples
|
static boolean |
incrementColexicographically(IntTuple t,
IntTuple min,
IntTuple max,
MutableIntTuple result)
Colexicographically increment the given tuple in the given range, and
store the result in the given result tuple.
|
static boolean |
incrementLexicographically(IntTuple t,
IntTuple min,
IntTuple max,
MutableIntTuple result)
Lexicographically increment the given tuple in the given range, and
store the result in the given result tuple.
|
static int |
max(IntTuple t)
Computes the maximum value that occurs in the given tuple,
or
Integer.MIN_VALUE if the given tuple has a
size of 0. |
static MutableIntTuple |
max(IntTuple t0,
IntTuple t1,
MutableIntTuple result)
Compute the element-wise maximum of the the given input
tuples, and store the result in the given
result tuple.
|
static int |
min(IntTuple t)
Computes the minimum value that occurs in the given tuple,
or
Integer.MAX_VALUE if the given tuple has a
size of 0. |
static MutableIntTuple |
min(IntTuple t0,
IntTuple t1,
MutableIntTuple result)
Compute the element-wise minimum of the the given input
tuples, and store the result in the given
result tuple.
|
static MutableIntTuple |
multiply(IntTuple t0,
int factor,
MutableIntTuple result)
Multiply the given input tuple with the given factor, and
store the result in the given result tuple.
|
static MutableIntTuple |
multiply(IntTuple t0,
IntTuple t1,
MutableIntTuple result)
Multiply the elements of the given input tuples, and store
the results in the given result tuple.
|
static MutableIntTuple |
negate(IntTuple t0,
MutableIntTuple result)
Negates the given tuple, and store the result in the given result tuple.
|
static MutableIntTuple |
of(int... values)
Creates a new tuple with the given values.
|
static MutableIntTuple |
of(int x)
Creates a new
MutableIntTuple with the given value. |
static MutableIntTuple |
of(int x,
int y)
Creates a new
MutableIntTuple with the given values. |
static MutableIntTuple |
of(int x,
int y,
int z)
Creates a new
MutableIntTuple with the given values. |
static MutableIntTuple |
of(int x,
int y,
int z,
int w)
Creates a new
MutableIntTuple with the given values. |
static MutableIntTuple |
reverse(IntTuple t,
MutableIntTuple result)
Reverse the given tuple.
|
static IntTuple |
reversed(IntTuple t)
Creates a new tuple that is a reversed view on the given
tuple.
|
static MutableIntTuple |
reversed(MutableIntTuple t)
Creates a new tuple that is a reversed view on the given
tuple.
|
static void |
set(MutableIntTuple t,
int v)
Set all elements of the given tuple to the given value
|
static MutableIntTuple |
subtract(IntTuple t0,
int value,
MutableIntTuple result)
Subtract the given value from all elements of the given input
tuple, and store the result in the given result tuple.
|
static MutableIntTuple |
subtract(IntTuple t0,
IntTuple t1,
MutableIntTuple result)
Subtract the given input tuples, and store the result in
the given result tuple.
|
static int[] |
toArray(IntTuple t)
Creates a new array from the contents of the given tuple
|
static MutableDoubleTuple |
toDoubleTuple(IntTuple intTuple)
Convert the given
IntTuple into a DoubleTuple |
static String |
toString(IntTuple tuple,
int maxNumLeadingElements,
int maxNumTrailingElements)
Returns a string representation of the given tuple using
toString(IntTuple, Locale, String, int, int) with
the default locale and format. |
static String |
toString(IntTuple tuple,
Locale locale,
String format,
int maxNumLeadingElements,
int maxNumTrailingElements)
Returns a string representation of the given tuple.
|
static MutableIntTuple |
wrap(int... values)
Creates a new tuple that is a view
on the given values.
|
static MutableIntTuple |
wrap(int[] data,
int offset,
int size)
Returns a new tuple that is a view on the
specified portion of the given array
|
static MutableIntTuple |
wrap(IntBuffer buffer)
Returns a new tuple that is a view on the given buffer.
|
static IntTuple |
zero(int size)
Returns a tuple with the specified size, containing
all zeros.
|
public static IntTuple zero(int size)
size - The sizeIllegalArgumentException - If the size is smaller than 0public static IntTuple constant(int size, int value)
size - The sizevalue - The valueIllegalArgumentException - If the size is smaller than 0public static MutableIntTuple create(int size)
size - The size.IllegalArgumentException - If the size is smaller than 0public static MutableIntTuple copy(IntTuple other)
other - The other tuple.NullPointerException - If the other tuple is nullpublic static MutableIntTuple of(int... values)
wrap(int...) may be
used.values - The valuesNullPointerException - If the given array is nullpublic static MutableIntTuple wrap(int... values)
values - The valuesNullPointerException - If the given array is nullpublic static MutableIntTuple wrap(IntBuffer buffer)
buffer - The buffer for the tupleNullPointerException - If the given buffer is nullpublic static MutableIntTuple wrap(int[] data, int offset, int size)
data - The data for the tupleoffset - The offset in the arraysize - The size of the tupleNullPointerException - If the given data array is nullIllegalArgumentException - If the given offset is negative,
or if offset+size >= data.lengthpublic static int[] toArray(IntTuple t)
t - The tuplepublic static List<Integer> asList(IntTuple t)
t - The tupleNullPointerException - If the given tuple is nullpublic static List<Integer> asList(MutableIntTuple t)
null elements.t - The tupleNullPointerException - If the given tuple is nullpublic static void set(MutableIntTuple t, int v)
t - The tuplev - The valuepublic static MutableIntTuple reverse(IntTuple t, MutableIntTuple result)
t - The input tupleresult - The result tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static IntTuple reversed(IntTuple t)
t - The tupleNullPointerException - If the given tuple is nullpublic static MutableIntTuple reversed(MutableIntTuple t)
t - The tupleNullPointerException - If the given tuple is nullpublic static MutableIntTuple clamp(IntTuple t, int min, int max, MutableIntTuple result)
t - The input tuplemin - The minimum valuemax - The maximum valueresult - The result tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableIntTuple clamp(IntTuple t, IntTuple min, IntTuple max, MutableIntTuple result)
t - The input tuplemin - The minimum valuesmax - The maximum valuesresult - The result tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableIntTuple negate(IntTuple t0, MutableIntTuple result)
t0 - The tuple to negateresult - The tuple that will store the resultpublic static MutableIntTuple add(IntTuple t0, IntTuple t1, MutableIntTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableIntTuple subtract(IntTuple t0, IntTuple t1, MutableIntTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableIntTuple multiply(IntTuple t0, IntTuple t1, MutableIntTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableIntTuple divide(IntTuple t0, IntTuple t1, MutableIntTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableIntTuple add(IntTuple t0, int value, MutableIntTuple result)
t0 - The first input tuplevalue - The value to addresult - The tuple that will store the resultIllegalArgumentException - If the given tuple do not
have the same size
as the result tuplepublic static MutableIntTuple subtract(IntTuple t0, int value, MutableIntTuple result)
t0 - The first input tuplevalue - The value to addresult - The tuple that will store the resultIllegalArgumentException - If the given tuple do not
have the same size
as the result tuplepublic static MutableIntTuple multiply(IntTuple t0, int factor, MutableIntTuple result)
t0 - The input tuplefactor - The scaling factorresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableIntTuple addScaled(IntTuple t0, int factor, IntTuple t1, MutableIntTuple result)
t0+factor*t1, and stores the result in the given
result tuple.t0 - The first input tuplefactor - The scaling factort1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static int dot(IntTuple t0, IntTuple t1)
t0 - The first input tuplet1 - The second input tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static int min(IntTuple t)
Integer.MAX_VALUE if the given tuple has a
size of 0.t - The input tuplepublic static int max(IntTuple t)
Integer.MIN_VALUE if the given tuple has a
size of 0.t - The input tuplepublic static MutableIntTuple min(IntTuple t0, IntTuple t1, MutableIntTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableIntTuple max(IntTuple t0, IntTuple t1, MutableIntTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static int compareLexicographically(IntTuple t0, IntTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static int compareColexicographically(IntTuple t0, IntTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static Comparator<IntTuple> comparator(Order order)
Order. If the given order is null, then
null will be returned.order - The Orderpublic static boolean areElementsGreaterThan(IntTuple t0, IntTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static boolean areElementsGreaterThanOrEqual(IntTuple t0, IntTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static boolean areElementsLessThan(IntTuple t0, IntTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static boolean areElementsLessThanOrEqual(IntTuple t0, IntTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static boolean areElementsGreaterThan(IntTuple t, int value)
t - The tuplevalue - The value to compare topublic static boolean areElementsGreaterThanOrEqual(IntTuple t, int value)
t - The tuplevalue - The value to compare topublic static boolean areElementsLessThan(IntTuple t, int value)
t - The tuplevalue - The value to compare topublic static boolean areElementsLessThanOrEqual(IntTuple t, int value)
t - The tuplevalue - The value to compare topublic static String toString(IntTuple tuple, int maxNumLeadingElements, int maxNumTrailingElements)
toString(IntTuple, Locale, String, int, int) with
the default locale and format.tuple - The tuplemaxNumLeadingElements - The maximum number of leading elementsmaxNumTrailingElements - The maximum number of trailing elementspublic static String toString(IntTuple tuple, Locale locale, String format, int maxNumLeadingElements, int maxNumTrailingElements)
size that is larger than
the sum of the given numbers of leading and trailing elements, then
the string contents will be abbreviated with an ellipsis: "...".toString(t, 3, 1) : (0, 0, 0, ..., 0)toString(t, 2, 0) : (0, 0, ...)toString(t, 0, 2) : (..., 0, 0)toString(t, 9, 9) : (0, 0, 0, 0, 0, 0)tuple - The tuplelocale - The locale. If this is null, then a
canonical string representation of the elements will be used.format - The format. If this is null, then a
canonical string representation of the elements will be used.maxNumLeadingElements - The maximum number of leading elementsmaxNumTrailingElements - The maximum number of trailing elementspublic static MutableDoubleTuple toDoubleTuple(IntTuple intTuple)
IntTuple into a DoubleTupleintTuple - The IntTupleMutableDoubleTuplepublic static MutableIntTuple of(int x)
MutableIntTuple with the given value.x - The x coordinatepublic static MutableIntTuple of(int x, int y)
MutableIntTuple with the given values.x - The x coordinatey - The y coordinatepublic static MutableIntTuple of(int x, int y, int z)
MutableIntTuple with the given values.x - The x coordinatey - The y coordinatez - The z coordinatepublic static MutableIntTuple of(int x, int y, int z, int w)
MutableIntTuple with the given values.x - The x coordinatey - The y coordinatez - The z coordinatew - The w coordinatepublic static boolean incrementLexicographically(IntTuple t, IntTuple min, IntTuple max, MutableIntTuple result)
greater than
or equal to the values in the given minimum tuple.null (but it
may be identical to the input tuple).t - The input tuplemin - The minimum valuesmax - The maximum valuesresult - The result tuplepublic static boolean incrementColexicographically(IntTuple t, IntTuple min, IntTuple max, MutableIntTuple result)
greater than
or equal to the values in the given minimum tuple.null (but it
may be identical to the input tuple).t - The input tuplemin - The minimum valuesmax - The maximum valuesresult - The result tupleCopyright © 2015. All Rights Reserved.