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
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 ∞).Coupler.Operation<SUBJECT,PARAM extends Coupler,RET>
org.refcodes.mixin.IndexAccessor.IndexBuilder<B extends org.refcodes.mixin.IndexAccessor.IndexBuilder<B>>, org.refcodes.mixin.IndexAccessor.IndexMutator, org.refcodes.mixin.IndexAccessor.IndexProperty
org.refcodes.mixin.LengthAccessor.LengthBuilder<B extends org.refcodes.mixin.LengthAccessor.LengthBuilder<B>>, org.refcodes.mixin.LengthAccessor.LengthMutator, org.refcodes.mixin.LengthAccessor.LengthProperty
Constructor | Description |
---|---|
Scope(int aOffset) |
Creates a
Scope with the given offset without any length
limitation. |
Scope(int aOffset,
int aLength) |
Creates a
Scope for the given offset and with the given length. |
Modifier and Type | Method | Description |
---|---|---|
long |
getIndex() |
|
int |
getLength() |
|
int |
getOffset() |
|
boolean |
hasNext() |
|
boolean |
isValid() |
To be used by an element's method being invoked with a
Coupler
instance as argument belonging to a chain of elements. |
Coupler |
next() |
Retrieves the succeeding
Coupler . |
String |
toString() |
invokeNext, invokeNext, invokeNextOr, invokeNextOr
public Scope(int aOffset, int aLength)
Scope
for the given offset and with the given length.aOffset
- The offset for this scope.aLength
- The length of this scope.public Scope(int aOffset)
Scope
with the given offset without any length
limitation.aOffset
- The offset for this scope.public boolean hasNext()
public Coupler next()
public boolean isValid()
Coupler
instance as argument belonging to a chain of elements. Returns true in
case the Coupler
is in a valid state for the operation to be
executed. In case Coupler.isValid()
returns false, then the operation
should skip execution and pass the succeeding Coupler
as of
Coupler.next()
to its successor element in the chain.public long getIndex()
getIndex
in interface org.refcodes.mixin.IndexAccessor
public int getLength()
getLength
in interface org.refcodes.mixin.LengthAccessor
public int getOffset()
getOffset
in interface org.refcodes.mixin.OffsetAccessor
Copyright © 2021. All rights reserved.