Class ConsecutiveSetTree<Value_,Point_ extends Comparable<Point_>,Difference_ extends Comparable<Difference_>>
- java.lang.Object
-
- org.optaplanner.examples.common.experimental.impl.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)
public class ConsecutiveSetTree<Value_,Point_ extends Comparable<Point_>,Difference_ extends Comparable<Difference_>> extends Object
A ConsecutiveSetTree determine what value are consecutive. A sequence x1,x2,x3,...,xn is understood to be consecutive by d iff x2 - x1 <= d, x3 -x2 <= d, ..., xn - x(n-1) <= d. This datastructure can be thought as an interval tree that maps the point p to the interval [p, p + d].
-
-
Constructor Summary
Constructors Constructor Description ConsecutiveSetTree(Function<Value_,Point_> indexFunction, BiFunction<Point_,Point_,Difference_> differenceFunction, BiFunction<Difference_,Difference_,Difference_> sumFunction, Difference_ maxDifference, Difference_ zeroDifference)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(Value_ item)protected Difference_getBreakLengthBetween(Value_ from, Value_ to)Iterable<Break<Value_,Difference_>>getBreaks()ConsecutiveInfo<Value_,Difference_>getConsecutiveData()Iterable<Sequence<Value_,Difference_>>getConsecutiveSequences()protected Value_getEndItem(Value_ key)protected NavigableSet<Value_>getItemSet()protected Difference_getSequenceLength(Sequence<Value_,Difference_> sequence)booleanremove(Value_ item)protected voidupdateLengthOfBreak(org.optaplanner.examples.common.experimental.impl.BreakImpl<Value_,Difference_> theBreak)
-
-
-
Constructor Detail
-
ConsecutiveSetTree
public ConsecutiveSetTree(Function<Value_,Point_> indexFunction, BiFunction<Point_,Point_,Difference_> differenceFunction, BiFunction<Difference_,Difference_,Difference_> sumFunction, Difference_ maxDifference, Difference_ zeroDifference)
-
-
Method Detail
-
getConsecutiveSequences
public Iterable<Sequence<Value_,Difference_>> getConsecutiveSequences()
-
getBreaks
public Iterable<Break<Value_,Difference_>> getBreaks()
-
getConsecutiveData
public ConsecutiveInfo<Value_,Difference_> getConsecutiveData()
-
add
public boolean add(Value_ item)
-
remove
public boolean remove(Value_ item)
-
getItemSet
protected NavigableSet<Value_> getItemSet()
-
updateLengthOfBreak
protected void updateLengthOfBreak(org.optaplanner.examples.common.experimental.impl.BreakImpl<Value_,Difference_> theBreak)
-
getSequenceLength
protected Difference_ getSequenceLength(Sequence<Value_,Difference_> sequence)
-
getBreakLengthBetween
protected Difference_ getBreakLengthBetween(Value_ from, Value_ to)
-
-