net.esper.view.stat
Class MultiDimStatsView

java.lang.Object
  extended by net.esper.view.ViewSupport
      extended by net.esper.view.stat.MultiDimStatsView
All Implemented Interfaces:
java.lang.Iterable<EventBean>, EventCollection, View, Viewable

public final class MultiDimStatsView
extends ViewSupport

This view compiles OLAP cubes for the specified fields. New data from the parent view is entered into one or more fact cubes (see MultidimCube). Old data from the parent view is removed from a fact cube. The dimensions of the fact cube are specified as parameters to the view. The fact cube can be one-dimensional, two-dimensional (tabular) or 3-dimenstional (tabular with pages). Parameters are: A mandatory array of derived measure names, such as "count", "stddev" etc., (see ViewFieldEnum) A mandatory measure field name. This field supplies the fact values in the cells of the cube. A mandatory column field name. This field supplies the members of dimension zero (column, 1-dim). An optional row field name. This field supplies the members of dimension one (row, 2-dim). An optional page field name. This field supplies the members of dimension two (page, 3-dim). The view post new data to child views that contains a Map with the Cube (see Cube). It does not post old data.


Field Summary
 
Fields inherited from class net.esper.view.ViewSupport
parent
 
Constructor Summary
MultiDimStatsView()
          Empty constructor - views are Java beans.
MultiDimStatsView(java.lang.String[] derivedMeasures, java.lang.String measureField, java.lang.String columnField)
          Constructor.
MultiDimStatsView(java.lang.String[] derivedMeasures, java.lang.String measureField, java.lang.String columnField, java.lang.String rowField)
          Constructor.
MultiDimStatsView(java.lang.String[] derivedMeasures, java.lang.String measureField, java.lang.String columnField, java.lang.String rowField, java.lang.String pageField)
          Constructor.
 
Method Summary
 java.lang.String attachesTo(Viewable parentViewable)
          Return null if the view will accept being attached to a particular object.
 java.lang.String getColumnField()
          Returns the name of the field to extract the column values from.
 java.lang.String[] getDerivedMeasures()
          Returns the names of measures to derive from facts.
 EventType getEventType()
          Provides metadata information about the type of object the event collection contains.
protected  MultidimCube<BaseStatisticsBean> getFactCube()
          For unit testing, returns fact cube.
 java.lang.String getMeasureField()
          Returns the name of the field to extract the measure values from.
 java.lang.String getPageField()
          Returns the name of the field to extract the page values from.
 java.lang.String getRowField()
          Returns the name of the field to extract the row values from.
 java.util.Iterator<EventBean> iterator()
          Allows iteration through all elements in this event collection.
 void setColumnField(java.lang.String columnField)
          Sets the name of the field to extract the column values from.
 void setDerivedMeasures(java.lang.String[] derivedMeasures)
          Sets the names of measures to derive from facts.
 void setMeasureField(java.lang.String measureField)
          Sets the name of the field to extract the measure values from.
 void setPageField(java.lang.String pageField)
          Sets the name of the field to extract the page values from.
 void setParent(Viewable parent)
          Called when the View is added to a Viewable object.
 void setRowField(java.lang.String rowField)
          Sets the name of the field to extract the row values from.
 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, toString, wait, wait, wait
 

Constructor Detail

MultiDimStatsView

public MultiDimStatsView()
Empty constructor - views are Java beans.


MultiDimStatsView

public MultiDimStatsView(java.lang.String[] derivedMeasures,
                         java.lang.String measureField,
                         java.lang.String columnField)
Constructor.

Parameters:
derivedMeasures - is an array of ViewFieldEnum names defining the measures to derive
measureField - defines the field supplying measures
columnField - defines the field supplying column dimension members

MultiDimStatsView

public MultiDimStatsView(java.lang.String[] derivedMeasures,
                         java.lang.String measureField,
                         java.lang.String columnField,
                         java.lang.String rowField)
