edu.wpi.cs.dsrg.xmldb.xat.common.operator
Class XATQueryObjectImp

java.lang.Object
  |
  +--edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATPropertiesImp
        |
        +--edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATQueryObjectImp
Direct Known Subclasses:
ReWriteTraversal, StatisticsObject, XATDataSourceImp, XATDataValueImp, XATOperatorImp, XATTreeImp

public abstract class XATQueryObjectImp
extends XATPropertiesImp
implements XATQueryObject, java.lang.Comparable

Implementation of the XATQueryObject interface. Any object that wants to have a reference to the statistics gatherer -or- be able to be stored in the StatisticsGatherer needs to derive from this class.

This also provides a standard means for operators to define which statistics they support. This is new b/c previously, the properties and statistics were lumped together.

Since:
1.0
See Also:
Serialized Form

Field Summary
protected  StatisticsGatherer stats
          each instance of this class also has the StatisticsGatherer available for use
protected  boolean statsPresent
           
 
Constructor Summary
XATQueryObjectImp()
          Instantiates the XATQueryObject
 
Method Summary
protected  void addStatistic(java.lang.String name)
          Adds a new Statistic that will be supported
 int compareTo(java.lang.Object o)
          Note: this class has a natural ordering that is inconsistent with equals.
 java.util.Enumeration getStatistics()
          returns an enumeration of Statistics supported by this query object
 boolean isValidStatistic(java.lang.String nameToCheck)
          Checks if the given property is valid for this QueryObject.
protected  void setDefaultProperties()
          called by the constructor.
protected  void setDefaultStatistics()
          called by the constructor.
 
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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statsPresent

protected boolean statsPresent

stats

protected StatisticsGatherer stats
each instance of this class also has the StatisticsGatherer available for use
Constructor Detail

XATQueryObjectImp

public XATQueryObjectImp()
Instantiates the XATQueryObject
Since:
1.0
Method Detail

addStatistic

protected void addStatistic(java.lang.String name)
Adds a new Statistic that will be supported
Parameters:
name - java.lang.String the name of the property
Since:
1.0

compareTo

public int compareTo(java.lang.Object o)
Note: this class has a natural ordering that is inconsistent with equals. This is sorted based on hashcode only, it does not have anything to do with the contents of the query object. Subclasses should override this to have a more correct compareTo.

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
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.
Since:
1.0

getStatistics

public java.util.Enumeration getStatistics()
returns an enumeration of Statistics supported by this query object
Specified by:
getStatistics in interface XATQueryObject
Returns:
an Enumeration
Since:
1.0

isValidStatistic

public boolean isValidStatistic(java.lang.String nameToCheck)
Checks if the given property is valid for this QueryObject.
Specified by:
isValidStatistic in interface XATQueryObject
Returns:
boolean true if the property is supported by this object, false otherwise.
Since:
1.0

setDefaultProperties

protected void setDefaultProperties()
called by the constructor. this will set the default properties that the ALL query objects will support. Each subclass should override this method and add their own unique properties, but should also call super.setDefaultProperties() so that the common properties may be set.
Overrides:
setDefaultProperties in class XATPropertiesImp
Since:
1.0

setDefaultStatistics

protected void setDefaultStatistics()
called by the constructor. this will set the default Statistics that the ALL query objects will support. Each subclass should override this method and add their own unique properties, but should also call super.setDefaultStatistics() so that the common statistics may be set.
Since:
1.0