java.lang.Object
org.refcodes.controlflow.Scope
- All Implemented Interfaces:
Coupler
,org.refcodes.mixin.IndexAccessor
,org.refcodes.mixin.LengthAccessor
,org.refcodes.mixin.OffsetAccessor
,org.refcodes.mixin.ValidAccessor
public class Scope
extends Object
implements Coupler, org.refcodes.mixin.OffsetAccessor, org.refcodes.mixin.LengthAccessor, org.refcodes.mixin.IndexAccessor
A
Scope
implements the Coupler
interface by determining the
validity of an element in the chain by an index relative to a given offset
and a given length. E.g. only elements (found at a given index in the chain
of elements) within the range of the given length at a given offset are ought
to be valid. A length of -1 indicates no length limits at all (e.g. a length
of ∞).-
Nested Class Summary
Nested classes/interfaces inherited from interface org.refcodes.controlflow.Coupler
Coupler.Operation<SUBJECT,
PARAM extends Coupler, RET> Nested classes/interfaces inherited from interface org.refcodes.mixin.IndexAccessor
org.refcodes.mixin.IndexAccessor.IndexBuilder<B extends org.refcodes.mixin.IndexAccessor.IndexBuilder<B>>, org.refcodes.mixin.IndexAccessor.IndexMutator, org.refcodes.mixin.IndexAccessor.IndexProperty
Nested classes/interfaces inherited from interface org.refcodes.mixin.LengthAccessor
org.refcodes.mixin.LengthAccessor.LengthBuilder<B extends org.refcodes.mixin.LengthAccessor.LengthBuilder<B>>, org.refcodes.mixin.LengthAccessor.LengthMutator, org.refcodes.mixin.LengthAccessor.LengthProperty
Nested classes/interfaces inherited from interface org.refcodes.mixin.OffsetAccessor
org.refcodes.mixin.OffsetAccessor.OffsetBuilder<B extends org.refcodes.mixin.OffsetAccessor.OffsetBuilder<B>>, org.refcodes.mixin.OffsetAccessor.OffsetMutator, org.refcodes.mixin.OffsetAccessor.OffsetProperty
Nested classes/interfaces inherited from interface org.refcodes.mixin.ValidAccessor
org.refcodes.mixin.ValidAccessor.ValidBuilder<B extends org.refcodes.mixin.ValidAccessor.ValidBuilder<B>>, org.refcodes.mixin.ValidAccessor.ValidMutator, org.refcodes.mixin.ValidAccessor.ValidProperty
-
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.refcodes.controlflow.Coupler
invokeNext, invokeNext, invokeNextOr, invokeNextOr
-
Constructor Details
-
Scope
public Scope(int aOffset, int aLength) Creates aScope
for the given offset and with the given length.- Parameters:
aOffset
- The offset for this scope.aLength
- The length of this scope.
-
Scope
public Scope(int aOffset) Creates aScope
with the given offset without any length limitation.- Parameters:
aOffset
- The offset for this scope.
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
isValid
public boolean isValid()To be used by an element's method being invoked with aCoupler
instance as argument belonging to a chain of elements. Returns true in case theCoupler
is in a valid state for the operation to be executed. In caseCoupler.isValid()
returns false, then the operation should skip execution and pass the succeedingCoupler
as ofCoupler.next()
to its successor element in the chain. -
getIndex
public long getIndex()- Specified by:
getIndex
in interfaceorg.refcodes.mixin.IndexAccessor
-
getLength
public int getLength()- Specified by:
getLength
in interfaceorg.refcodes.mixin.LengthAccessor
-
getOffset
public int getOffset()- Specified by:
getOffset
in interfaceorg.refcodes.mixin.OffsetAccessor
-
toString
-