|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.esper.view.ViewSupport
net.esper.view.std.GroupByView
public final class GroupByView
The group view splits the data in a stream to multiple subviews, based on a key index. The key is one or more fields in the stream. Any view that follows the GROUP view will be executed separately on each subview, one per unique key. The view takes a single parameter which is the field name returning the key value to group. This view can, for example, be used to calculate the average price per symbol for a list of symbols. The view treats its child views and their child views as prototypes. It dynamically instantiates copies of each child view and their child views, and the child view's child views as so on. When there are no more child views or the special merge view is encountered, it ends. The view installs a special merge view unto each leaf child view that merges the value key that was grouped by back into the stream using the group-by field name.
Field Summary |
---|
Fields inherited from class net.esper.view.ViewSupport |
---|
parent |
Constructor Summary | |
---|---|
GroupByView(StatementContext statementContext,
String[] groupFieldNames)
Constructor. |
Method Summary | |
---|---|
View |
cloneView(StatementContext statementContext)
Duplicates the view. |
EventType |
getEventType()
Provides metadata information about the type of object the event collection contains. |
String[] |
getGroupFieldNames()
Returns the field name that provides the key valie by which to group by. |
Iterator<EventBean> |
iterator()
Allows iteration through all elements in this event collection. |
protected static List<View> |
makeSubViews(GroupByView groupView,
Object[] groupByValues,
StatementContext statementContext)
Instantiate subviews for the given group view and the given key value to group-by. |
void |
setParent(Viewable parent)
Called when the View is added to a Viewable object. |
String |
toString()
|
void |
update(EventBean[] newData,
EventBean[] oldData)
Notify that data has been added or removed from the Viewable parent. |
Methods inherited from class net.esper.view.ViewSupport |
---|
addView, dumpChildViews, dumpUpdateParams, findDescendent, getParent, getViews, hasViews, removeView, updateChildren, updateChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GroupByView(StatementContext statementContext, String[] groupFieldNames)
groupFieldNames
- is the fields from which to pull the values to group bystatementContext
- contains required view servicesMethod Detail |
---|
public View cloneView(StatementContext statementContext)
CloneableView
Expected to return a same view in initialized state for grouping.
cloneView
in interface CloneableView
statementContext
- is services for the view
public void setParent(Viewable parent)
View
setParent
in interface View
setParent
in class ViewSupport
parent
- is the parent that this view is a child ofpublic String[] getGroupFieldNames()
public final EventType getEventType()
EventCollection
getEventType
in interface EventCollection
public final void update(EventBean[] newData, EventBean[] oldData)
View
update
in interface View
newData
- is the new data that has been added to the parent viewoldData
- is the old data that has been removed from the parent viewpublic final Iterator<EventBean> iterator()
EventCollection
iterator
in interface Iterable<EventBean>
iterator
in interface EventCollection
public final String toString()
toString
in class Object
protected static List<View> makeSubViews(GroupByView groupView, Object[] groupByValues, StatementContext statementContext)
groupView
- is the parent view for which to copy subviews forgroupByValues
- is the key values to group-bystatementContext
- is the view services that sub-views may need
|
© 2007 EsperTech Inc. All rights reserved. Visit us at espertech.com |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |