org.imemex.operators
Class AbstractPullOperator<E>

java.lang.Object
  extended by org.imemex.operators.AbstractPullOperator<E>
Type Parameters:
E - type of elements
All Implemented Interfaces:
java.util.Iterator<E>, Operator, PullOperator<E>
Direct Known Subclasses:
AbstractFilterPullOperator, AbstractMapperPullOperator, AddLineageInfoOperator, AntiHashJoinPullOperator, BinaryOIDPullOperator, CachePullOperator, ComponentExtractingPullOperator, ComponentFromMappingListPullOperator, DeepUnnestPullOperator, DistinctOperator, EqualsOperator, EquiJoinOperator, ExternalMemorySorter, ExternalQueue, Filter, GetParentsOperator, IMAPFolderPullOperator, IndexViewFromComponentPullOperator, IndexViewFromOIDPullOperator, IndexViewToRVPullOperator, InMemoryGeneratedOIDOnlyPullOperator, IntersectOperator, KeywordOperator, LeftPreservingUnionPullOperator, LimitOperator, LineageDematerializePullOperator, LineageMaterializePullOperator, LineageSortOperator, ListPullOperator, ListQueue, LuceneScanPullOperator, MainMemorySorter, Merger, MinusPullOperator, MVReading, OIDPullOperator, OIDResourceViewToIndexViewPullOperator, ParallelPullOperator, PhysicalChoosePullOperator, PluginIdentifiableToOIDResourceViewPullOperator, PQTopKOperator, PrefixContentConvertedIdPullOperator, QueueWrapperPullOperator, RandomInteger, RankBoosterOperator, RankingOperator, RegexOperator, ResultSetPullOperator, RVGroupingOperator, ShallowUnnestPullOperator, SingletonPullOperator, SortPullOperator, ThetaJoinOperator, TopKSnapshotOperator, TupleFilter, UnionAllPullOperator, VersionMergeOperator

public abstract class AbstractPullOperator<E>
extends java.lang.Object
implements PullOperator<E>

Abstract implementation of a pull operator which has a single element buffer.

Since the size of the buffer is only one, we can keep track of whether there is a next element in the buffer using a boolean status flag (hasElementInBuffer).

Author:
Lukas Blunschi (blukas@student.ethz.ch)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.imemex.operators.Operator
Operator.ExecTimeType
 
Field Summary
static boolean measureNext
          Set to true to measure timing on calls to next.
 
Constructor Summary
AbstractPullOperator()
           
 
Method Summary
 void addExecTime(long nanos, Operator.ExecTimeType type)
          If an operator implementor wants - and it would if everyone did, he may collect execution times using this method.
 void close()
          Does nothing.
 java.lang.String getDesc()
          Get description.
 long getExecTime(Operator.ExecTimeType type)
          Get collected execution times.
 java.util.List<PullOperator> getInputOperators()
          Get input operators of this operator.
 OperatorMetaData getMetaData()
          Returns the meta data of this operator.
 long getNumberOfElementsPassed()
          Get the number of results produced so far.
 boolean hasNext()
           
 E next()
           
 void open()
          Does nothing.
 E peek()
          Shows the next element without removing it from the iterator
 void remove()
          Throws an UnsupportedOperationException.
 void setDesc(java.lang.String description)
          Set description.
static PullOperator<java.lang.Object> toObjectPullOperator(PullOperator<?> inputOp)
          transforms PullOperator of any type to Object-PullOperator
 java.lang.String toString()
           
 java.lang.String toXML()
          Get an XML representation of this pull operator.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

measureNext

public static boolean measureNext
Set to true to measure timing on calls to next. SHOULD BE FALSE ON DEFAULT.

Constructor Detail

AbstractPullOperator

public AbstractPullOperator()
Method Detail

open

public void open()
Does nothing.

Specified by:
open in interface Operator

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<E>

next

public final E next()
Specified by:
next in interface java.util.Iterator<E>

remove

public void remove()
Throws an UnsupportedOperationException.

Specified by:
remove in interface java.util.Iterator<E>

close

public void close()
Does nothing.

Specified by:
close in interface Operator

peek

public E peek()
Description copied from interface: PullOperator
Shows the next element without removing it from the iterator

Specified by:
peek in interface PullOperator<E>
Returns:

getMetaData

public OperatorMetaData getMetaData()
Returns the meta data of this operator.

Specified by:
getMetaData in interface Operator
Returns:
meta data

toXML

public final java.lang.String toXML()
Description copied from interface: Operator
Get an XML representation of this pull operator.

Specified by:
toXML in interface Operator

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
description of this pull operator. This may span several lines, but if so, the last one should be ended with a newline.

getDesc

public final java.lang.String getDesc()
Description copied from interface: Operator
Get description.

Specified by:
getDesc in interface Operator

setDesc

public final void setDesc(java.lang.String description)
Description copied from interface: Operator
Set description.

Specified by:
setDesc in interface Operator

getNumberOfElementsPassed

public final long getNumberOfElementsPassed()
Description copied from interface: Operator
Get the number of results produced so far.

Specified by:
getNumberOfElementsPassed in interface Operator
Returns:
number of results

addExecTime

public final void addExecTime(long nanos,
                              Operator.ExecTimeType type)
Description copied from interface: Operator
If an operator implementor wants - and it would if everyone did, he may collect execution times using this method.

Specified by:
addExecTime in interface Operator
Parameters:
nanos - number of nanoseconds to add to given time type.
type - type of execution time.

getExecTime

public final long getExecTime(Operator.ExecTimeType type)
Description copied from interface: Operator
Get collected execution times.

Specified by:
getExecTime in interface Operator
Parameters:
type - type of execution time.
Returns:
number of nanoseconds

getInputOperators

public java.util.List<PullOperator> getInputOperators()
Description copied from interface: PullOperator
Get input operators of this operator. This is mainly used to recursively generate an XML representation of an operator tree.

Specified by:
getInputOperators in interface PullOperator<E>
Returns:
list of operators

toObjectPullOperator

public static PullOperator<java.lang.Object> toObjectPullOperator(PullOperator<?> inputOp)
transforms PullOperator of any type to Object-PullOperator

Parameters:
inputOp -
Returns: