net.esper.view
Class ZeroDepthStream

java.lang.Object
  extended by net.esper.view.ZeroDepthStream
All Implemented Interfaces:
java.lang.Iterable<EventBean>, EventCollection, EventStream, OrderedEventCollection, Viewable

public final class ZeroDepthStream
extends java.lang.Object
implements EventStream

Event stream implementation that does not keep any window by itself of the events coming into the stream.


Constructor Summary
ZeroDepthStream(EventType eventType)
          Ctor.
 
Method Summary
 View addView(View view)
          Add a view to the viewable object.
 void doneWith(StreamView view, long index)
          Callback from views to indicate that the stream can remove references to all events up to (and including) a particular index.
 java.lang.Object get(long index)
          Gets the data at an index.
 int getDepth()
          Get the depth of data that can be held in a stream.
 EventType getEventType()
          Provides metadata information about the type of object the event collection contains.
 long getFirstIndex()
          Returns the lower bound of valid index values.
 long getLastIndex()
          Returns the upper bound of valid index values.
 java.lang.String getName()
          Get the name of this stream.
 int getSize()
          Returns the size of the collection.
 java.util.List<View> getViews()
          Returns all added views.
 boolean hasViews()
          Test is there are any views to the Viewable.
 void insert(EventBean event)
          Insert a new event onto the stream.
 java.util.Iterator<EventBean> iterator()
          Allows iteration through all elements in this event collection.
 java.util.Iterator iterator(long startIndex, long endIndex)
          Creates an iterator for a range of ordered data.
 boolean removeView(View view)
          Remove a view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZeroDepthStream

public ZeroDepthStream(EventType eventType)
Ctor.

Parameters:
eventType - - type of event
Method Detail

insert

public final void insert(EventBean event)
Description copied from interface: EventStream
Insert a new event onto the stream.

Specified by:
insert in interface EventStream
Parameters:
event - to insert

get

public final java.lang.Object get(long index)
Description copied from interface: OrderedEventCollection
Gets the data at an index.

Specified by:
get in interface OrderedEventCollection
Parameters:
index - to get data at
Returns:
data at the index

getFirstIndex

public final long getFirstIndex()
Description copied from interface: OrderedEventCollection
Returns the lower bound of valid index values.

Specified by:
getFirstIndex in interface OrderedEventCollection
Returns:
lower bound

getLastIndex

public final long getLastIndex()
Description copied from interface: OrderedEventCollection
Returns the upper bound of valid index values.

Specified by:
getLastIndex in interface OrderedEventCollection
Returns:
upper bound

getSize

public final int getSize()
Description copied from interface: OrderedEventCollection
Returns the size of the collection.

Specified by:
getSize in interface OrderedEventCollection
Returns:
number of elements

iterator

public final java.util.Iterator iterator(long startIndex,
                                         long endIndex)
Description copied from interface: OrderedEventCollection
Creates an iterator for a range of ordered data.

Specified by:
iterator in interface OrderedEventCollection
Parameters:
startIndex - is the lower bound
endIndex - is the upper bound
Returns:
Iterator for range

getEventType

public final EventType getEventType()
Description copied from interface: EventCollection
Provides metadata information about the type of object the event collection contains.

Specified by:
getEventType in interface EventCollection
Returns:
metadata for the objects in the collection

iterator

public final java.util.Iterator<EventBean> iterator()
Description copied from interface: EventCollection
Allows iteration through all elements in this event collection. The iterator will return the elements in the collection in their natural order, or, if there is no natural ordering, in some unpredictable order.

Specified by:
iterator in interface java.lang.Iterable<EventBean>
Specified by:
iterator in interface EventCollection
Returns:
an iterator which will go through all current elements in the collection.

doneWith

public final void doneWith(StreamView view,
                           long index)
Description copied from interface: EventStream
Callback from views to indicate that the stream can remove references to all events up to (and including) a particular index.

Specified by:
doneWith in interface EventStream
Parameters:
view - is the view on the stream indicating which events can be let go.
index - is the index into the stream's data register up to which that view no longer needs.

getDepth

public final int getDepth()
Description copied from interface: EventStream
Get the depth of data that can be held in a stream. When more events than this number are placed onto a stream, it will start to not hold references to the oldest events placed onto it. A stream may get rid of such references even earlier if no view is using them, as well.

Specified by:
getDepth in interface EventStream
Returns:
The maximum number of events the stream will hold in memory.

getName

public final java.lang.String getName()
Description copied from interface: EventStream
Get the name of this stream.

Specified by:
getName in interface EventStream
Returns:
name of stream

addView

public final View addView(View view)
Description copied from interface: Viewable
Add a view to the viewable object.

Specified by:
addView in interface Viewable
Parameters:
view - to add
Returns:
view to add

getViews

public final java.util.List<View> getViews()
Description copied from interface: Viewable
Returns all added views.

Specified by:
getViews in interface Viewable
Returns:
list of added views

removeView

public final boolean removeView(View view)
Description copied from interface: Viewable
Remove a view.

Specified by:
removeView in interface Viewable
Parameters:
view - to remove
Returns:
true to indicate that the view to be removed existed within this view, false if the view to remove could not be found

hasViews

public final boolean hasViews()
Description copied from interface: Viewable
Test is there are any views to the Viewable.

Specified by:
hasViews in interface Viewable
Returns:
true indicating there are child views, false indicating there are no child views