public class WeightedAverageView extends ViewSupport implements CloneableView, DerivedValueView
EMPTY_VIEW_ARRAY
Constructor and Description |
---|
WeightedAverageView(AgentInstanceContext agentInstanceContext,
ExprNode fieldNameX,
ExprNode fieldNameWeight,
EventType eventType,
StatViewAdditionalProps additionalProps)
Constructor requires the name of the field to use in the parent view to compute the weighted average on,
as well as the name of the field in the parent view to get the weight from.
|
Modifier and Type | Method and Description |
---|---|
View |
cloneView()
Duplicates the view.
|
static EventType |
createEventType(StatementContext statementContext,
StatViewAdditionalProps additionalProps,
int streamNum)
Creates the event type for this view.
|
double |
getCurrentValue() |
EventType |
getEventType()
Provides metadata information about the type of object the event collection contains.
|
ExprNode |
getFieldNameWeight()
Returns the expression supplying the weight values.
|
ExprNode |
getFieldNameX()
Returns the expression supplying the X values.
|
java.lang.Object[] |
getLastValuesEventNew() |
double |
getSumW() |
double |
getSumXtimesW() |
java.util.Iterator<EventBean> |
iterator()
Allows iteration through all elements in this event collection.
|
void |
setCurrentValue(double currentValue) |
void |
setLastValuesEventNew(java.lang.Object[] lastValuesEventNew) |
void |
setSumW(double sumW) |
void |
setSumXtimesW(double sumXtimesW) |
java.lang.String |
toString() |
void |
update(EventBean[] newData,
EventBean[] oldData)
Notify that data has been added or removed from the Viewable parent.
|
addView, addView, dumpChildViews, dumpUpdateParams, dumpUpdateParams, findDescendent, findViewIndex, getParent, getViews, hasViews, removeAllViews, removeView, removeView, setParent, updateChildren
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addView, getViews, hasViews, removeAllViews, removeView
public WeightedAverageView(AgentInstanceContext agentInstanceContext, ExprNode fieldNameX, ExprNode fieldNameWeight, EventType eventType, StatViewAdditionalProps additionalProps)
fieldNameX
- is the name of the field within the parent view to use to get numeric data points for this view to
compute the average for.fieldNameWeight
- is the field name for the weight to apply to each data pointagentInstanceContext
- contains required view servicespublic View cloneView()
CloneableView
Expected to return a same view in initialized state for grouping.
cloneView
in interface CloneableView
public final ExprNode getFieldNameX()
public final ExprNode getFieldNameWeight()
public void update(EventBean[] newData, EventBean[] oldData)
View
public final EventType getEventType()
EventCollection
getEventType
in interface EventCollection
public 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 EventType createEventType(StatementContext statementContext, StatViewAdditionalProps additionalProps, int streamNum)
statementContext
- is the event adapter servicepublic double getSumXtimesW()
public void setSumXtimesW(double sumXtimesW)
public double getSumW()
public void setSumW(double sumW)
public double getCurrentValue()
public void setCurrentValue(double currentValue)
public java.lang.Object[] getLastValuesEventNew()
public void setLastValuesEventNew(java.lang.Object[] lastValuesEventNew)