Package ste.lloop
Class AbstractSequence<S extends AbstractSequence<S>>
java.lang.Object
ste.lloop.AbstractSequence<S>
- Type Parameters:
S- the type of the sequence
- Direct Known Subclasses:
ForwardOnlySequence,IndexedSequence,MapSequence
A base class for sequences that can be iterated over with indexes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final NumericSequenceThe numeric series that controls the looping. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
indexes
The numeric series that controls the looping.
-
-
Constructor Details
-
AbstractSequence
public AbstractSequence()Creates a new collection sequence.
-
-
Method Details
-
step
Sets the step of the loop. The sign of the step determines the direction of the loop.If the step is positive, the loop will go from
fromtoto. If the step is negative, the loop will go fromtotofrom.The absolute value of the step is used as the increment. If the step is zero, the loop will not execute.
- Parameters:
step- the step value- Returns:
- this instance
-
from
Sets the starting index of the loop (inclusive).- Parameters:
from- the starting index- Returns:
- this instance
- Throws:
IllegalArgumentException- if 'from' is less than zero
-
to
Sets the ending index of the loop (inclusive).- Parameters:
to- the ending index- Returns:
- this instance
- Throws:
IllegalArgumentException- if 'to' is less than zero
-