T
- the type of the elements which this pipe should transfer.public class ReflexivePipe<T> extends AbstractUnsynchedPipe<T>
UnsynchedPipe
, this pipe does not execute its successor stage if an element has
been added. This pipe has only rare application scenarios. Its main purpose is to connect an output port and an input port of the same stage.cachedTargetStage
Constructor and Description |
---|
ReflexivePipe(OutputPort<? extends T> sourcePort,
InputPort<T> targetPort) |
Modifier and Type | Method and Description |
---|---|
void |
add(Object element)
Adds an element to the pipe.
|
boolean |
addNonBlocking(Object element)
Adds an element to the pipe.
|
int |
capacity() |
boolean |
isEmpty()
Checks whether the pipe is empty or not.
|
Object |
removeLast()
Retrieves and removes the last element from the pipe.
|
int |
size() |
close, isClosed, reportNewElement, sendSignal, waitForStartSignal
getCachedTargetStage, getScheduler, getSourcePort, getTargetPort, hasMore, setScheduler, toString
public ReflexivePipe(OutputPort<? extends T> sourcePort, InputPort<T> targetPort)
public void add(Object element)
IPipe
IPipe.addNonBlocking(Object)
).
If it cannot guarantee element delivery in some special situation, it then must throw an exception.element
- to be addedpublic boolean addNonBlocking(Object element)
IPipe
element
- Element which will be addedtrue
if the element could be added, false otherwisepublic boolean isEmpty()
IPipe
true
if the pipe is empty, false otherwise.public int size()
public Object removeLast()
IPipe
null
if the pipe is currently empty.public int capacity()
Copyright © 2015–2020. All rights reserved.