|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.espertech.esper.view.ViewSupport
com.espertech.esper.view.std.GroupByViewImpl
public class GroupByViewImpl
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 | |
---|---|
protected AgentInstanceViewFactoryChainContext |
agentInstanceContext
|
protected java.lang.String[] |
propertyNames
|
protected java.util.Map<java.lang.Object,java.lang.Object> |
subViewsPerKey
|
static java.lang.String |
VIEWNAME
|
Fields inherited from class com.espertech.esper.view.ViewSupport |
---|
EMPTY_VIEW_ARRAY, parent |
Constructor Summary | |
---|---|
GroupByViewImpl(AgentInstanceViewFactoryChainContext agentInstanceContext,
ExprNode[] criteriaExpressions,
ExprEvaluator[] criteriaEvaluators)
Constructor. |
Method Summary | |
---|---|
protected static java.lang.Object |
addUpgradeToDequeIfPopulated(java.lang.Object holder,
EventBean theEvent)
|
View |
cloneView()
Duplicates the view. |
protected static EventBean[] |
convertToArray(java.lang.Object eventOrDeque)
|
ExprNode[] |
getCriteriaExpressions()
Returns the field name that provides the key valie by which to group by. |
EventType |
getEventType()
Provides metadata information about the type of object the event collection contains. |
java.util.Iterator<EventBean> |
iterator()
Allows iteration through all elements in this event collection. |
static java.lang.Object |
makeSubViews(GroupByView groupView,
java.lang.String[] propertyNames,
java.lang.Object groupByValues,
AgentInstanceViewFactoryChainContext agentInstanceContext)
Instantiate subviews for the given group view and the given key value to group-by. |
boolean |
removeView(View view)
Remove a view. |
java.lang.String |
toString()
|
void |
update(EventBean[] newData,
EventBean[] oldData)
Notify that data has been added or removed from the Viewable parent. |
protected static void |
updateChildViews(java.lang.Object subViews,
EventBean[] newData,
EventBean[] oldData)
|
static void |
visitView(ViewDataVisitorContained viewDataVisitor,
java.lang.Object groupkey,
java.lang.Object subviewHolder)
|
void |
visitViewContainer(ViewDataVisitorContained viewDataVisitor)
|
Methods inherited from class com.espertech.esper.view.ViewSupport |
---|
addView, addView, dumpChildViews, dumpUpdateParams, dumpUpdateParams, findDescendent, findViewIndex, getParent, getViews, hasViews, removeAllViews, removeView, setParent, updateChildren, updateChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.espertech.esper.view.View |
---|
getParent, setParent |
Methods inherited from interface com.espertech.esper.view.Viewable |
---|
addView, getViews, hasViews, removeAllViews |
Field Detail |
---|
public static final java.lang.String VIEWNAME
protected final AgentInstanceViewFactoryChainContext agentInstanceContext
protected java.lang.String[] propertyNames
protected final java.util.Map<java.lang.Object,java.lang.Object> subViewsPerKey
Constructor Detail |
---|
public GroupByViewImpl(AgentInstanceViewFactoryChainContext agentInstanceContext, ExprNode[] criteriaExpressions, ExprEvaluator[] criteriaEvaluators)
criteriaExpressions
- is the fields from which to pull the values to group byagentInstanceContext
- contains required view servicesMethod Detail |
---|
public View cloneView()
CloneableView
Expected to return a same view in initialized state for grouping.
cloneView
in interface CloneableView
public ExprNode[] getCriteriaExpressions()
getCriteriaExpressions
in interface GroupByView
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 java.util.Iterator<EventBean> iterator()
EventCollection
iterator
in interface EventCollection
iterator
in interface java.lang.Iterable<EventBean>
public final java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.Object makeSubViews(GroupByView groupView, java.lang.String[] propertyNames, java.lang.Object groupByValues, AgentInstanceViewFactoryChainContext agentInstanceContext)
groupView
- is the parent view for which to copy subviews forgroupByValues
- is the key values to group-byagentInstanceContext
- is the view services that sub-views may needpropertyNames
- names of expressions or properties
public void visitViewContainer(ViewDataVisitorContained viewDataVisitor)
visitViewContainer
in interface ViewDataVisitableContainer
public static void visitView(ViewDataVisitorContained viewDataVisitor, java.lang.Object groupkey, java.lang.Object subviewHolder)
public boolean removeView(View view)
Viewable
removeView
in interface Viewable
removeView
in class ViewSupport
view
- to remove
protected static void updateChildViews(java.lang.Object subViews, EventBean[] newData, EventBean[] oldData)
protected static java.lang.Object addUpgradeToDequeIfPopulated(java.lang.Object holder, EventBean theEvent)
protected static EventBean[] convertToArray(java.lang.Object eventOrDeque)
|
© 2006-2015 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 |