Package org.xcsp.common
Class Range.Rangesx2
- java.lang.Object
-
- org.xcsp.common.Range.Rangesx2
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
execute(FunctionalInterfaces.Intx2Consumer c2)
Executes the specified consumer on each pair of values contained in this double range.int[][]
map(java.util.function.IntBinaryOperator op)
Returns a 2-dimensional array of integers, obtained after mapping every pair of values from this double range in a value given by the specified binary operator.Range.Rangesx3
range(int length)
Returns a triple range obtained by combining this double range with a range built from the specified length (using implicitly a lower bound equal to 0 and a step equal to 1).Range.Rangesx3
range(int startInclusive, int endExclusive)
Returns a triple range obtained by combining this double range with a range built from the specified bounds (using implicitly a step equal to 1).Range.Rangesx3
range(int startInclusive, int endExclusive, int step)
Returns a triple range obtained by combining this double range with a range built from the specified bounds and step.Range.Rangesx3
rangeClosed(int startInclusive, int endInclusive)
Returns a triple range obtained by combining this double range with a range built from the specified bounds (using implicitly a step equal to 1).Range.Rangesx3
rangeClosed(int startInclusive, int endInclusive, int step)
Returns a triple range obtained by combining this double range with a range built from the specified bounds and step.int[][]
select(FunctionalInterfaces.Intx2Predicate p)
Builds and returns a 2-dimensional array of integers, obtained by selecting from this double range any pair that satisfies the specified predicate.java.util.stream.Stream<int[]>
stream()
Converts this double range into a stream.int[][]
toArray()
Returns a 2-dimensional array containing all pairs of integers in this double range.
-
-
-
Method Detail
-
range
public Range.Rangesx3 range(int startInclusive, int endExclusive, int step)
Returns a triple range obtained by combining this double range with a range built from the specified bounds and step.- Parameters:
startInclusive
- the lower bound (inclusive) of the third range to be builtendExclusive
- the upper bound (exclusive) of the third range to be builtstep
- the step of the third range to be built- Returns:
- a triple range obtained by combining this double range with a range built from the specified bounds and step
-
rangeClosed
public Range.Rangesx3 rangeClosed(int startInclusive, int endInclusive, int step)
Returns a triple range obtained by combining this double range with a range built from the specified bounds and step.- Parameters:
startInclusive
- the lower bound (inclusive) of the third range to be builtendInclusive
- the upper bound (inclusive) of the third range to be builtstep
- the step of the third range to be built- Returns:
- a triple range obtained by combining this double range with a range built from the specified bounds and step
-
range
public Range.Rangesx3 range(int startInclusive, int endExclusive)
Returns a triple range obtained by combining this double range with a range built from the specified bounds (using implicitly a step equal to 1).- Parameters:
startInclusive
- the lower bound (inclusive) of the third range to be builtendExclusive
- the upper bound (exclusive) of the third range to be built- Returns:
- a triple range obtained by combining this double range with a range built from the specified bounds
-
rangeClosed
public Range.Rangesx3 rangeClosed(int startInclusive, int endInclusive)
Returns a triple range obtained by combining this double range with a range built from the specified bounds (using implicitly a step equal to 1).- Parameters:
startInclusive
- the lower bound (inclusive) of the third range to be builtendInclusive
- the upper bound (inclusive) of the third range to be built- Returns:
- a triple range obtained by combining this double range with a range built from the specified bounds
-
range
public Range.Rangesx3 range(int length)
Returns a triple range obtained by combining this double range with a range built from the specified length (using implicitly a lower bound equal to 0 and a step equal to 1).- Parameters:
length
- the length of the third range- Returns:
- a triple range obtained by combining this double range with a range built from the specified length
-
select
public int[][] select(FunctionalInterfaces.Intx2Predicate p)
Builds and returns a 2-dimensional array of integers, obtained by selecting from this double range any pair that satisfies the specified predicate.- Parameters:
p
- a predicate allowing us to test if a pair of values in this double range must be selected- Returns:
- a 2-dimensional array of integers (possibly, of length 0)
-
map
public int[][] map(java.util.function.IntBinaryOperator op)
Returns a 2-dimensional array of integers, obtained after mapping every pair of values from this double range in a value given by the specified binary operator. Ifv1
is the ith value in the first range, andv2
is the jth value in the second range, the valueop(v1,v2)
is put in the 2-dimensional array at index(i,j)
. Do note that the number of rows of the built array is given by the length of the first range and the number of columns is given by the length of the second range.- Parameters:
op
- a binary operator that converts a pair of integers into another integer- Returns:
- a 2-dimensional array of integers
-
execute
public void execute(FunctionalInterfaces.Intx2Consumer c2)
Executes the specified consumer on each pair of values contained in this double range.- Parameters:
c2
- an object consuming pairs of integers.
-
toArray
public int[][] toArray()
Returns a 2-dimensional array containing all pairs of integers in this double range.- Returns:
- a 2-dimensional array containing all pairs of integers in this double range
-
stream
public java.util.stream.Stream<int[]> stream()
Converts this double range into a stream.- Returns:
- the stream corresponding to this double range
-
-