org.imemex.operators
Class AbstractPushOperator<E>

java.lang.Object
  extended by java.util.Observable
      extended by org.imemex.operators.AbstractPushOperator<E>
Type Parameters:
E -
All Implemented Interfaces:
Operator, PushOperator<E>
Direct Known Subclasses:
OIDPushMapper, PluginIdentifiableRVIdentifiableRVPushMapper

public class AbstractPushOperator<E>
extends java.util.Observable
implements PushOperator<E>

An abstract implementation of PushOperator based on the pull paradigm.

Author:
?

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.imemex.operators.Operator
Operator.ExecTimeType
 
Constructor Summary
AbstractPushOperator()
           
 
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.
 OperatorMetaData getMetaData()
          Get additional information about this operator.
 long getNumberOfElementsPassed()
          Get the number of results produced so far.
 void open()
          Does nothing.
 void pass(E object)
          Passes the next to this push operator instance.
 void setDesc(java.lang.String description)
          Set description.
 java.lang.String toXML()
          Get an XML representation of this pull operator.
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractPushOperator

public AbstractPushOperator()
Method Detail

open

public void open()
Does nothing.

Specified by:
open in interface Operator

pass

public void pass(E object)
Description copied from interface: PushOperator
Passes the next to this push operator instance. "Passing" of objects occurs in many places of the Java standrad library. Unfortunately, that passing is scattered to many different implementations. Examples of existing functionality that has the same semantics: 1. any kind of insert(Object object) method 2. any kind of notify(Object object) method 3. any kind of add(Object object) method 4. any kind of append(Object object) method 5. any kind of send(Object object) method - ... 6. any kind of write(Object object) method - ... Abstracting the common functionality into a common interface helps to model software in many places. The pass method is the inverse to the next() method of java.util.Iterator. The difference is that with java.util.Iterator the data is PULLED. In contrast using the PushIterator interface the data is PUSHED.

Specified by:
pass in interface PushOperator<E>
Parameters:
object - the object to pass

close

public void close()
Does nothing.

Specified by:
close in interface Operator

getMetaData

public OperatorMetaData getMetaData()
Description copied from interface: Operator
Get additional information about this operator.

Specified by:
getMetaData in interface Operator
Returns:
meta data

toXML

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

Specified by:
toXML in interface Operator

getDesc

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

Specified by:
getDesc in interface Operator

setDesc

public 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