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

java.lang.Object
  |
  +--edu.wpi.cs.dsrg.xmldb.xat.common.xatnode.XATNodeImp
Direct Known Subclasses:
XATLeaf

public class XATNodeImp
extends java.lang.Object
implements XATNode, java.lang.Cloneable

The class defines the node of XATTree.

Since:
1.0
See Also:
Serialized Form

Field Summary
protected  java.util.Vector children
          The child nodes of this XATNode.
protected  XATOperator operator
          The operator connected with this XATNode.
protected  java.util.ArrayList parent
          The parent nodes of this XATNode.
protected  java.util.Set schema
          The required schema of this XATNode.
 
Constructor Summary
XATNodeImp()
          The default constructor of XATNodeImp.
 
Method Summary
 int addChild(XATNode new_child)
          Add one child to this node.
 int addChild(XATNode new_child, int position)
          Add one child to this node at specified position.
 java.util.Set clearSchema()
          Clear the schema of this XATNode.
 java.lang.Object clone()
          Deep clone this XATNode.
 int deleteChild(XATNode child)
          Delete a child from this node.
 XATNode getChild(int position)
          Get a specific child node of this node by their position.
 XATNode[] getChildren()
          Get all the children nodes of this node.
 int getChildrenSize()
          Returns how many children this node has
 int getIndexOf(XATNode node)
          Return the index of a node.
 XATOperator getOperator()
          Get the operator in this Node.
 XATNode getParent()
          Get the parent node of this node.
 java.util.Iterator getParents()
          Get an Iterator of all of the parents.
 java.util.Set getSchema()
          Get the schema of this XATNode.
 int locateChild(XATNode child)
          Get a position for a specific child node.
 XATNode setChild(int position, XATNode new_child)
          Set a specific child to be a new child node.
 XATNode[] setChildren(XATNode[] new_children)
          Set all the children nodes of this node.
 XATOperator setOperator(XATOperator new_operator)
          Set the operator in this Node.
 XATNode setParent(XATNode new_parent)
          Set the parent node of this node.
 java.util.Set setSchema(java.util.Set new_schema)
          Set the schema for current node.
 java.lang.String toString()
          Print current node information
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

operator

protected XATOperator operator
The operator connected with this XATNode.
Since:
1.0

parent

protected java.util.ArrayList parent
The parent nodes of this XATNode.
Since:
1.0

children

protected java.util.Vector children
The child nodes of this XATNode.
Since:
1.0

schema

protected java.util.Set schema
The required schema of this XATNode.
Since:
1.0
Constructor Detail

XATNodeImp

public XATNodeImp()
The default constructor of XATNodeImp.
Since:
1.0
Method Detail

addChild

public int addChild(XATNode new_child)
Add one child to this node. This should be called only by the XATTree.addNode(). Remember the children are order unsensitive.
Specified by:
addChild in interface XATNode
Parameters:
new_child - The new child node added.
Returns:
int The number of children.
Since:
1.0

addChild

public int addChild(XATNode new_child,
                    int position)
Add one child to this node at specified position. This method should be called only by the XATTree.addNode(). The children are order unsensitive.
Specified by:
addChild in interface XATNode
Parameters:
new_child - The new child node.
position - The position of new added node.
Returns:
The number of children.
Since:
1.0

clearSchema

public java.util.Set clearSchema()
Clear the schema of this XATNode.
Specified by:
clearSchema in interface XATNode
Returns:
Set The old schema of this XATNode.
Since:
1.0

clone

public java.lang.Object clone()
Deep clone this XATNode.
Specified by:
clone in interface XATNode
Overrides:
clone in class java.lang.Object
Returns:
Object The cloned result.
Since:
1.0

deleteChild

public int deleteChild(XATNode child)
Delete a child from this node.
Specified by:
deleteChild in interface XATNode
Parameters:
child - The to-be-deleted child node.
Returns:
int The number of children.
Since:
1.0

getChild

public XATNode getChild(int position)
                 throws XATNodeDoesNotExistException
Get a specific child node of this node by their position.
Specified by:
getChild in interface XATNode
Parameters:
position - The position of the child node.
Returns:
XATNode The child node got.
Throws:
XATNodeDoesNotExistException -  
Since:
1.0

getChildren

public XATNode[] getChildren()
Get all the children nodes of this node.
Specified by:
getChildren in interface XATNode
Returns:
XATNode[] The array of all the children.
Since:
1.0

getChildrenSize

public int getChildrenSize()
Returns how many children this node has
Specified by:
getChildrenSize in interface XATNode
Returns:
int The number of children.
Since:
1.0

getIndexOf

public int getIndexOf(XATNode node)
Return the index of a node.
Specified by:
getIndexOf in interface XATNode
Parameters:
node - The XATNode computing index for.
Returns:
int The index number of given node.
Since:
1.0

getOperator

public XATOperator getOperator()
Get the operator in this Node.
Specified by:
getOperator in interface XATNode
Returns:
XATOperator The operator of this node.
Since:
1.0

getParent

public XATNode getParent()
Get the parent node of this node.
Specified by:
getParent in interface XATNode
Returns:
XATNode The parent of this node.
Since:
1.0

getParents

public java.util.Iterator getParents()
Get an Iterator of all of the parents. The XATNode only has one parent, thus this iterator will only contain one element. However, subclasses may have multiple parents, thus nothing is lost by placing this method here.
Specified by:
getParents in interface XATNode
Returns:
Iterator Including all the parents.
Since:
1.0

getSchema

public java.util.Set getSchema()
Get the schema of this XATNode.
Specified by:
getSchema in interface XATNode
Returns:
Set The schema of this XATNode.
Since:
1.0

locateChild

public int locateChild(XATNode child)
Get a position for a specific child node. If not found, return -1.
Specified by:
locateChild in interface XATNode
Parameters:
child - The reference of child node searching for.
Returns:
int The position of this child.
Since:
1.0

setChild

public XATNode setChild(int position,
                        XATNode new_child)
                 throws XATNodeDoesNotExistException
Set a specific child to be a new child node.
Specified by:
setChild in interface XATNode
Parameters:
position - The position of the child node.
new_child - The new child node.
Returns:
XATNode The original child node.
Since:
1.0

setChildren

public XATNode[] setChildren(XATNode[] new_children)
Set all the children nodes of this node.
Specified by:
setChildren in interface XATNode
Parameters:
new_children - The new children nodes.
Returns:
XATNode[] The array containing all the old children.
Since:
1.0

setOperator

public XATOperator setOperator(XATOperator new_operator)
Set the operator in this Node.
Specified by:
setOperator in interface XATNode
Parameters:
new_operator - The new operator in this node.
Returns:
XATOperator The old operator in this node.
Since:
1.0

setParent

public XATNode setParent(XATNode new_parent)
Set the parent node of this node.
Specified by:
setParent in interface XATNode
Parameters:
new_parent - The new parent node of this node.
Returns:
XATNode The original parent of this node.
Since:
1.0

setSchema

public java.util.Set setSchema(java.util.Set new_schema)
Set the schema for current node.
Specified by:
setSchema in interface XATNode
Parameters:
new_schema - The new schema for this node.
Returns:
Set The old schema of this node.
Since:
1.0

toString

public java.lang.String toString()
Print current node information
Overrides:
toString in class java.lang.Object
Returns:
String The String representation fot this node.
Since:
1.0