Package org.xcsp.modeler.api
Interface ProblemAPIOnVals
-
- All Superinterfaces:
ProblemAPIBase
- All Known Subinterfaces:
ProblemAPI
,ProblemAPISymbolic
- All Known Implementing Classes:
AllInterval
,Bibd
,Blackhole
,BoardColoration
,MagicSequence
,Pic
,Pic2
,Queens
,Rack
,Rack2
,Sudoku
,Warehouse
,Zebra
public interface ProblemAPIOnVals extends ProblemAPIBase
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.xcsp.modeler.api.ProblemAPIBase
ProblemAPIBase.Index, ProblemAPIBase.Occurrences
-
-
Field Summary
-
Fields inherited from interface org.xcsp.modeler.api.ProblemAPIBase
ANY, api2imp, BLOCKS, CHANNELING, CLOSED, CLUES, COLUMNS, DECREASING, DIAGONALS, EQ, EXPRESSION, FIRST, GE, GT, IN, INCREASING, LAST, LE, LEX, LT, MAXIMUM, MINIMUM, NE, NEGATIVE, NOGOODS, NOTIN, NVALUES, POSITIVE, PRODUCT, REDUNDANT_CONSTRAINTS, ROWS, STAR, STAR_INT, STAR_SYMBOL, STRICTLY_DECREASING, STRICTLY_INCREASING, SUM, SYMMETRY_BREAKING
-
-
Method Summary
All Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description default int[]
addInt(int[] t, int value)
Appends the specified value to the specified array.default int[]
addInt(int[] t, int value, int index)
Inserts the specified value in the specified array at the specified index.default int[][]
allCartesian(int[] nValues)
Builds an array containing all tuples from the Cartesian product defined from the specified numbers of values.default int[][]
allCartesian(int[] nValues, java.util.function.Predicate<int[]> p)
Builds an array containing the tuples from the Cartesian product (defined from the specified numbers of values) that respect the specified predicate.default int[][]
allCartesian(int nValues, int tupleLength)
Builds an array containing all tuples from the Cartesian product defined from the specified number of values.default int[][]
allCartesian(int nValues, int tupleLength, java.util.function.Predicate<int[]> p)
Builds an array containing the tuples from the Cartesian product (defined from the specified numbers of values and length) that respect the specified predicate.default int[][]
allCombinations(int[] nValues)
Builds an array containing all combinations that can be obtained from the specified number of values.default int[][]
allCombinations(int nValues, int tupleLength)
Builds an array containing all combinations that can be obtained from the specified number of values.default int[][]
allPermutations(int nValues)
Builds an array containing all permutations that can be obtained from the specified number of values.default int[][]
allPermutations(int[] nValues)
Builds an array containing all permutations that can be obtained from the specified number of values.default int[]
columnOf(int[][] m, int idColumn)
Selects from the specified 2-dimensional array the column at the specified index.default boolean
contains(int[] t, int v)
Returnstrue
iff the specified value is contained in the specified arraydefault int[]
distinctSorted(int... t)
Deprecated.default int[]
distinctSorted(int[][] m)
Deprecated.default int[][]
dub(int[] values)
Returns a 2-dimensional array obtained from the specified 1-dimensional array after replacing each value with an array of length 1 only containing this value.default String[][]
dub(String[] values)
Returns a 2-dimensional array obtained from the specified 1-dimensional array after replacing each value with an array of length 1 only containing this value.default int
firstFrom(Range r, FunctionalInterfaces.Intx1Predicate p)
Returns the first value in the specified range that satisfies the specified predicate.default int
firstFrom(Range r, FunctionalInterfaces.Intx1Predicate p, int defaultValue)
Returns the first value in the specified range that satisfies the specified predicate, if one is found.default int
maxOf(int[] t)
Returns the maximum value in the specified array.default int
minOf(int[] t)
Returns the minimum value in the specified array.default int[]
repeat(int value, int length)
Builds a 1-dimensional array of in by putting/repeating in itlength
occurrences ofvalue
.default int[][]
select(int[][] m, java.util.function.Predicate<int[]> p)
Builds and returns a 2-dimensional array of integers, obtained by selecting from the specified array any row (tuple) that satisfies the specified predicate.default int[]
select(int[] t, int[] indexes)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an indexi
present in theindexes
argument.default int[]
select(int[] t, int fromIndex, int toIndex)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an indexi
going from thefromIndex
argument (inclusive) to thetoIndex
argument (exclusive).default int[]
select(int[] t, FunctionalInterfaces.Intx1Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value that satisfies the specified predicate.default int[]
select(Range r, FunctionalInterfaces.Intx1Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified range any value that satisfies the specified predicate.default int[]
selectFromIndexing(int[][][] c, FunctionalInterfaces.Intx3Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an index(i,j,k)
that satisfies the specified predicate.default int[]
selectFromIndexing(int[][] m, FunctionalInterfaces.Intx2Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an index(i,j)
that satisfies the specified predicate.default int[]
selectFromIndexing(int[] t, FunctionalInterfaces.Intx1Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an indexi
that satisfies the specified predicate.default int[]
singleValuesFrom(int[] t, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified array.default <T> int[]
singleValuesFrom(Collection<T> c, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified collection.default int[]
singleValuesFrom(java.util.stream.IntStream stream, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified stream.default <T> int[]
singleValuesFrom(java.util.stream.Stream<T> stream, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified stream.default int[]
singleValuesFrom(Range r, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified range.default <T> int[]
singleValuesFrom(T[] t, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified array.default int[]
singleValuesIn(Object... objects)
Builds and returns a 1-dimensional array of integers from the specified sequence of parameters.default int
sumOf(int[] t)
Returns the sum of the integers in the specified array.default int
sumOf(Range r)
Returns the sum of the integers in the specified range.default int[][]
transpose(int[]... m)
Returns the transpose of the specified 2-dimensional array.default int[]
vals(Object... objects)
Builds and returns a 1-dimensional array of integers from the specified sequence of parameters.default int[]
valuesFrom(char[] t, java.util.function.Function<Character,Object> f)
default int[]
valuesFrom(int[] t, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified array.default <T> int[]
valuesFrom(Collection<T> c, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified collection.default int[]
valuesFrom(java.util.stream.IntStream stream, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified stream.default <T> int[]
valuesFrom(java.util.stream.Stream<T> stream, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified stream.default int[]
valuesFrom(Range.Rangesx2 r2, java.util.function.BiFunction<Integer,Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified double range.default int[]
valuesFrom(Range r, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified range.default <T> int[]
valuesFrom(T[] t, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified array.default int[]
valuesIn(Object object, Object... otherObjects)
Builds and returns a 1-dimensional array of integers from the specified sequence of parameters.-
Methods inherited from interface org.xcsp.modeler.api.ProblemAPIBase
at, automaton, automaton, automaton, block, condition, condition, condition, condition, control, exceptValue, exceptValues, finalState, finalStates, forall, forall, forall, forall, forall, forall, imp, index, index, indexing, indexing, indexing, indexingTuples, indexingTuples, isModel, modelVariant, modelVariant, name, number, occurBetween, occurExactly, occurExactly, occurrences, occurrences, occursBetween, occursEachBetween, occursEachExactly, onlyOn, readFileLines, readFileLines, startIndex, table, table, table, table, table, table, table, table, tableIntersection, tableWithNewColumn, takingValue, takingValue, takingValues, takingValues, takingValues, transitions, transitions, tuple, weightedBy, weightedBy, weightedBy, weightedBy
-
-
-
-
Method Detail
-
vals
default int[] vals(Object... objects)
Builds and returns a 1-dimensional array of integers from the specified sequence of parameters. Each element of the sequence can be anInteger
, aRange
, an array (of any dimension), a Stream (or IntStream), a collection, etc. All integers are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
objects
- a sequence of objects- Returns:
- a 1-dimensional array formed of collected integers (occurrences of
null
being discarded}
-
valuesIn
default int[] valuesIn(Object object, Object... otherObjects)
Builds and returns a 1-dimensional array of integers from the specified sequence of parameters. Each element of the sequence can be anInteger
, aRange
, an array (of any dimension), a Stream (or IntStream), a collection, etc. All integers are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
object
- an objectotherObjects
- a sequence of objects- Returns:
- a 1-dimensional array formed of collected integers (occurrences of
null
being discarded}
-
valuesFrom
default <T> int[] valuesFrom(java.util.stream.Stream<T> stream, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified stream. Each object of the stream is mapped to another object by the specified function. Then, all integers are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
stream
- a stream of objectsf
- a function mapping objects of the stream into other objects- Returns:
- a 1-dimensional array formed of collected integers (occurrences of
null
being discarded}
-
valuesFrom
default int[] valuesFrom(java.util.stream.IntStream stream, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified stream. Each integer of the stream is mapped to another object by the specified function. Then, all integers are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
stream
- a stream of integersf
- a function mapping integers of the stream into other objects- Returns:
- a 1-dimensional array formed of collected integers (occurrences of
null
being discarded}
-
valuesFrom
default <T> int[] valuesFrom(T[] t, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified array. Each object of the array is mapped to another object by the specified function. Then, all integers are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
t
- a 1-dimensional array of objectsf
- a function mapping objects of the array into other objects- Returns:
- a 1-dimensional array formed of collected integers (occurrences of
null
being discarded}
-
valuesFrom
default <T> int[] valuesFrom(Collection<T> c, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified collection. Each object of the collection is mapped to another object by the specified function. Then, all integers are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
c
- a collection of objectsf
- a function mapping objects of the collection into other objects- Returns:
- a 1-dimensional array formed of collected integers (occurrences of
null
being discarded}
-
valuesFrom
default int[] valuesFrom(int[] t, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified array. Each integer of the array is mapped to another object by the specified function. Then, all integers are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
t
- a 1-dimensional array of integersf
- a function mapping integers of the array into other objects- Returns:
- a 1-dimensional array formed of collected integers (occurrences of
null
being discarded}
-
valuesFrom
default int[] valuesFrom(Range r, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified range. Each integer of the range is mapped to another object by the specified function. Then, all integers are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
r
- a rangef
- a function mapping integers of the range into other objects- Returns:
- a 1-dimensional array formed of collected integers (occurrences of
null
being discarded}
-
valuesFrom
default int[] valuesFrom(Range.Rangesx2 r2, java.util.function.BiFunction<Integer,Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified double range. Each pair of integers of the double range is mapped to another object by the specified function. Then, all integers are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
r2
- a double rangef
- a function mapping pairs of integers of the double range into other objects- Returns:
- a 1-dimensional array formed of collected integers (occurrences of
null
being discarded}
-
singleValuesIn
default int[] singleValuesIn(Object... objects)
Builds and returns a 1-dimensional array of integers from the specified sequence of parameters. Each element of the sequence can be anInteger
, aRange
, an array (of any dimension), a Stream (or IntStream), a collection, etc. All integers are collected, sorted, made distinct and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
objects
- an array (varargs) of objects- Returns:
- a 1-dimensional array formed of distinct sorted collected integers (occurrences of
null
being discarded}
-
singleValuesFrom
default <T> int[] singleValuesFrom(java.util.stream.Stream<T> stream, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified stream. Each object of the stream is mapped to another object by the specified function. Then, all integers are collected, sorted, made distinct and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
stream
- a stream of objectsf
- a function mapping objects of the stream into other objects- Returns:
- a 1-dimensional array formed of distinct sorted collected integers (occurrences of
null
being discarded}
-
singleValuesFrom
default int[] singleValuesFrom(java.util.stream.IntStream stream, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified stream. Each integer of the stream is mapped to another object by the specified function. Then, all integers are collected, sorted, made distinct and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
stream
-f
- a function mapping integers of the stream into other objects- Returns:
- a 1-dimensional array formed of distinct sorted collected integers (occurrences of
null
being discarded}
-
singleValuesFrom
default <T> int[] singleValuesFrom(T[] t, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified array. Each object of the stream is mapped to another object by the specified function. Then, all integers are collected, sorted, made distinct and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
t
- a 1-dimensional array of objectsf
- a function mapping objects of the array into other objects- Returns:
- a 1-dimensional array formed of distinct sorted collected integers (occurrences of
null
being discarded}
-
singleValuesFrom
default <T> int[] singleValuesFrom(Collection<T> c, java.util.function.Function<T,Object> f)
Builds and returns a 1-dimensional array of integers from the specified collection. Each object of the collection is mapped to another object by the specified function. Then, all integers are collected, sorted, made distinct and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
c
- a collection of objectsf
- a function mapping objects of the collection into other objects- Returns:
- a 1-dimensional array formed of distinct sorted collected integers (occurrences of
null
being discarded}
-
singleValuesFrom
default int[] singleValuesFrom(int[] t, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified array. Each integer of the array is mapped to another object by the specified function. Then, all integers are collected, sorted, made distinct and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
t
- a 1-dimensional array of integersf
- a function mapping integers of the array into other objects- Returns:
- a 1-dimensional array formed of distinct sorted collected integers (occurrences of
null
being discarded}
-
singleValuesFrom
default int[] singleValuesFrom(Range r, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of integers from the specified range. Each integer of the range is mapped to another object by the specified function. Then, all integers are collected, sorted, made distinct and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
r
- a rangef
- a function mapping integers of the range into other objects- Returns:
- a 1-dimensional array formed of distinct sorted collected integers (occurrences of
null
being discarded}
-
select
default int[] select(int[] t, int fromIndex, int toIndex)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an indexi
going from thefromIndex
argument (inclusive) to thetoIndex
argument (exclusive).- Parameters:
t
- a 1-dimensional array of integersfromIndex
- the index of the first value (inclusive) to be selectedtoIndex
- the index of the last value (exclusive) to be selected- Returns:
- a 1-dimensional array of integers
-
select
default int[] select(int[] t, int[] indexes)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an indexi
present in theindexes
argument.- Parameters:
t
- a 1-dimensional array of integersindexes
- the indexes of the values to be selected- Returns:
- a 1-dimensional array of integers
-
select
default int[] select(int[] t, FunctionalInterfaces.Intx1Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value that satisfies the specified predicate.- Parameters:
t
- a 1-dimensional array of integersp
- a predicate allowing us to test if a value v in the array must be selected- Returns:
- a 1-dimensional array of integers
-
select
default int[][] select(int[][] m, java.util.function.Predicate<int[]> p)
Builds and returns a 2-dimensional array of integers, obtained by selecting from the specified array any row (tuple) that satisfies the specified predicate.- Parameters:
m
- a 2-dimensional array of integersp
- a predicate allowing us to test if a row (tuple) in the array must be selected- Returns:
- a 2-dimensional array of integers
-
select
default int[] select(Range r, FunctionalInterfaces.Intx1Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified range any value that satisfies the specified predicate.- Parameters:
r
- a range of integersp
- a predicate allowing us to test if a value in the range must be selected- Returns:
- a 1-dimensional array of integers
-
selectFromIndexing
default int[] selectFromIndexing(int[] t, FunctionalInterfaces.Intx1Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an indexi
that satisfies the specified predicate.- Parameters:
t
- a 1-dimensional array of integersp
- a predicate allowing us to test if a value at indexi
must be selected- Returns:
- a 1-dimensional array of integers
-
selectFromIndexing
default int[] selectFromIndexing(int[][] m, FunctionalInterfaces.Intx2Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an index(i,j)
that satisfies the specified predicate.- Parameters:
m
- a 2-dimensional array of integersp
- a predicate allowing us to test if a value at index(i,j)
must be selected- Returns:
- a 1-dimensional array of integers
-
selectFromIndexing
default int[] selectFromIndexing(int[][][] c, FunctionalInterfaces.Intx3Predicate p)
Builds and returns a 1-dimensional array of integers, obtained by selecting from the specified array any value at an index(i,j,k)
that satisfies the specified predicate.- Parameters:
c
- a 3-dimensional array of integersp
- a predicate allowing us to test if a value at index(i,j,k)
must be selected- Returns:
- a 1-dimensional array of integers
-
columnOf
default int[] columnOf(int[][] m, int idColumn)
Selects from the specified 2-dimensional array the column at the specified index.- Parameters:
m
- a 2-dimensional array of integersidColumn
- the index of a column- Returns:
- the column from the specified 2-dimensional array, at the specified index
-
repeat
default int[] repeat(int value, int length)
Builds a 1-dimensional array of in by putting/repeating in itlength
occurrences ofvalue
.- Parameters:
value
- the value to be repeatedlength
- the number of times the value must be repeated- Returns:
- a 1-dimensional array of the specified length only containing the specified value
-
dub
default int[][] dub(int[] values)
Returns a 2-dimensional array obtained from the specified 1-dimensional array after replacing each value with an array of length 1 only containing this value. For example, dubbing[2,3,1]
yields[[2],[3],[1]]
.- Parameters:
values
- a 1 dimensional array of integers- Returns:
- a 2-dimensional array of integers by replacing each value of the specified array into an array simply containing this value
-
dub
default String[][] dub(String[] values)
Returns a 2-dimensional array obtained from the specified 1-dimensional array after replacing each value with an array of length 1 only containing this value. For example, dubbing["red","green","blue"]
yields[["red"],["green"],["blue"]]
.- Parameters:
values
- a 1 -dimensional n array of strings- Returns:
- a 2-dimensional array of strings by replacing each value of the specified array into an array simply containing this value
-
transpose
default int[][] transpose(int[]... m)
Returns the transpose of the specified 2-dimensional array.- Parameters:
m
- a 2-dimensional array of integers- Returns:
- the transpose of the specified 2-dimensional array
-
distinctSorted
@Deprecated default int[] distinctSorted(int... t)
Deprecated.
-
distinctSorted
@Deprecated default int[] distinctSorted(int[][] m)
Deprecated.
-
allCartesian
default int[][] allCartesian(int[] nValues)
Builds an array containing all tuples from the Cartesian product defined from the specified numbers of values. Each tuple will contain a value at positioni
in the range 0 tonValues[i].length-1
.- Parameters:
nValues
- indicates how many values are possible at each position- Returns:
- an array containing all tuples from the Cartesian product defined from the specified number of values
-
allCartesian
default int[][] allCartesian(int[] nValues, java.util.function.Predicate<int[]> p)
Builds an array containing the tuples from the Cartesian product (defined from the specified numbers of values) that respect the specified predicate. Each tuple will contain a value at positioni
in the range 0 tonValues[i].length-1
.- Parameters:
nValues
- indicates how many values are possible at each positionp
- a predicate used to select tuples- Returns:
- an array containing the tuples from the Cartesian product (defined from the specified number of values) that respect the specified predicate
-
allCartesian
default int[][] allCartesian(int nValues, int tupleLength)
Builds an array containing all tuples from the Cartesian product defined from the specified number of values. Each tuple has the specified length, and all values are taken in the range 0 tonValues-1
.- Parameters:
nValues
- the number of values used to form tuplestupleLength
- the length of each tuple- Returns:
- an array containing all tuples from the Cartesian product defined from the specified number of values and length
-
allCartesian
default int[][] allCartesian(int nValues, int tupleLength, java.util.function.Predicate<int[]> p)
Builds an array containing the tuples from the Cartesian product (defined from the specified numbers of values and length) that respect the specified predicate. Each tuple has the specified length, and all values are taken in the range 0 tonValues-1
.- Parameters:
nValues
- the number of values used to form tuplestupleLength
- the length of each tuplep
- a predicate used to select tuples- Returns:
- an array containing the tuples from the Cartesian product (defined from the specified number of values and length) that respect the specified predicate
-
allCombinations
default int[][] allCombinations(int[] nValues)
Builds an array containing all combinations that can be obtained from the specified number of values.- Parameters:
nValues
- the number of possible different values at each position of the tuples. These numbers must be in an increasing order (and are usually all equal)- Returns:
- an array containing all combinations obtained from the specified number of values
-
allCombinations
default int[][] allCombinations(int nValues, int tupleLength)
Builds an array containing all combinations that can be obtained from the specified number of values. Each tuple (combination) has the specified length, and all values are taken in the range 0 tonValues-1
.- Parameters:
nValues
- the number of values used to form combinationstupleLength
- the length of each combination- Returns:
- an array containing all combinations obtained from the specified number of values and length
-
allPermutations
default int[][] allPermutations(int[] nValues)
Builds an array containing all permutations that can be obtained from the specified number of values. Each tuple will contain a value at positioni
in the range 0 tonValues[i].length-1
.- Parameters:
nValues
- the number of values used to form permutations- Returns:
- an array containing all permutations obtained from the specified number of values
-
allPermutations
default int[][] allPermutations(int nValues)
Builds an array containing all permutations that can be obtained from the specified number of values. All values are taken in the range 0 tonValues-1
.- Parameters:
nValues
- the number of values used to form permutations- Returns:
- an array containing all permutations that can be obtained from the specified number of values
-
addInt
default int[] addInt(int[] t, int value, int index)
Inserts the specified value in the specified array at the specified index. The new array is returned.- Parameters:
t
- a 1-dimensional array of integersvalue
- an integer to be insertedindex
- the index at which the value must be inserted- Returns:
- an array obtained after the insertion of the specified value in the specified array at the specified index
-
addInt
default int[] addInt(int[] t, int value)
Appends the specified value to the specified array. The new array is returned.- Parameters:
t
- a 1-dimensional array of integersvalue
- an integer to be inserted- Returns:
- an array obtained after appending the specified value to the specified array
-
contains
default boolean contains(int[] t, int v)
Returnstrue
iff the specified value is contained in the specified array- Parameters:
t
- a 1-dimensional array of integersv
- an integer- Returns:
true
iff the specified value is contained in the specified array
-
sumOf
default int sumOf(int[] t)
Returns the sum of the integers in the specified array.- Parameters:
t
- a 1-dimensional array of integers- Returns:
- the sum of the integers in the specified array
-
sumOf
default int sumOf(Range r)
Returns the sum of the integers in the specified range.- Parameters:
r
- a range- Returns:
- the sum of the integers in the specified range
-
minOf
default int minOf(int[] t)
Returns the minimum value in the specified array.- Parameters:
t
- a 1-dimensional array of integers- Returns:
- the minimum value in the specified array
-
maxOf
default int maxOf(int[] t)
Returns the maximum value in the specified array.- Parameters:
t
- a 1-dimensional array of integers- Returns:
- the maximum value in the specified array
-
firstFrom
default int firstFrom(Range r, FunctionalInterfaces.Intx1Predicate p)
Returns the first value in the specified range that satisfies the specified predicate.- Parameters:
r
- a rangep
- a predicate on integers- Returns:
- the first value in the specified range that satisfies the specified predicate
-
firstFrom
default int firstFrom(Range r, FunctionalInterfaces.Intx1Predicate p, int defaultValue)
Returns the first value in the specified range that satisfies the specified predicate, if one is found. Otherwise the specified default value is returned.- Parameters:
r
- a rangep
- a predicate on integersdefaultValue
- an integer- Returns:
- the first value in the specified range that satisfies the specified predicate, if any, or the specified default value otherwise
-
-