|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.hedgehog.HObject
com.hedgehog.math.graph_tree.GraphTreeNode<NodeType>
NodeType - Node type.public class GraphTreeNode<NodeType>
Title: GraphTreeNode - represents a node in a graph or tree.
Description: Models a node in a graph or tree as a node object and list of adjacent nodes.
Copyright: Copyright (c) Hedgehog Software 2007-2009.
Company: Hedgehog Software.
| Field Summary | |
|---|---|
protected java.util.ArrayList<GraphTreeNode<NodeType>> |
mAdjacentNodes
List of adjacent nodes. |
protected NodeType |
nodeObject
Node object. |
| Fields inherited from class com.hedgehog.HObject |
|---|
mID, mName |
| Constructor Summary | |
|---|---|
GraphTreeNode()
Default constructor. |
|
GraphTreeNode(GraphTreeNode<NodeType> object)
Copy constructor. |
|
GraphTreeNode(NodeType nodeObject)
Constructor. |
|
GraphTreeNode(NodeType nodeObject,
java.util.ArrayList<GraphTreeNode<NodeType>> adjacentNodes)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
addAdjacentNode(GraphTreeNode<NodeType> adjacentNode)
Adds the specified adjacent node. |
int[] |
adjacentNodeIDs()
Returns an integer array of the IDs of adjacent nodes to this node. |
int[] |
adjacentNodeObjectIDs()
Returns an integer array of the IDs of the node objects of adjacent nodes to this node. |
java.util.Vector<ModelObject> |
childModelObjects()
Returns a vector of this object's child ModelObject objects. |
java.sql.PreparedStatement |
databaseInsertStatement(java.sql.Connection connection,
int modelID)
Returns a prepared statement for inserting (INSERT command) a ModelObject object into a database. |
java.sql.PreparedStatement |
databaseUpdateStatement(java.sql.Connection connection,
int modelID)
Returns a prepared statement for updating (UPDATE command) a ModelObject object into a database. |
int |
degree()
Returns the degree of a node; ie the number of adjacent nodes. |
void |
deleteAdjacencies()
Deletes all adjacency relationships from this node. |
boolean |
deleteAdjacentNode(GraphTreeNode<NodeType> adjacentNode)
Deletes the specified adjacent node. |
boolean |
equalNodeObjects(GraphTreeNode node)
Tests whether or not two nodes are equal using the equals() method on the node objects. |
boolean |
equals(java.lang.Object object)
Compares the specified object against this node. |
ModelObject |
fromDatabase(java.sql.Connection connection,
Model model,
int modelID,
int objectID)
Returns a model object from the specified database table. |
ModelObject |
fromXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Node documentRootNode,
org.w3c.dom.Node node,
Model model)
Returns a model object from the specified xml node. |
java.util.ArrayList<GraphTreeNode<NodeType>> |
getAdjacentNodes()
Returns the linked list of adjacnt nodes. |
java.awt.Color |
getNodeColour()
Returns the node colour. |
int |
getNodeDepth()
Returns the node depth. |
int |
getNodeFinish()
Returns the node finish time. |
NodeType |
getNodeObject()
Returns the node object. |
GraphTreeNode<NodeType> |
getNodePredecessor()
Returns the predecessor node. |
java.lang.String |
getNodeType()
Returns the string equivalent of the generic type of the node object; eg "ModelDouble" in GraphTreeNode |
boolean |
hasAdjacentNodes()
Tests whether or not a node has a list of adjacent nodes. |
int |
hashCode()
Returns the hash code of this node. |
boolean |
hasMultipleArcs()
Returns logical-true if a node has multiple arcs, ie the same node appears more than once in a node's adjacency list. |
boolean |
hasNodeObject()
Tests whether or not a node has a node object. |
boolean |
isAdjacentNode(GraphTreeNode node)
Returns logical-true if node is an adjacent node, else logical-false. |
boolean |
isLoopNode()
Returns logical-true if the operated-on node is a loop node (i.e. |
boolean |
isSimple()
Returns logical-true if a node is simple (i.e. |
int |
numberOfAdjacentNodes()
Returns the number of adjacent nodes. |
boolean |
setAdjacentNodes(java.util.ArrayList<GraphTreeNode<NodeType>> newAdjacentNodes)
Sets the adjacent nodes. |
boolean |
setNodeColour(java.awt.Color newColour)
Sets the node colour used by breadth/depth first search iterators. |
boolean |
setNodeDepth(int newDepth)
Sets the node depth. |
boolean |
setNodeFinish(int newFinish)
Sets the node finish time. |
boolean |
setNodeObject(NodeType newNodeObject)
Sets the node object. |
boolean |
setNodePredecessor(GraphTreeNode<NodeType> newPredecessor)
|
java.lang.String |
toString()
Returns a String representation of a GraphTreeNode object. |
X3DNode |
toX3DNode(X3DObject x3dObject)
X3D support. |
org.w3c.dom.Element |
toXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Element documentRootNode)
Returns the xml node of this object. |
| Methods inherited from class com.hedgehog.HObject |
|---|
clone, compare, compareTo, copy, getID, getName, hasID, hasName, setID, setName |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected NodeType nodeObject
protected java.util.ArrayList<GraphTreeNode<NodeType>> mAdjacentNodes
| Constructor Detail |
|---|
public GraphTreeNode()
public GraphTreeNode(NodeType nodeObject)
nodeObject - Node object.
public GraphTreeNode(NodeType nodeObject,
java.util.ArrayList<GraphTreeNode<NodeType>> adjacentNodes)
nodeObject - Node object.adjacentNodes - LinkedListpublic GraphTreeNode(GraphTreeNode<NodeType> object)
object - Object to copy.| Method Detail |
|---|
public boolean addAdjacentNode(GraphTreeNode<NodeType> adjacentNode)
adjacentNode - Adjacent node to be added.
public int degree()
public boolean deleteAdjacentNode(GraphTreeNode<NodeType> adjacentNode)
adjacentNode - Adjacent node to be deleted from the operated-on node's adjacency list.
public void deleteAdjacencies()
public NodeType getNodeObject()
public java.util.ArrayList<GraphTreeNode<NodeType>> getAdjacentNodes()
public int[] adjacentNodeIDs()
public int[] adjacentNodeObjectIDs()
public boolean hasNodeObject()
public boolean hasAdjacentNodes()
public boolean hasMultipleArcs()
public boolean isLoopNode()
public boolean isSimple()
public boolean equalNodeObjects(GraphTreeNode node)
node - Comparison node.
public boolean equals(java.lang.Object object)
equals in interface java.util.Comparatorequals in class HObjectobject - Object to compare.
public int hashCode()
hashCode in class HObjectpublic boolean isAdjacentNode(GraphTreeNode node)
node - Test node.
public int numberOfAdjacentNodes()
public boolean setNodeObject(NodeType newNodeObject)
newNodeObject - New node object.
public boolean setAdjacentNodes(java.util.ArrayList<GraphTreeNode<NodeType>> newAdjacentNodes)
newAdjacentNodes - New linked list of adjacent nodes.
public java.lang.String toString()
toString in class java.lang.Objectpublic int getNodeDepth()
public java.awt.Color getNodeColour()
public GraphTreeNode<NodeType> getNodePredecessor()
public boolean setNodeDepth(int newDepth)
newDepth - New depth.
public int getNodeFinish()
public boolean setNodeFinish(int newFinish)
newFinish - New finish time.
public boolean setNodeColour(java.awt.Color newColour)
newColour - New colour value.
public boolean setNodePredecessor(GraphTreeNode<NodeType> newPredecessor)
newPredecessor - New predecessor. Can be null, indicating that a node does not have a predcessor.
public java.util.Vector<ModelObject> childModelObjects()
childModelObjects in interface ModelObject
public java.sql.PreparedStatement databaseInsertStatement(java.sql.Connection connection,
int modelID)
throws java.sql.SQLException
databaseInsertStatement in interface ModelObjectconnection - Database connection.modelID - Model ID.
java.sql.SQLException - Thrown if an SQL exception occurs.
public java.sql.PreparedStatement databaseUpdateStatement(java.sql.Connection connection,
int modelID)
throws java.sql.SQLException
databaseUpdateStatement in interface ModelObjectconnection - Database connection.modelID - Model ID.
java.sql.SQLException - Thrown if an SQL exception occurs.
public ModelObject fromDatabase(java.sql.Connection connection,
Model model,
int modelID,
int objectID)
throws java.sql.SQLException
fromDatabase in interface ModelObjectconnection - Database connection.model - Model built from database.modelID - Model ID.objectID - Object ID in associated ModelObjects table.
java.sql.SQLException - Thrown if an SQL exception occurs.public java.lang.String getNodeType()
public org.w3c.dom.Element toXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Element documentRootNode)
throws InvalidObjectException
toXMLNode in interface ModelObjectdocument - XML document.documentRootNode - Document root node; ie Model node.
InvalidObjectException - Thrown if this object's ID is equal to the default ID of -1.
public ModelObject fromXMLNode(org.w3c.dom.Document document,
org.w3c.dom.Node documentRootNode,
org.w3c.dom.Node node,
Model model)
throws InvalidObjectException
fromXMLNode in interface ModelObjectdocument - XML document.documentRootNode - Document root node; ie Model node.node - XML node.model - Model to which node object is added.
InvalidObjectException - Thrown if an error occurred building the object.
public X3DNode toX3DNode(X3DObject x3dObject)
throws InvalidObjectException
toX3DNode in interface ModelObjectx3dObject - X3D object.
InvalidObjectException - Thrown if this object is invalid.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||