T - Type of element being processed.R - Type of processed result.abstract class AbstractPipeProcessor<T,R> extends Object
PipeEnumerator,
AbstractPipeMultiProcessor| Modifier and Type | Field and Description |
|---|---|
boolean |
hasNextNeedsValue
Represents whether the processor needs an input value to participate
to the outcome of
PipeEnumerator.hasNext(). |
boolean |
nextOnSameSourceOnNoValue
Represents whether the pipeline should proceed to the next element
of the same source when
hasOutputValue() returns false. |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPipeProcessor(boolean nextOnSameSourceOnNoValue,
boolean hasNextNeedsValue)
Constructs a new instance of
AbstractPipeProcessor. |
| Modifier and Type | Method and Description |
|---|---|
protected abstract void |
clearOutputValue()
Clears the processed result after being returned by
AbstractPipeProcessor.retrieveOutputValue(). |
boolean |
enqueueFilter(Predicate<R> predicate)
Returns true and aggregates the given
predicate to the
end of existing predicates, otherwise it returns false. |
<U> boolean |
enqueueMap(Function<R,U> mapper)
Returns true and aggregates the given
mapper to the
end of existing mappers, otherwise it returns false. |
AbstractPipeProcessor<? extends R,?> |
getNext()
Returns the value of
AbstractPipeProcessor.next. |
R |
getOutputValue()
Gets the processed result produced by
AbstractPipeProcessor.processInputValue(T) and
clears the internal storage of it. |
PipeSource |
getSource()
Gets the value of
AbstractPipeProcessor.source. |
abstract boolean |
hasOutputValue()
Gets whether processing was successful and the processor has a value
to yield.
|
abstract boolean |
isInactive()
Gets whether the processor does not process any more and the pipeline
up to it should be discarded.
|
abstract void |
processInputValue(T value)
Processes an input value in order to return a result, if any.
|
boolean |
pushFrontFilter(Predicate<R> predicate)
Returns true and aggregates the given
predicate to the
top of the existing predicates, otherwise it returns false. |
<U> boolean |
pushFrontMap(Function<R,U> mapper)
Returns true and aggregates the given
mapper to the
top of the existing mappers, otherwise it returns false. |
protected abstract R |
retrieveOutputValue()
Retrieves the processed result produced by
AbstractPipeProcessor.processInputValue(Object). |
void |
setNext(AbstractPipeProcessor<? extends R,?> next)
Sets the value of
AbstractPipeProcessor.next. |
void |
setSource(PipeSource reference)
Sets the value of
AbstractPipeProcessor.source. |
public final boolean nextOnSameSourceOnNoValue
hasOutputValue() returns false.hasOutputValue(),
hasNextNeedsValuepublic final boolean hasNextNeedsValue
PipeEnumerator.hasNext().protected AbstractPipeProcessor(boolean nextOnSameSourceOnNoValue,
boolean hasNextNeedsValue)
AbstractPipeProcessor.nextOnSameSourceOnNoValue - value for
nextOnSameSourceOnNoValue.hasNextNeedsValue - value for hasNextNeedsValue.public AbstractPipeProcessor<? extends R,?> getNext()
AbstractPipeProcessor.next.next.setNext(enumj.AbstractPipeProcessor)public void setNext(AbstractPipeProcessor<? extends R,?> next)
AbstractPipeProcessor.next.
Once next is set to a non-null value, it may not change.
next - Value for next.UnsupportedOperationException - next is being set twice.getNext()public PipeSource getSource()
AbstractPipeProcessor.source.source.setSource(enumj.PipeSource)public void setSource(PipeSource reference)
AbstractPipeProcessor.source.
Once source is set to a non-null value, it may not change.
reference - Value for source.getSource()public <U> boolean pushFrontMap(Function<R,U> mapper)
mapper to the
top of the existing mappers, otherwise it returns false.
This method returns false by default. The only
AbstractPipeProcessor capable of mapping aggregation is
MapPipeProcessor.
U - type of mapped enumerated elements.mapper - mapping Function.public <U> boolean enqueueMap(Function<R,U> mapper)
mapper to the
end of existing mappers, otherwise it returns false.
This method returns false by default. The only
AbstractPipeProcessor capable of mapping aggregation is
MapPipeProcessor.
U - type of mapped enumerated elements.mapper - mapping Function.public boolean pushFrontFilter(Predicate<R> predicate)
predicate to the
top of the existing predicates, otherwise it returns false.
This method returns false by default. The only
AbstractPipeProcessor capable of predicate aggregation is
FilterPipeProcessor.
predicate - filtering Predicate.public boolean enqueueFilter(Predicate<R> predicate)
predicate to the
end of existing predicates, otherwise it returns false.
This method returns false by default. The only
AbstractPipeProcessor capable of mapping aggregation is
FilterPipeProcessor.
predicate - filtering Predicate.public abstract void processInputValue(T value)
The result of processing must be stored internally.
value - Value to process.hasOutputValue(),
getOutputValue()public abstract boolean hasOutputValue()
If hasOutputValue() returns false than no internal
storage of input or output may take place.
processInputValue(java.lang.Object),
getOutputValue()public final R getOutputValue()
AbstractPipeProcessor.processInputValue(T) and
clears the internal storage of it.processInputValue(Object),
hasOutputValue(),
retrieveOutputValue(),
clearOutputValue()protected abstract R retrieveOutputValue()
AbstractPipeProcessor.processInputValue(Object).getOutputValue(),
clearOutputValue()protected abstract void clearOutputValue()
AbstractPipeProcessor.retrieveOutputValue().getOutputValue(),
retrieveOutputValue()public abstract boolean isInactive()
isInactive() returning true is equivalent to the
situation when no matter with what value
processInputValue(Object) will be called,
hasOutputValue() will always return false.
Most processors have this function return false with the
exception of while and limit compositions. These will
turn completely inactive once a certain condition is met.
true if processing must stop, false otherwise.Copyright © 2016. All rights reserved.