|
||||||||||
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(String[] groupFieldNames)
Constructor. |
Method Summary | |
---|---|
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. |
ViewServiceContext |
getViewServiceContext()
Returns the context instances used by the view. |
Iterator<EventBean> |
iterator()
Allows iteration through all elements in this event collection. |
protected static List<View> |
makeSubViews(GroupByView groupView,
Object[] groupByValues,
ViewServiceContext viewServiceContext)
Instantiate subviews for the given group view and the given key value to group-by. |
void |
setGroupFieldNames(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. |
void |
setViewServiceContext(ViewServiceContext viewServiceContext)
Set the services context containing service handles. |
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(String[] groupFieldNames)
groupFieldNames
- is the fields from which to pull the values to group byMethod Detail |
---|
public ViewServiceContext getViewServiceContext()
ContextAwareView
getViewServiceContext
in interface ContextAwareView
public void setViewServiceContext(ViewServiceContext viewServiceContext)
ContextAwareView
setViewServiceContext
in interface ContextAwareView
viewServiceContext
- with service handlespublic 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 void setGroupFieldNames(String[] groupFieldNames)
groupFieldNames
- the the field names providing the group-by key values.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, ViewServiceContext viewServiceContext)
groupView
- is the parent view for which to copy subviews forgroupByValues
- is the key values to group-byviewServiceContext
- is the view services that sub-views may need
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |