net.esper.core
Class EPStatementImpl

java.lang.Object
  extended by net.esper.core.EPStatementImpl
All Implemented Interfaces:
EPIterable, EPListenable, EPStatement, EPStatementSPI

public class EPStatementImpl
extends Object
implements EPStatementSPI

Statement implementation for EQL statements.


Constructor Summary
EPStatementImpl(String statementId, String statementName, String expressionText, boolean isPattern, DispatchService dispatchService, StatementLifecycleSvc statementLifecycleSvc)
          Ctor.
 
Method Summary
 void addListener(UpdateListener listener)
          Add a listener to the statement.
 void destroy()
          Destroy the statement releasing all statement resources.
 EventType getEventType()
          Returns the type of events the iterable returns.
 Set<UpdateListener> getListeners()
          Returns the set of listeners to the statement.
 String getName()
          Returns the statement name.
 EPStatementState getState()
          Returns the statement's current state.
 String getStatementId()
          Returns the statement id.
 String getText()
          Returns the underlying expression text.
 Iterator<EventBean> iterator()
          Returns an iterator over events.
 void removeAllListeners()
          Remove all listeners to a statement.
 void removeListener(UpdateListener listener)
          Remove a listeners to a statement.
 void setCurrentState(EPStatementState currentState)
          Set statement state.
 void setListeners(Set<UpdateListener> listeners)
          Sets the statement listeners.
 void setParentView(Viewable viewable)
          Sets the parent view.
 void start()
          Start the statement.
 void stop()
          Stop the statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EPStatementImpl

public EPStatementImpl(String statementId,
                       String statementName,
                       String expressionText,
                       boolean isPattern,
                       DispatchService dispatchService,
                       StatementLifecycleSvc statementLifecycleSvc)
Ctor.

Parameters:
statementId - is a unique ID assigned by the engine for the statement
statementName - is the statement name assigned during creation, or the statement id if none was assigned
expressionText - is the EQL and/or pattern expression
isPattern - is true to indicate this is a pure pattern expression
dispatchService - for dispatching events to listeners to the statement
statementLifecycleSvc - handles lifecycle transitions for the statement
Method Detail

getStatementId

public String getStatementId()
Description copied from interface: EPStatementSPI
Returns the statement id.

Specified by:
getStatementId in interface EPStatementSPI
Returns:
statement id

start

public void start()
Description copied from interface: EPStatement
Start the statement.

Specified by:
start in interface EPStatement

stop

public void stop()
Description copied from interface: EPStatement
Stop the statement.

Specified by:
stop in interface EPStatement

destroy

public void destroy()
Description copied from interface: EPStatement
Destroy the statement releasing all statement resources.

A destroyed statement cannot be started again.

Specified by:
destroy in interface EPStatement

getState

public EPStatementState getState()
Description copied from interface: EPStatement
Returns the statement's current state.

Specified by:
getState in interface EPStatement
Returns:
state enum

setCurrentState

public void setCurrentState(EPStatementState currentState)
Description copied from interface: EPStatementSPI
Set statement state.

Specified by:
setCurrentState in interface EPStatementSPI
Parameters:
currentState - new current state

setParentView

public void setParentView(Viewable viewable)
Description copied from interface: EPStatementSPI
Sets the parent view.

Specified by:
setParentView in interface EPStatementSPI
Parameters:
viewable - is the statement viewable

getText

public String getText()
Description copied from interface: EPStatement
Returns the underlying expression text.

Specified by:
getText in interface EPStatement
Returns:
expression text

getName

public String getName()
Description copied from interface: EPStatement
Returns the statement name.

Specified by:
getName in interface EPStatement
Returns:
statement name

iterator

public Iterator<EventBean> iterator()
Description copied from interface: EPIterable
Returns an iterator over events.

Specified by:
iterator in interface EPIterable
Returns:
event iterator

getEventType

public EventType getEventType()
Description copied from interface: EPIterable
Returns the type of events the iterable returns.

Specified by:
getEventType in interface EPIterable
Returns:
event type of events the iterator returns

getListeners

public Set<UpdateListener> getListeners()
Returns the set of listeners to the statement.

Specified by:
getListeners in interface EPStatementSPI
Returns:
statement listeners

setListeners

public void setListeners(Set<UpdateListener> listeners)
Description copied from interface: EPStatementSPI
Sets the statement listeners.

Care must be taken in the use of this method as unsynchronized modification to the listeners of a statement can yield problems.

Specified by:
setListeners in interface EPStatementSPI
Parameters:
listeners - set

addListener

public void addListener(UpdateListener listener)
Add a listener to the statement.

Specified by:
addListener in interface EPListenable
Parameters:
listener - to add

removeListener

public void removeListener(UpdateListener listener)
Remove a listeners to a statement.

Specified by:
removeListener in interface EPListenable
Parameters:
listener - to remove

removeAllListeners

public void removeAllListeners()
Remove all listeners to a statement.

Specified by:
removeAllListeners in interface EPListenable