Package org.xcsp.modeler.api
Interface ProblemAPIOnVars
-
- 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 ProblemAPIOnVars 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 Modifier and Type Method Description default <T> T[]
addObject(T[] t, T object)
Appends the specified object to the specified array.default <T> T[]
addObject(T[] t, T object, int index)
Inserts the specified object in the specified array at the specified index.default <T extends IVar>
T[]clean(T[] vars)
Builds and returns a 1-dimensional array of variables from the specified 1-dimensional array of variables, by discardingnull
values.default <T> T[]
columnOf(T[][] vars, int idColumn)
Selects from the specified 2-dimensional array of objects (e.g., variables) the column at the specified index.default boolean
contains(Object[] t, Object object)
Returnstrue
iff the specified object is contained in the specified arraydefault <T> T[]
diagonalDown(T[][] vars)
Selects from the specified 2-dimensional array of objects (e.g., variables) the main downward diagonal.default <T> T[]
diagonalDown(T[][] vars, int idDiagonal)
Selects from the specified 2-dimensional array of objects (e.g., variables) the downward diagonal at the specified index.default <T> T[]
diagonalDown(T[][] vars, int i, int j)
Selects from the specified 2-dimensional array of objects (e.g., variables), which must represent a square of size n*n, the downward diagonal that contains the cell at row i and column j.default <T> T[][]
diagonalsDown(T[][] vars)
Returns a 2-dimensional array of objects (e.g., variables) such that each intern array corresponds to the objects on a (non-unit) downward diagonal of the specified 2-dimensional array of objects (which must represent a square of size n*n).default <T> T[][]
diagonalsUp(T[][] vars)
Returns a 2-dimensional array of objects (e.g., variables) such that each intern array corresponds to the objects on a (non-unit) upward diagonal of the specified 2-dimensional array of objects (which must represent a square of size n*n).default <T> T[]
diagonalUp(T[][] vars)
Selects from the specified 2-dimensional array of objects (e.g., variables) the main upward diagonal.default <T> T[]
diagonalUp(T[][] vars, int idDiagonal)
Selects from the specified 2-dimensional array of objects (e.g., variables) the upward diagonal at the specified index.default <T> T[]
diagonalUp(T[][] vars, int i, int j)
Selects from the specified 2-dimensional array of objects (e.g., variables), which must represent a square, the upward diagonal that contains the cell at row i and column j.default <T> T[][]
eliminateDim2(T[][][] vars, int idx)
Returns a 2-dimensional array of objects (e.g., variables) obtained from the specified 3-dimensional array of objects by eliminating the second dimension after fixing it to theidx
argument.default <T> T[][]
eliminateDim3(T[][][] vars, int idx)
Returns a 2-dimensional array of objects (e.g., variables) obtained from the specified 3-dimensional array of objects by eliminating the third dimension after fixing it to theidx
argument.default <T> T
firstFrom(T[] t, java.util.function.Predicate<T> p)
Returns the first object in the specified array that satisfies the specified predicate, if any, ornull
.default <T> T[]
select(T[][][][][] vars, FunctionalInterfaces.Intx5Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an index(i,j,k,l,m)
that satisfies the specified predicate.default <T> T[]
select(T[][][][][] vars, Range.Rangesx5 rangesx5)
Builds and returns a 1-dimensional array of object (e.g., variables)s, obtained by selecting from the specified array any object, at index(i,j,k,l,m)
, that belongs to the specified quintuple range.default <T> T[]
select(T[][][][] vars, FunctionalInterfaces.Intx4Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an index(i,j,k,l)
that satisfies the specified predicate.default <T> T[]
select(T[][][][] vars, Range.Rangesx4 rangesx4)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object, at index(i,j,k,l)
, that belongs to the specified quadruple range.default <T> T[]
select(T[][][] vars, FunctionalInterfaces.Intx3Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an index(i,j,k)
that satisfies the specified predicate.default <T> T[]
select(T[][][] vars, Range.Rangesx3 rangesx3)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object, at index(i,j,k)
, that belongs to the specified triple range.default <T> T[]
select(T[][] vars, FunctionalInterfaces.Intx2Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an index(i,j)
that satisfies the specified predicate.default <T> T[]
select(T[][] vars, Range.Rangesx2 rangesx2)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object, at index(i,j)
, that belongs to the specified double range.default <T> T[]
select(T[] vars, int[] indexes)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an indexi
present in theindexes
argument.default <T> T[]
select(T[] vars, int fromIndex, int toIndex)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an indexi
going from the specifiedfromIndex
(inclusive) to the specifiedtoIndex
(exclusive).default <T> T[]
select(T[] vars, Collection<Integer> indexes)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an indexi
present in theindexes
argument.default <T> T[]
select(T[] vars, FunctionalInterfaces.Intx1Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an indexi
that satisfies the specified predicate.default <T> T[]
select(T[] vars, Range range)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object, at indexi
, that belongs to the specified range.default <T extends IVar,U>
T[]singleVariablesFrom(Collection<U> c, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified collection.default <T extends IVar,U>
T[]singleVariablesFrom(java.util.stream.Stream<U> stream, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified stream.default <T extends IVar>
T[]singleVariablesIn(Object... objects)
Builds and returns a 1-dimensional array of variables from the specified sequence of parameters.default <T> T[][]
transpose(T[]... vars)
Returns the transpose of the specified 2-dimensional array of objects (e.g., variables).default <T extends IVar>
T[]variablesFrom(int[] t, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of variables from the specified array.default <T extends IVar,U>
T[]variablesFrom(Collection<U> c, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified collection.default <T extends IVar,U>
T[]variablesFrom(java.util.stream.IntStream stream, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of variables from the specified stream.default <T extends IVar,U>
T[]variablesFrom(java.util.stream.Stream<U> stream, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified stream.default <T extends IVar>
T[]variablesFrom(Range r, java.util.function.Function<Integer,Object> f)
Returns a 1-dimensional array of variables, obtained after collecting the variables returned by the specified function when executed on all values in this range.default <T extends IVar,U>
T[]variablesFrom(U[] t, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified array.default <T extends IVar>
T[]variablesIn(Object object, Object... otherObjects)
Builds and returns a 1-dimensional array of variables from the specified sequence of parameters.default <T extends IVar>
T[]vars(Object first, Object... others)
Builds and returns a 1-dimensional array of variables from the specified sequence of parameters.default <T extends IVar>
T[]vars(Object first, T x)
Builds and returns a 1-dimensional array of variables from the specified parameters.default <T extends IVar>
T[]vars(Object first, T[] x)
Builds and returns a 1-dimensional array of variables from the specified parameters.default <T extends IVar>
T[]vars(Object first, T[][] x)
Builds and returns a 1-dimensional array of variables from the specified parameters.default <T extends IVar>
T[]vars(java.util.stream.Stream<T> stream)
Returns a 1-dimensional array of variables by collecting them in order from the specified stream.default <T extends IVar>
T[]vars(T[][] vars)
Builds and returns a 1-dimensional array of variables from the specified array.default <T extends IVar>
T[]vars(T[][][] vars)
Builds and returns a 1-dimensional array of variables from the specified array.default <T extends IVar>
T[]vars(T x, T... others)
Returns a 1-dimensional array containing the specified variables.-
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
-
vars
default <T extends IVar> T[] vars(Object first, Object... others)
Builds and returns a 1-dimensional array of variables from the specified sequence of parameters. All variables encountered in the parameters, extracting them from arrays (of any dimension), collections and streams, are recursively collected in order, and concatenated to form a 1-dimensional array. Note thatnull
values, as well as any simple object not implementingIVar
, are simply discarded.- Parameters:
first
- a first object that may involve one or several variables (possibly in arrays, collections and streams)others
- other objects that may involve one or several variables (possibly in arrays, collections and streams)- Returns:
- a 1-dimensional array of variables
-
vars
default <T extends IVar> T[] vars(T x, T... others)
Returns a 1-dimensional array containing the specified variables.- Parameters:
x
- a first variableothers
- a sequence of other variables- Returns:
- a 1-dimensional array containing the specified variables
-
vars
default <T extends IVar> T[] vars(T[][] vars)
Builds and returns a 1-dimensional array of variables from the specified array. All variables are collected in order, andnull
values are simply discarded.- Parameters:
vars
- a 2-dimensional array of variables- Returns:
- a 1-dimensional array of variables
-
vars
default <T extends IVar> T[] vars(T[][][] vars)
Builds and returns a 1-dimensional array of variables from the specified array. All variables are collected in order, andnull
values are simply discarded.- Parameters:
vars
- a 3-dimensional array of variables- Returns:
- a 1-dimensional array of variables
-
vars
default <T extends IVar> T[] vars(Object first, T x)
Builds and returns a 1-dimensional array of variables from the specified parameters. All variables encountered in the first parameter, extracting them from arrays (of any dimension), collections and streams, are recursively collected in order, and concatenated to form a 1-dimensional array. Note thatnull
values, as well as any simple object not implementingIVar
, are simply discarded.- Parameters:
first
- an object that may involve one or several variables (possibly in arrays, collections and streams)x
- a variable- Returns:
- a 1-dimensional array of variables
-
vars
default <T extends IVar> T[] vars(Object first, T[] x)
Builds and returns a 1-dimensional array of variables from the specified parameters. All variables encountered in the parameters, extracting them from arrays (of any dimension), collections and streams, are recursively collected in order, and concatenated to form a 1-dimensional array. Note thatnull
values, as well as any simple object not implementingIVar
, are simply discarded.- Parameters:
first
- an object that may involve one or several variables (possibly in arrays, collections and streams)x
- a 1-dimensional array of variables- Returns:
- a 1-dimensional array of variables
-
vars
default <T extends IVar> T[] vars(Object first, T[][] x)
Builds and returns a 1-dimensional array of variables from the specified parameters. All variables encountered in the parameters, extracting them from arrays (of any dimension), collections and streams, are recursively collected in order, and concatenated to form a 1-dimensional array. Note thatnull
values, as well as any simple object not implementingIVar
, are simply discarded.- Parameters:
first
- an object that may involve one or several variables (possibly in arrays, collections and streams)x
- a 2-dimensional array of variables- Returns:
- a 1-dimensional array of variables
-
vars
default <T extends IVar> T[] vars(java.util.stream.Stream<T> stream)
Returns a 1-dimensional array of variables by collecting them in order from the specified stream.- Parameters:
stream
- a stream of variables- Returns:
- a 1-dimensional array of variables
-
clean
default <T extends IVar> T[] clean(T[] vars)
Builds and returns a 1-dimensional array of variables from the specified 1-dimensional array of variables, by discardingnull
values.- Parameters:
vars
- a 1-dimensional array of variables- Returns:
- a 1-dimensional array of variables after discarding all occurrences of
null
-
variablesIn
default <T extends IVar> T[] variablesIn(Object object, Object... otherObjects)
Builds and returns a 1-dimensional array of variables from the specified sequence of parameters. All variables encountered in the parameters, extracting them from arrays (of any dimension), collections and streams, are recursively collected in order, and concatenated to form a 1-dimensional array. Note thatnull
values, as well as any simple object not implementingIVar
, are simply discarded.- Parameters:
object
- a first object that may involve one or several variables (possibly in arrays, collections and streams)otherObjects
- other objects that may involve one or several variables (possibly in arrays, collections and streams)- Returns:
- a 1-dimensional array of variables
-
variablesFrom
default <T extends IVar,U> T[] variablesFrom(java.util.stream.Stream<U> stream, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified stream. Each object of the stream is mapped to another object by the specified function. Then, all variables 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 variables (occurrences of
null
being discarded}
-
variablesFrom
default <T extends IVar,U> T[] variablesFrom(java.util.stream.IntStream stream, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of variables from the specified stream. Each integer of the stream is mapped to another object by the specified function. Then, all variables 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 variables (occurrences of
null
being discarded}
-
variablesFrom
default <T extends IVar,U> T[] variablesFrom(U[] t, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified array. Each object of the array is mapped to another object by the specified function. Then, all variables are collected and concatenated to form a 1-dimensional array.null
values are discarded.- Parameters:
t
- an array of objectsf
- a function mapping objects of the array into other objects- Returns:
- a 1-dimensional array formed of collected variables (occurrences of
null
being discarded}
-
variablesFrom
default <T extends IVar,U> T[] variablesFrom(Collection<U> c, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified collection. Each object of the collection is mapped to another object by the specified function. Then, all variables 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 variables (occurrences of
null
being discarded}
-
variablesFrom
default <T extends IVar> T[] variablesFrom(int[] t, java.util.function.Function<Integer,Object> f)
Builds and returns a 1-dimensional array of variables from the specified array. Each integer of the array is mapped to another object by the specified function. Then, all variables 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 variables (occurrences of
null
being discarded}
-
variablesFrom
default <T extends IVar> T[] variablesFrom(Range r, java.util.function.Function<Integer,Object> f)
Returns a 1-dimensional array of variables, obtained after collecting the variables returned by the specified function when executed on all values in this range. Note thatnull
values are simply discarded, if ever generated. Be careful: in case, no variable is obtained,null
is returned.- Parameters:
r
- a range of integersf
- a function to convert integer values into objects (typically, variables, but can also be structures containing variables)- Returns:
- a non-empty 1-dimensional array of variables or
null
-
singleVariablesIn
default <T extends IVar> T[] singleVariablesIn(Object... objects)
Builds and returns a 1-dimensional array of variables from the specified sequence of parameters. All variables encountered in the parameters, extracting them from arrays (of any dimension), collections and streams, are recursively collected in order, sorted, made distinct, so as to form a 1-dimensional array. Note thatnull
values, as well as any simple object not implementingIVar
, are simply discarded.- Parameters:
objects
- a sequence of objects that may involve one or several variables (possibly in arrays, collections and streams)- Returns:
- a 1-dimensional array of variables
-
singleVariablesFrom
default <T extends IVar,U> T[] singleVariablesFrom(java.util.stream.Stream<U> stream, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified stream. Each object of the stream is mapped to another object by the specified function. Then, all variables are collected, sorted and made distinct so as 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 variables (occurrences of
null
being discarded}
-
singleVariablesFrom
default <T extends IVar,U> T[] singleVariablesFrom(Collection<U> c, java.util.function.Function<U,Object> f)
Builds and returns a 1-dimensional array of variables from the specified collection. Each object of the collection is mapped to another object by the specified function. Then, all variables are collected, sorted and made distinct so as to form a 1-dimensional array.null
values are discarded.- Parameters:
c
- a collection of objectsf
- a function mapping objects of the stream into other objects- Returns:
- a 1-dimensional array formed of collected variables (occurrences of
null
being discarded}
-
select
default <T> T[] select(T[] vars, int[] indexes)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an indexi
present in theindexes
argument. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 1-dimensional array of objectsindexes
- the indexes of the objects to be selected- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[] vars, int fromIndex, int toIndex)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an indexi
going from the specifiedfromIndex
(inclusive) to the specifiedtoIndex
(exclusive). Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 1-dimensional array of objectsfromIndex
- the index of the first object (inclusive) to be selectedtoIndex
- the index of the last object (exclusive) to be selected- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[] vars, Collection<Integer> indexes)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an indexi
present in theindexes
argument. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 1-dimensional array of objectsindexes
- the indexes of the objects to be selected- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[] vars, FunctionalInterfaces.Intx1Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an indexi
that satisfies the specified predicate. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 1-dimensional array of objectsp
- a predicate allowing us to test if a object at indexi
must be selected- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[][] vars, FunctionalInterfaces.Intx2Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an index(i,j)
that satisfies the specified predicate. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 2-dimensional array of objectsp
- a predicate allowing us test if a object at index(i,j)
must be selected- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[][][] vars, FunctionalInterfaces.Intx3Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an index(i,j,k)
that satisfies the specified predicate. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 3-dimensional array of objectsp
- a predicate allowing us test if a object at index(i,j,k)
must be selected- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[][][][] vars, FunctionalInterfaces.Intx4Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an index(i,j,k,l)
that satisfies the specified predicate. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 4-dimensional array of objectsp
- a predicate allowing us to test if a object at index(i,j,k,l)
must be selected- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[][][][][] vars, FunctionalInterfaces.Intx5Predicate p)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object at an index(i,j,k,l,m)
that satisfies the specified predicate. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 5-dimensional array of objectsp
- a predicate allowing us to test if a object at index(i,j,k,l,m)
must be selected- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[] vars, Range range)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object, at indexi
, that belongs to the specified range. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 1-dimensional array of objectsrange
- an object representing a range of indexes- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[][] vars, Range.Rangesx2 rangesx2)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object, at index(i,j)
, that belongs to the specified double range. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 2-dimensional array of objectsrangesx2
- an object representing a double range of indexes (seen as a Cartesian product)- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[][][] vars, Range.Rangesx3 rangesx3)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object, at index(i,j,k)
, that belongs to the specified triple range. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 3-dimensional array of objectsrangesx3
- an object representing a triple range of indexes (seen as a Cartesian product)- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[][][][] vars, Range.Rangesx4 rangesx4)
Builds and returns a 1-dimensional array of objects (e.g., variables), obtained by selecting from the specified array any object, at index(i,j,k,l)
, that belongs to the specified quadruple range. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 4-dimensional array of objectsrangesx4
- an object representing a quadruple range of indexes (seen as a Cartesian product)- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
select
default <T> T[] select(T[][][][][] vars, Range.Rangesx5 rangesx5)
Builds and returns a 1-dimensional array of object (e.g., variables)s, obtained by selecting from the specified array any object, at index(i,j,k,l,m)
, that belongs to the specified quintuple range. Note thatnull
values are simply discarded, if ever present.- Parameters:
vars
- a 5-dimensional array of objectsrangesx5
- an object representing a quintuple range of indexes (seen as a Cartesian product)- Returns:
- a 1-dimensional array of objects (possibly, of length 0)
-
columnOf
default <T> T[] columnOf(T[][] vars, int idColumn)
Selects from the specified 2-dimensional array of objects (e.g., variables) the column at the specified index.- Parameters:
vars
- a 2-dimensional array of objectsidColumn
- the index of a column- Returns:
- the column from the specified 2-dimensional array of objects, at the specified index
-
diagonalDown
default <T> T[] diagonalDown(T[][] vars, int idDiagonal)
Selects from the specified 2-dimensional array of objects (e.g., variables) the downward diagonal at the specified index.- Parameters:
vars
- a 2-dimensional array of objectsidDiagonal
- the index of a downward diagonal- Returns:
- the downward diagonal from the specified 2-dimensional array of objects, at the specified index
-
diagonalUp
default <T> T[] diagonalUp(T[][] vars, int idDiagonal)
Selects from the specified 2-dimensional array of objects (e.g., variables) the upward diagonal at the specified index.- Parameters:
vars
- a 2-dimensional array of objectsidDiagonal
- the index of an upward diagonal- Returns:
- the upward diagonal from the specified 2-dimensional array of objects, at the specified index
-
diagonalDown
default <T> T[] diagonalDown(T[][] vars)
Selects from the specified 2-dimensional array of objects (e.g., variables) the main downward diagonal.- Parameters:
vars
- a 2-dimensional array of objects- Returns:
- the main downward diagonal
-
diagonalUp
default <T> T[] diagonalUp(T[][] vars)
Selects from the specified 2-dimensional array of objects (e.g., variables) the main upward diagonal.- Parameters:
vars
- a 2-dimensional array of objects- Returns:
- the main upward diagonal
-
diagonalDown
default <T> T[] diagonalDown(T[][] vars, int i, int j)
Selects from the specified 2-dimensional array of objects (e.g., variables), which must represent a square of size n*n, the downward diagonal that contains the cell at row i and column j. Either i=0 and j is in 0..n-2, or j=0 and i is in 0..n-2.- Parameters:
vars
- a 2-dimensional array of objectsi
- the index of a rowj
- the index of a column- Returns:
- the downward diagonal that includes the cell at row i and column j
-
diagonalsDown
default <T> T[][] diagonalsDown(T[][] vars)
Returns a 2-dimensional array of objects (e.g., variables) such that each intern array corresponds to the objects on a (non-unit) downward diagonal of the specified 2-dimensional array of objects (which must represent a square of size n*n). The length of the (first dimension) of the returned array is2*n -3
.- Parameters:
vars
- a 2-dimensional array of objects- Returns:
- a 2-dimensional array of objects, each intern array corresponding to a (non-unit) downward diagonal.
-
diagonalUp
default <T> T[] diagonalUp(T[][] vars, int i, int j)
Selects from the specified 2-dimensional array of objects (e.g., variables), which must represent a square, the upward diagonal that contains the cell at row i and column j. Either j=0 and i is in 1..n-1, or i=n-1 and j is in 0..n-2.- Parameters:
vars
- a 2-dimensional array of objectsi
- the index of a rowj
- the index of a column- Returns:
- the upward diagonal that includes the cell at row i and column j
-
diagonalsUp
default <T> T[][] diagonalsUp(T[][] vars)
Returns a 2-dimensional array of objects (e.g., variables) such that each intern array corresponds to the objects on a (non-unit) upward diagonal of the specified 2-dimensional array of objects (which must represent a square of size n*n). The length of the (first dimension) of the returned array is2*n -3
.- Parameters:
vars
- a 2-dimensional array of objects- Returns:
- a 2-dimensional array of objects, each intern array corresponding to a (non-unit) upward diagonal.
-
transpose
default <T> T[][] transpose(T[]... vars)
Returns the transpose of the specified 2-dimensional array of objects (e.g., variables).- Parameters:
vars
- a 2-dimensional array of objects- Returns:
- the transpose of the specified 2-dimensional array of objects
-
eliminateDim2
default <T> T[][] eliminateDim2(T[][][] vars, int idx)
Returns a 2-dimensional array of objects (e.g., variables) obtained from the specified 3-dimensional array of objects by eliminating the second dimension after fixing it to theidx
argument. The arrayt
returned by this function is such thatt[i][j]=vars[i][idx][j]
.- Parameters:
vars
- a 3-dimensional array of objectsidx
- the index that is fixed for the second dimension- Returns:
- a 2-dimensional array of objects corresponding to the elimination of the second dimension by fixing it to the specified index
-
eliminateDim3
default <T> T[][] eliminateDim3(T[][][] vars, int idx)
Returns a 2-dimensional array of objects (e.g., variables) obtained from the specified 3-dimensional array of objects by eliminating the third dimension after fixing it to theidx
argument. The arrayt
returned by this function is such thatt[i][j]=vars[i][j][idx]
.- Parameters:
vars
- a 3-dimensional array of objectsidx
- the index that is fixed for the third dimension- Returns:
- a 2-dimensional array of objects corresponding to the elimination of the third dimension by fixing it to the specified index
-
addObject
default <T> T[] addObject(T[] t, T object, int index)
Inserts the specified object in the specified array at the specified index. The new array is returned.- Parameters:
t
- a 1-dimensional arrayobject
- an object to be insertedindex
- the index at which the object must be inserted- Returns:
- an array obtained after the insertion of the specified object in the specified array at the specified index
-
addObject
default <T> T[] addObject(T[] t, T object)
Appends the specified object to the specified array. The new array is returned.- Parameters:
t
- a 1-dimensional arrayobject
- an object to be inserted- Returns:
- an array obtained after appending the specified object to the specified array
-
contains
default boolean contains(Object[] t, Object object)
Returnstrue
iff the specified object is contained in the specified array- Parameters:
t
- a 1-dimensional array of objectsobject
- an object- Returns:
true
iff the specified object is contained in the specified array
-
firstFrom
default <T> T firstFrom(T[] t, java.util.function.Predicate<T> p)
Returns the first object in the specified array that satisfies the specified predicate, if any, ornull
.- Parameters:
t
- a 1-dimensional array of objectsp
- a predicate- Returns:
- the first object in the specified array that satisfies the specified predicate, if any, or
null
-
-