Class ConsecutiveSetTree<Value_,Point_ extends Comparable<Point_>,Difference_ extends Comparable<Difference_>>
java.lang.Object
ai.timefold.solver.core.impl.score.stream.collector.consecutive.ConsecutiveSetTree<Value_,Point_,Difference_>
- Type Parameters:
Value_- The type of value stored (examples: shifts)Point_- The type of the point (examples: int, LocalDateTime)Difference_- The type of the difference (examples: int, Duration)
- All Implemented Interfaces:
SequenceChain<Value_,Difference_>
public final class ConsecutiveSetTree<Value_,Point_ extends Comparable<Point_>,Difference_ extends Comparable<Difference_>>
extends Object
implements SequenceChain<Value_,Difference_>
A
ConsecutiveSetTree determines what values are consecutive.
A sequence x1, x2, x3, ..., xn
is understood to be consecutive by d iff
x2 − x1 ≤ d, x3 − x2 ≤ d, ..., xn −
xn-1 ≤ d.
This data structure can be thought as an interval tree that maps the point p to the interval [p, p + d].-
Constructor Summary
ConstructorsConstructorDescriptionConsecutiveSetTree(BiFunction<Point_, Point_, Difference_> differenceFunction, BinaryOperator<Difference_> sumFunction, Difference_ maxDifference, Difference_ zeroDifference) -
Method Summary
Modifier and TypeMethodDescriptionboolean@NonNull Collection<Break<Value_,Difference_>> @NonNull Collection<Sequence<Value_,Difference_>> @Nullable Break<Value_,Difference_> Returns the first break between two consecutive sequences of values.@Nullable Sequence<Value_,Difference_> Returns the first sequence of consecutive values.@Nullable Break<Value_,Difference_> Returns the last break between two consecutive sequences of values.@Nullable Sequence<Value_,Difference_> Returns the last sequence of consecutive values.booleantoString()
-
Constructor Details
-
ConsecutiveSetTree
public ConsecutiveSetTree(BiFunction<Point_, Point_, Difference_> differenceFunction, BinaryOperator<Difference_> sumFunction, Difference_ maxDifference, Difference_ zeroDifference)
-
-
Method Details
-
getConsecutiveSequences
- Specified by:
getConsecutiveSequencesin interfaceSequenceChain<Value_,Point_ extends Comparable<Point_>> - Returns:
- the sequences contained in the collection in ascending order.
-
getBreaks
- Specified by:
getBreaksin interfaceSequenceChain<Value_,Point_ extends Comparable<Point_>> - Returns:
- the breaks contained in the collection in ascending order.
-
getFirstSequence
Description copied from interface:SequenceChainReturns the first sequence of consecutive values.- Specified by:
getFirstSequencein interfaceSequenceChain<Value_,Point_ extends Comparable<Point_>> - Returns:
- null if there are no sequences
-
getLastSequence
Description copied from interface:SequenceChainReturns the last sequence of consecutive values.- Specified by:
getLastSequencein interfaceSequenceChain<Value_,Point_ extends Comparable<Point_>> - Returns:
- null if there are no sequences
-
getFirstBreak
Description copied from interface:SequenceChainReturns the first break between two consecutive sequences of values.- Specified by:
getFirstBreakin interfaceSequenceChain<Value_,Point_ extends Comparable<Point_>> - Returns:
- null if there are less than two sequences
-
getLastBreak
Description copied from interface:SequenceChainReturns the last break between two consecutive sequences of values.- Specified by:
getLastBreakin interfaceSequenceChain<Value_,Point_ extends Comparable<Point_>> - Returns:
- null if there are less than two sequences
-
add
-
remove
-
toString
-