edu.wpi.cs.dsrg.xmldb.xat.component.statisticsgatherer
Class StatisticsObject

java.lang.Object
  |
  +--edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATPropertiesImp
        |
        +--edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATQueryObjectImp
              |
              +--edu.wpi.cs.dsrg.xmldb.xat.component.statisticsgatherer.StatisticsObject
Direct Known Subclasses:
AggregateStatisticsObject, IncrementValueByN, OperatorUtilization

public class StatisticsObject
extends XATQueryObjectImp
implements java.lang.Comparable

Subclasses of this should override the calculateNewValue() and calculateNewValue(String) method. The compareTo(Object) method provides a default comparision (on propertyValue), but should be overwritten if more is desired. The calculateNewValue just copies the value from the operator

Statistics Object that stores a propertyName, propertyValue, and an associated operator. The StatisticsObject stores an operator's value of a property at a certain time. The propertyValue here does not necessarily correspond to the value in the operator because the operator's value is updated continuosly (after each time the operator is run) while this value is updated only when the execution controller decides to do so.

This object implements Comparable so that one StatisticsObject may be compared to another. This allows the StatisticsGatherer to sort these objects based on the given property.

The calculateNewValue is called by the statisticsGatherer. Creation date: (1/10/2003 4:45:18 PM)

See Also:
Serialized Form

Fields inherited from class edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATQueryObjectImp
stats, statsPresent
 
Constructor Summary
StatisticsObject()
          Default Constructor
StatisticsObject(java.lang.String name, XATQueryObject queryObject)
          StatisticsObject constructor comment.
 
Method Summary
 void calculateNewValue()
          Calculates the new Value of the given property of this operator.
 void calculateNewValue(java.lang.String newValue)
          This is semantically the same as calculateNewValue(), but this provides a parameter which assists in the calculation.
 int compareTo(java.lang.Object o)
          It is important that care is taken when implementing this method.
 boolean equals(java.lang.Object otherObject)
          Compare this to another StatsObject.
 XATQueryObject getAssociatedQueryObject()
          Insert the method's description here.
 java.lang.Object getCategory()
          Insert the method's description here.
 java.lang.String getPropertyName()
          Insert the method's description here.
 java.lang.String getPropertyValue()
          Get the value of the property specfied by this.getPropertyName().
 void setAssociatedQueryObject(XATQueryObject newAssociatedQueryObject)
          Insert the method's description here.
 void setCategory(java.lang.Object newCategory)
          Insert the method's description here.
 void setPropertyName(java.lang.String newPropertyName)
          Insert the method's description here.
 void setPropertyValue(java.lang.String newPropertyValue)
          Sets the property value.
 java.lang.String toString()
          Insert the method's description here.
 
Methods inherited from class edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATQueryObjectImp
addStatistic, getStatistics, isValidStatistic, setDefaultProperties, setDefaultStatistics
 
Methods inherited from class edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATPropertiesImp
addProperty, getProperties, getProperty, isValidPropertyName, setNewPropertyValue, setProperty
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StatisticsObject

public StatisticsObject()
Default Constructor

StatisticsObject

public StatisticsObject(java.lang.String name,
                        XATQueryObject queryObject)
StatisticsObject constructor comment.
Method Detail

calculateNewValue

public void calculateNewValue()
Calculates the new Value of the given property of this operator. This should be overwritten by subclasses who can tailor this method to calculating 1 specific property.

This method should update at least the local propertyValue and possibly the value with the operator The entire StatisticsGatherer is available for assistance.

The procedure for calculating new values should be as follows:

  1. Consult the statsTable for any propertyValues that are needed.
  2. Perform the required calculations using the propertyValues from step 1
  3. Update the local propertyValue.
  4. Update the lastTimeUpdated value by using lastTimeUpdated = System.currentTimeMillis();

calculateNewValue

public void calculateNewValue(java.lang.String newValue)
This is semantically the same as calculateNewValue(), but this provides a parameter which assists in the calculation. Calculates the new Value of the given property of this operator. This should be overwritten by subclasses who can tailor this method to calculating 1 specific property.

This method should update at least the local propertyValue and possibly the value with the operator The entire StatisticsGatherer is available for assistance.

The procedure for calculating new values should be as follows:

  1. Consult the statsTable for any propertyValues that are needed.
  2. Perform the required calculations using the propertyValues from step 1
  3. Update the local propertyValue.
  4. Update the lastTimeUpdated value by using lastTimeUpdated = System.currentTimeMillis();

compareTo

public int compareTo(java.lang.Object o)
It is important that care is taken when implementing this method. Implementing it incorrectly will lead to incorrect behavior later when the array is sorted and the ArrayList tries to get values by identifiers.

This particular implementation tries to determine the data type of the propertyValue and then do a standard comparison. Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.

It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class XATQueryObjectImp
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the specified object's type prevents it from being compared to this Object.

equals

public boolean equals(java.lang.Object otherObject)
Compare this to another StatsObject. They are the same if the operator and propertyName are the same.
Overrides:
equals in class java.lang.Object
Parameters:
otherObject - java.lang.Object
Returns:
int

getAssociatedQueryObject

public XATQueryObject getAssociatedQueryObject()
Insert the method's description here. Creation date: (1/14/2003 10:45:41 AM)
Returns:
edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATOperator

getCategory

public java.lang.Object getCategory()
Insert the method's description here. Creation date: (1/17/2003 3:10:07 PM)
Returns:
java.lang.Object

getPropertyName

public java.lang.String getPropertyName()
Insert the method's description here. Creation date: (1/14/2003 10:47:52 AM)
Returns:
java.lang.String

getPropertyValue

public java.lang.String getPropertyValue()
Get the value of the property specfied by this.getPropertyName(). This does not necessarily equal this.getAssocitatedOperator().getProperty(this.getPropertyName) because the operator's value is updated continuosly (after each time the operator is run) while this value is updated only when the execution controller decides to do so. Therefore, this value may be a historical value. The last time it was update may be accessed through this.getLastTimeUpdated(); Creation date: (1/10/2003 4:57:46 PM)
Returns:
java.lang.Object

setAssociatedQueryObject

public void setAssociatedQueryObject(XATQueryObject newAssociatedQueryObject)
Insert the method's description here. Creation date: (1/14/2003 10:45:41 AM)
Parameters:
newAssociatedOperator - edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATOperator

setCategory

public void setCategory(java.lang.Object newCategory)
Insert the method's description here. Creation date: (1/17/2003 3:10:07 PM)
Parameters:
newCategory - java.lang.Object

setPropertyName

public void setPropertyName(java.lang.String newPropertyName)
Insert the method's description here. Creation date: (1/14/2003 10:47:52 AM)
Parameters:
newPropertyName - java.lang.String

setPropertyValue

public void setPropertyValue(java.lang.String newPropertyValue)
Sets the property value. It is better to use the calculateNewValue() method to update the property because this method will just blindly take the parameter and set it to the internal value. Using calculateNewValue() will allow the subclasses to perform required calculations
Parameters:
newPropertyValue - java.lang.String

toString

public java.lang.String toString()
Insert the method's description here. Creation date: (1/20/03 8:52:33 PM)
Overrides:
toString in class java.lang.Object
Returns:
java.lang.String