Interface Break<Value_,Difference_ extends Comparable<Difference_>>
-
- Type Parameters:
Value_- The type of value in the sequenceDifference_- The type of difference between values in the sequence
public interface Break<Value_,Difference_ extends Comparable<Difference_>>A Break is a gap between two consecutive values. For instance, the list [1,2,4,5,6,10] has a break of length 2 between 2 and 4, as well as a break of length 4 between 6 and 10.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Difference_getLength()Return the length of the break, which is the difference betweengetNextSequenceStart()andgetPreviousSequenceEnd().Sequence<Value_,Difference_>getNextSequence()default Value_getNextSequenceStart()Return the start of the sequence after this break.Sequence<Value_,Difference_>getPreviousSequence()default Value_getPreviousSequenceEnd()Return the end of the sequence before this break.default booleanisFirst()default booleanisLast()
-
-
-
Method Detail
-
getPreviousSequence
Sequence<Value_,Difference_> getPreviousSequence()
- Returns:
- never null, the sequence leading directly into this
-
getNextSequence
Sequence<Value_,Difference_> getNextSequence()
- Returns:
- never null, the sequence immediately following this
-
isFirst
default boolean isFirst()
- Returns:
- true if and only if this is the first break
-
isLast
default boolean isLast()
- Returns:
- true if and only if this is the last break
-
getPreviousSequenceEnd
default Value_ getPreviousSequenceEnd()
Return the end of the sequence before this break. For the break between 6 and 10, this will return 6.- Returns:
- never null, the item this break is directly after
-
getNextSequenceStart
default Value_ getNextSequenceStart()
Return the start of the sequence after this break. For the break between 6 and 10, this will return 10.- Returns:
- never null, the item this break is directly before
-
getLength
Difference_ getLength()
Return the length of the break, which is the difference betweengetNextSequenceStart()andgetPreviousSequenceEnd(). For the break between 6 and 10, this will return 4.- Returns:
- never null, the length of this break
-
-