|
||||||||||
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()
Default constructor - required by all views to adhere to the Java bean specification. |
|
GroupByView(java.lang.String groupFieldName)
Constructor. |
|
GroupByView(java.lang.String[] groupFieldNames)
Constructor. |
Method Summary | |
---|---|
java.lang.String |
attachesTo(Viewable parentView)
Return null if the view will accept being attached to a particular object. |
EventType |
getEventType()
Provides metadata information about the type of object the event collection contains. |
java.lang.String[] |
getGroupFieldNames()
Returns the field name that provides the key valie by which to group by. |
java.util.Iterator<EventBean> |
iterator()
Allows iteration through all elements in this event collection. |
protected static java.util.List<View> |
makeSubViews(GroupByView groupView,
java.lang.Object[] groupByValues)
Instantiate subviews for the given group view and the given key value to group-by. |
void |
setGroupFieldNames(java.lang.String[] groupFieldNames)
Sets the field name that provides the key valie by which to group by. |
void |
setParent(Viewable parent)
Called when the View is added to a Viewable object. |
java.lang.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, shallowCopyView, updateChildren, updateChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GroupByView()
public GroupByView(java.lang.String groupFieldName)
groupFieldName
- is the field from which to pull the value to group bypublic GroupByView(java.lang.String[] groupFieldNames)
groupFieldNames
- is the fields from which to pull the values to group byMethod Detail |
---|
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 java.lang.String[] getGroupFieldNames()
public final void setGroupFieldNames(java.lang.String[] groupFieldNames)
groupFieldNames
- the the field names providing the group-by key values.public final java.lang.String attachesTo(Viewable parentView)
View
parentView
- is the potential parent for this view
public final EventType getEventType()
EventCollection
public final void update(EventBean[] newData, EventBean[] oldData)
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 java.util.Iterator<EventBean> iterator()
EventCollection
public final java.lang.String toString()
toString
in class java.lang.Object
protected static java.util.List<View> makeSubViews(GroupByView groupView, java.lang.Object[] groupByValues)
groupView
- is the parent view for which to copy subviews forgroupByValues
- is the key values to group-by
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |