edu.wpi.cs.dsrg.xmldb.xat.common.treestructure
Class DOMPatternImp

java.lang.Object
  |
  +--edu.wpi.cs.dsrg.xmldb.xat.common.treestructure.DOMPatternImp
Direct Known Subclasses:
BindingTree

public class DOMPatternImp
extends java.lang.Object
implements DOMPattern

This Class implemented the DOMpattern Interface.

Since:
1.0
See Also:
Serialized Form

Field Summary
protected  RootNode rootNode
          The root of the tree.
 
Constructor Summary
DOMPatternImp()
          The default DOMPatternImp constructor.
DOMPatternImp(RootNode root)
          The DOMPatternImp constructor.
 
Method Summary
 void addNode(DOMPatternNode newNode, DOMPatternNode parentNode)
          Add a new parent node for a given DOMPatternNode node.
 boolean containsColumn(java.lang.String columnName)
          Test to see if this DOMPattern contains a specific column name in its pattern tree.
 java.lang.String[] getColumnNames()
          Return the columnNames associated with this DomPatternNode use the toListPattern method which traverses the tree but toListPattern produces a Vector with both the tagNames and columnNames in it, so we need to remove the tagNames Therefore, create a new Vector which just has a string representation of the columnNames of the ListPattern
 RootNode getRoot()
          Get the root node of this DOMTree.
 boolean isInTree(DOMPatternNode node)
          Check the tree for a specific node
 void removeNode(DOMPatternNode node)
          Delete the given DOMPatternNode.
 void setRoot(RootNode root)
          Set root node of DOMPattern.
 java.lang.String toIndentString()
          Get the indented print output of the result.
 java.lang.String toIndentString(DOMPatternNode rn)
          Get the indented print output of the result.
 ListPattern toListPattern(DOMPatternNode node)
          Convert the tree into a list by extracting the TagName and TagValue.
 java.lang.String toString()
          Convert the tree into a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rootNode

protected RootNode rootNode
The root of the tree.
Since:
1.0
Constructor Detail

DOMPatternImp

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

DOMPatternImp

public DOMPatternImp(RootNode root)
The DOMPatternImp constructor.
Parameters:
root - The root of DOMPatterm.
Since:
1.0
Method Detail

addNode

public void addNode(DOMPatternNode newNode,
                    DOMPatternNode parentNode)
Add a new parent node for a given DOMPatternNode node. The parent node is updated to have a link to the child node. The child node is updates to have a link to the parent node.
Specified by:
addNode in interface DOMPattern
Parameters:
parent - The parent node it attached to.
child - The child node attached.
Returns:
void
Since:
1.0

containsColumn

public boolean containsColumn(java.lang.String columnName)
Test to see if this DOMPattern contains a specific column name in its pattern tree.
Parameters:
columnName - The column name searching for.
Returns:
boolean True: The given DOMPattern contains the columnName. False: otherwise.
Since:
1.0

getColumnNames

public java.lang.String[] getColumnNames()
Return the columnNames associated with this DomPatternNode use the toListPattern method which traverses the tree but toListPattern produces a Vector with both the tagNames and columnNames in it, so we need to remove the tagNames Therefore, create a new Vector which just has a string representation of the columnNames of the ListPattern
Returns:
java.lang.String[]
Since:
1.0

getRoot

public RootNode getRoot()
Description copied from interface: DOMPattern
Get the root node of this DOMTree.
Specified by:
getRoot in interface DOMPattern

isInTree

public boolean isInTree(DOMPatternNode node)
Description copied from interface: DOMPattern
Check the tree for a specific node
Specified by:
isInTree in interface DOMPattern
Tags copied from interface: DOMPattern
Parameters:
node - the node you are looking for in the tree
Returns:
boolean True: The given DOMPatternNode is in the tree. False: Otherwise.

removeNode

public void removeNode(DOMPatternNode node)
Delete the given DOMPatternNode. It will affect number of nodes. All the children nodes of the to-be-deleted node will be the children of the parent node of the to-be-delete node.
Specified by:
removeNode in interface DOMPattern
Parameters:
node - the to-be-deleted child node.
Returns:
void
Since:
1.0

setRoot

public void setRoot(RootNode root)
Set root node of DOMPattern.
Specified by:
setRoot in interface DOMPattern
Parameters:
new_root - The new root node.
Returns:
void.
Since:
1.0

toIndentString

public java.lang.String toIndentString()
Get the indented print output of the result. This method is used for the GUI.
Specified by:
toIndentString in interface DOMPattern
Returns:
String The indented print output of the result.
Since:
1.0

toIndentString

public java.lang.String toIndentString(DOMPatternNode rn)
Get the indented print output of the result. This method is used for the GUI.
Returns:
String The indented print output of the result.
Since:
1.0

toListPattern

public ListPattern toListPattern(DOMPatternNode node)
Convert the tree into a list by extracting the TagName and TagValue.
Specified by:
toListPattern in interface DOMPattern
Parameters:
node - The DOMPatternNode translate for.
Returns:
ListPattern The result listPattern of given DOMPattern Node.
Since:
1.0

toString

public java.lang.String toString()
Convert the tree into a String.
Specified by:
toString in interface DOMPattern
Overrides:
toString in class java.lang.Object
Returns:
String
Since:
1.0