edu.wpi.cs.dsrg.xmldb.xat.common.xatnode
Class XATDataValueImp

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.common.xatnode.XATDataValueImp

public class XATDataValueImp
extends XATQueryObjectImp
implements XATDataValue

 The class that represents the value of one cell in an XATTable
 The value is an atomic value or a Collection and 
 can be a Dom or a String datatype.  Methods are provided that will allow
 one type to be converted to another.  
 

Since:
1.0
See Also:
Serialized Form

Field Summary
protected  java.util.Vector collection
          The type be a vector of XATDataValue.
protected  java.lang.Object value
          The type be an atomic value instead of a collection.
 
Fields inherited from class edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATQueryObjectImp
stats, statsPresent
 
Constructor Summary
XATDataValueImp()
          The default XATDataValueImp constructor.
XATDataValueImp(java.lang.Object obj)
          The XATDataValueImp constructor.
 
Method Summary
 void add(java.lang.Object obj)
          If you use add, means this XATDataValue is a collection.
 java.lang.Boolean convertToBoolean()
          Converts the XATValue into a Boolean object.
 java.util.Vector convertToCollection()
          This method will take whatever the value is and converts it into a Collection (Vector)
 org.w3c.dom.Node convertToDOM()
          Convert the XATDataValue as a DOM object, and construct as an XML Node.
protected  java.lang.Object convertToDOM(java.lang.Object o)
          Convert the given object as a DOM object, and construct as an XML Node.
 java.lang.Double convertToDouble()
          Convert the XATDataValue into a Double object.
 java.lang.String convertToString()
          Converts the XATValue into a String.
protected  java.lang.Object convertToString(java.lang.Object o)
          Converts the given object into a String.
 java.lang.String getId()
          Get the Hash code of this XATDataValue.
 java.lang.Object getValue()
          Get the value of this XATDataValue.
 boolean isCollection()
          Check whether this XATDataValueImp is a collection or an atomic value.
 boolean isNode()
          Check whether this XATDataValueImp is an atomic value.
 void removeDuplicates()
          Remove the duplicated values in a vector.
 java.lang.String toString()
          Convert the value of this XATDataValueImp into a String with XML format.
 java.lang.String toXML()
          Convert the value of this XATDataValueImp into a String with XML format.
 java.lang.String toXML(java.lang.Object o)
          Convert the given object into a String with XML format.
 
Methods inherited from class edu.wpi.cs.dsrg.xmldb.xat.common.operator.XATQueryObjectImp
addStatistic, compareTo, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

collection

protected java.util.Vector collection
The type be a vector of XATDataValue.
Since:
1.0

value

protected java.lang.Object value
The type be an atomic value instead of a collection.
Since:
1.0
Constructor Detail

XATDataValueImp

public XATDataValueImp()
The default XATDataValueImp constructor.
Since:
1.0

XATDataValueImp

public XATDataValueImp(java.lang.Object obj)
The XATDataValueImp constructor. This is the only place you can creat an atomic valued XATDataValue.
Parameters:
obj - The Object used to construct the XATDataValueImp.
Since:
1.0
Method Detail

add

public void add(java.lang.Object obj)
If you use add, means this XATDataValue is a collection. This is the only method that can convert an atomic value into a collection.
Specified by:
add in interface XATDataValue
Parameters:
obj - Add a given Object into XATDataValue.
Returns:
void
Since:
1.0

convertToBoolean

public java.lang.Boolean convertToBoolean()
Converts the XATValue into a Boolean object.
Specified by:
convertToBoolean in interface XATDataValue
Returns:
Boolean A boolean object after convert.
Since:
1.0

convertToCollection

public java.util.Vector convertToCollection()
This method will take whatever the value is and converts it into a Collection (Vector)
Specified by:
convertToCollection in interface XATDataValue
Returns:
Vector The convert result.
Since:
1.0

convertToDOM

public org.w3c.dom.Node convertToDOM()
Convert the XATDataValue as a DOM object, and construct as an XML Node.
Specified by:
convertToDOM in interface XATDataValue
Returns:
Node The convert result.
Since:
1.0

convertToDOM

protected java.lang.Object convertToDOM(java.lang.Object o)
Convert the given object as a DOM object, and construct as an XML Node.
Returns:
Node The convert result.
Since:
1.0

convertToDouble

public java.lang.Double convertToDouble()
Convert the XATDataValue into a Double object.
Specified by:
convertToDouble in interface XATDataValue
Returns:
Double The convert result.
Since:
1.0

convertToString

public java.lang.String convertToString()
Converts the XATValue into a String. If the Value is a collection, then one large string is created.
Specified by:
convertToString in interface XATDataValue
Returns:
String The convert result.
Since:
1.0

convertToString

protected java.lang.Object convertToString(java.lang.Object o)
Converts the given object into a String. If the Value is a collection, then one large string is created.
Returns:
String The convert result.
Since:
1.0

getId

public java.lang.String getId()
Get the Hash code of this XATDataValue.
Specified by:
getId in interface XATDataValue
Returns:
String The Hash code of this XATDataValue.
Since:
1.0

getValue

public java.lang.Object getValue()
Get the value of this XATDataValue.
Returns:
String The value of this XATDataValue.
Since:
1.0

isCollection

public boolean isCollection()
Check whether this XATDataValueImp is a collection or an atomic value.
Returns:
boolean True: This XATDataValue is a collection. False: otherwise.
Since:
1.0

isNode

public boolean isNode()
Check whether this XATDataValueImp is an atomic value.
Returns:
boolean True: This XATDataValue is an atomic node. False: otherwise.
Since:
1.0

removeDuplicates

public void removeDuplicates()
Remove the duplicated values in a vector. The comparison is done by values.
Specified by:
removeDuplicates in interface XATDataValue
Returns:
void
Since:
1.0

toString

public java.lang.String toString()
Convert the value of this XATDataValueImp into a String with XML format.
Overrides:
toString in class java.lang.Object
Returns:
String The convert result.
Since:
1.0

toXML

public java.lang.String toXML()
Convert the value of this XATDataValueImp into a String with XML format.
Returns:
String The convert result.
Since:
1.0

toXML

public java.lang.String toXML(java.lang.Object o)
Convert the given object into a String with XML format.
Parameters:
o - The given object will be converted.
Returns:
String The convert result.
Since:
1.0