public abstract class Operator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected int |
tupleCounter
A counter of already produced tuples -- all subclasses have access
to this counter.
|
Constructor and Description |
---|
Operator()
Default constructor.
|
Operator(java.util.List<Operator> inOps)
Constructs a new operator given the input operators.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
allDone()
Are all the incoming operators done or not?
|
protected void |
cleanup()
Called to clean up any resources held by the operator.
|
Operator |
getInputOperator(int which)
Retrieve the specified input operator.
|
java.util.List<Tuple> |
getMultiNext()
Fetch the next tuple(s) from this operator.
|
Tuple |
getNext()
Wrapper for the multi-output get next method.
|
int |
getNumberOfInputs()
Returns the number of inputs of this operator.
|
Relation |
getOutputRelation()
Returns this operator's output relation.
|
protected java.util.List<Tuple> |
innerGetNext()
Inner method to fetch the next tuple(s) from this operator.
|
protected abstract java.util.List<Tuple> |
innerProcessTuple(Tuple tuple,
int inOp)
The inner tuple processing method -- all operators should implement
this.
|
protected java.lang.String |
prefix(int level)
Create a prefix string for the textual representation.
|
protected java.util.List<Tuple> |
processTuple(Tuple tuple,
int inStream)
Processes a single tuple from an operator, producing multiple
tuples in the output.
|
protected void |
setInputs(java.util.List<Operator> inOps)
Inner method to set the inputs of the operator.
|
protected abstract Relation |
setOutputRelation()
Subclasses should implement this method in order to specify the
output relation of the operator.
|
protected void |
setup()
Some operators might need to perform some initial setting up.
|
java.lang.String |
toString()
Textual representation.
|
java.lang.String |
toString(int level)
Textual representation starting at a given level of the evaluation
plan.
|
protected java.lang.String |
toStringSingle()
Convert only this operator to string and not the ones below.
|
java.lang.Iterable<Tuple> |
tuples()
Returns an iterable over the tuples returned by this operator.
|
protected int tupleCounter
public Operator() throws EngineException
EngineException
- thrown whenever the operator cannot be
initialised.public Operator(java.util.List<Operator> inOps) throws EngineException
inOps
- the list of input operators.EngineException
- thrown whenever the operator cannot be
initialised.public int getNumberOfInputs()
protected final void setInputs(java.util.List<Operator> inOps)
inOps
- the input operators.public Operator getInputOperator(int which) throws EngineException
which
- the index of the operator that should be retrievedEngineException
public Relation getOutputRelation() throws EngineException
EngineException
protected void setup() throws EngineException
EngineException
- thrown whenever there is something wrong
during setup.public Tuple getNext() throws EngineException
EngineException
- whenever the next tuple cannot be
retrieved.public java.util.List<Tuple> getMultiNext() throws EngineException
EngineException
- thrown whenever there is something
wrong with retrieving tuples from this operator.protected void cleanup() throws EngineException
EngineException
- thrown whenever there is something wrong
during cleanup.protected java.util.List<Tuple> innerGetNext() throws EngineException
EngineException
- thrown whenever there is something
wrong with retrieving tuples from this operator.protected java.util.List<Tuple> processTuple(Tuple tuple, int inStream) throws EngineException
tuple
- the tuple to be processed.inStream
- the index of the input operator this tuple
belongs to.EngineException
- whenever there is an error while
processing the tuple.protected boolean allDone()
true
if all incoming operators are done,
false
otherwise.protected abstract java.util.List<Tuple> innerProcessTuple(Tuple tuple, int inOp) throws EngineException
tuple
- the tuple to be processed.inOp
- the index of the input operator the tuple to be
processed belongs to.EngineException
- thrown whenever there is something wrong
with processing the tuple.protected abstract Relation setOutputRelation() throws EngineException
EngineException
- whenever an output relation cannot be
constructed.public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.String toStringSingle()
public java.lang.String toString(int level)
level
- the level of the operator.protected java.lang.String prefix(int level)
level
- the level in the tree.public java.lang.Iterable<Tuple> tuples() throws EngineException
EngineException
- if the iterable cannot be constructed.