E - The implementing type e.g., Rational or Length (recursive type)S - The step type e.g., RationalU - The unit type of the step e.g., Void or LengthUnitpublic interface Sequential<E extends Sequential<E,S,U>,S,U>
extends java.lang.Comparable<E>
Sequential if the set of possible instances of your type are a sequence, whereby given an
arbitrary instance of the type and some step or increment value, the next instance can be computed.| Modifier and Type | Method and Description |
|---|---|
E |
nextInSequence(S step,
U unit)
Given a
step and unit produces the next instance in the sequence. |
E |
nextNthInSequence(S step,
U unit,
int index)
Given a
step, unit, and index produce the next instance in the sequence. |
E |
previousInSequence(S step,
U unit)
Given a
step and unit produces the previous instance in the sequence. |
E |
previousNthInSequence(S step,
U unit,
int index)
Given a
step, unit, and index produce the previous instance in the sequence. |
E nextInSequence(S step, U unit)
step and unit produces the next instance in the sequence. For instance, given a Length
value of 1 meter, a step value of 5, and a unit of Centimeter, the next value in the
sequence is 1.05 meters.step - A value indicating the number of units separating this instance from the next one in the sequence.unit - Specifies the unit of the step for instance inch or month. Note if the unit
type is Void, the unit value is insignificant and will have a null value.step units from this instance.E nextNthInSequence(S step, U unit, int index)
step, unit, and index produce the next instance in the sequence. For instance,
given a Length value of 1 meter, a step value of 5, a unit of Centimeter, and an index of
2, the next value in the sequence is 1.10 meters.step - A value indicating the number of units separating this instance from the next one in the sequence.unit - Specifies the unit of the step for instance inch or month. Note if the unit
type is Void, the unit value is insignificant and will have a null value.index - A offset in terms of step and unit, typically 1.index * step * unit from this instance.E previousInSequence(S step, U unit)
step and unit produces the previous instance in the sequence. For instance, given a Length
value of 1 meter, a step value of 5, and a unit of Centimeter, the previous value in the
sequence is 0.95 meters.step - A value indicating the number of units separating this instance from the previous one in the sequence.unit - Specifies the unit of the step for instance inch or month. Note if the unit
type is Void, the unit value is insignificant and will have a null value.step units from this instance.E previousNthInSequence(S step, U unit, int index)
step, unit, and index produce the previous instance in the sequence. For instance,
given a Length value of 1 meter, a step value of 5, a unit of Centimeter, and an index of
2, the previous value in the sequence is 0.90 meters.step - A value indicating the number of units separating this instance from the previous one in the sequence.unit - Specifies the unit of the step for instance inch or month. Note if the unit
type is Void, the unit value is insignificant and will have a null value.index - A offset in terms of step and unit, typically 1.index * step * unit from this instance.Copyright © 2022. All rights reserved.