Constructor.

Parameters:
derivedMeasures - is an array of ViewFieldEnum names defining the measures to derive
measureField - defines the field supplying measures
columnField - defines the field supplying column dimension members
rowField - defines the field supplying row dimension members

MultiDimStatsView

public MultiDimStatsView(java.lang.String[] derivedMeasures,
                         java.lang.String measureField,
                         java.lang.String columnField,
                         java.lang.String rowField,
                         java.lang.String pageField)
Constructor.

Parameters:
derivedMeasures - is an array of ViewFieldEnum names defining the measures to derive
measureField - defines the field supplying measures
columnField - defines the field supplying column dimension members
rowField - defines the field supplying row dimension members
pageField - defines the field supplying page dimension members
Method Detail

getDerivedMeasures

public final java.lang.String[] getDerivedMeasures()
Returns the names of measures to derive from facts.

Returns:
measure names

setDerivedMeasures

public final void setDerivedMeasures(java.lang.String[] derivedMeasures)
Sets the names of measures to derive from facts.

Parameters:
derivedMeasures - measure names

getMeasureField

public final java.lang.String getMeasureField()
Returns the name of the field to extract the measure values from.

Returns:
field for measure values

setMeasureField

public final void setMeasureField(java.lang.String measureField)
Sets the name of the field to extract the measure values from.

Parameters:
measureField - field for measure values

getColumnField

public final java.lang.String getColumnField()
Returns the name of the field to extract the column values from.

Returns:
field for column values

setColumnField

public final void setColumnField(java.lang.String columnField)
Sets the name of the field to extract the column values from.

Parameters:
columnField - field for column values

getRowField

public final java.lang.String getRowField()
Returns the name of the field to extract the row values from.

Returns:
field for row values

setRowField

public final void setRowField(java.lang.String rowField)
Sets the name of the field to extract the row values from.

Parameters:
rowField - field for row values

getPageField

public final java.lang.String getPageField()
Returns the name of the field to extract the page values from.

Returns:
field for page values

setPageField

public final void setPageField(java.lang.String pageField)
Sets the name of the field to extract the page values from.

Parameters:
pageField - field for page values

getFactCube

protected final MultidimCube<BaseStatisticsBean> getFactCube()
For unit testing, returns fact cube.

Returns:
fact cube

attachesTo

public final java.lang.String attachesTo(Viewable parentViewable)
Description copied from interface: View
Return null if the view will accept being attached to a particular object.

Parameters:
parentViewable - is the potential parent for this view
Returns:
null if this view can successfully attach to the parent, an error message if it cannot.

setParent

public final void setParent(Viewable parent)
Description copied from interface: View
Called when the View is added to a Viewable object.

Specified by:
setParent in interface View
Overrides:
setParent in class ViewSupport
Parameters:
parent - is the parent that this view is a child of

update

public final void update(EventBean[] newData,
                         EventBean[] oldData)
Description copied from interface: View
Notify that data has been added or removed from the Viewable parent. The last object in the newData array of objects would be the newest object added to the parent view. The first object of the oldData array of objects would be the oldest object removed from the parent view. If the call to update contains new (inserted) data, then the first argument will be a non-empty list and the second will be empty. Similarly, if the call is a notification of deleted data, then the first argument will be empty and the second will be non-empty. Either the newData or oldData will be non-null. This method won't be called with both arguments being null, but either one could be null. The same is true for zero-length arrays. Either newData or oldData will be non-empty. If both are non-empty, then the update is a modification notification. When update() is called on a view by the parent object, the data in newData will be in the collection of the parent, and its data structures will be arranged to reflect that. The data in oldData will not be in the parent's data structures, and any access to the parent will indicate that that data is no longer there.

Parameters:
newData - is the new data that has been added to the parent view
oldData - is the old data that has been removed from the parent view

getEventType

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

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.

Returns:
an iterator which will go through all current elements in the collection.