org.wilmascope.graph
Class Node

java.lang.Object
  extended by org.wilmascope.graph.GraphElement
      extended by org.wilmascope.graph.Node
Direct Known Subclasses:
Cluster

public class Node
extends GraphElement

Definition of a graph Node or Vertex. Nodes (or Vertices) in the graph may be:


Field Summary
 
Fields inherited from class org.wilmascope.graph.GraphElement
layout, owner, view, visible
 
Constructor Summary
Node()
           
Node(NodeView view)
           
 
Method Summary
 void addEdge(Edge edge)
          add an edge to the node's list of edges to which it is connected
 void delete()
          delete the node forever, removing all references to it and all edges that are attached to it
 Cluster getCommonAncestor(Node node)
          return the common ancestor cluster of this node and the argument, ie recurse up the heirarchy of clusters until we meet a cluster to which both nodes are members or sub-members
 EdgeList getCommonEdges(Node node)
          return a list of edges common to this node and the argument
 int getDegree()
           
 EdgeList getEdges()
           
 int getInDegree()
           
 EdgeList getInEdges()
           
 NodeLayout getLayout()
          get the layout properties of the node
 float getMass()
          get the mass of this node
 java.util.ArrayList<Node> getNeighbours()
           
 int getOutDegree()
           
 EdgeList getOutEdges()
           
 javax.vecmath.Point3f getPosition()
          get the position of the node in space
 java.util.Properties getProperties()
          Any properties loaded or saved in files con be stored in a Properties object.
 NodeView getView()
          get the view representing the node
 boolean isNeighbour(Node node)
          Checks if there is an edge between this node and the argument
protected  void removeEdge(Edge edge)
          remove a reference to an edge from this node
 void reposition(javax.vecmath.Vector3f delta)
          adjust the node's position by delta
 void setEdges(EdgeList edges)
          set the edges by which this node is connected to other nodes copies the values in to preserve external references to the original list
 void setLayout(NodeLayout layout)
          set the layout properties of the node
 void setMass(float mass)
          set the Mass of this node
 void setPosition(javax.vecmath.Point3f newPosition)
          set the position of the node in space
 void setProperties(java.util.Properties p)
           
 void setView(NodeView view)
          set the view representing all visual aspects of the node and make the node visible
 
Methods inherited from class org.wilmascope.graph.GraphElement
draw, getOwner, getUserData, hide, isVisible, setOwner, show, storeUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node()

Node

public Node(NodeView view)
Method Detail

addEdge

public void addEdge(Edge edge)
add an edge to the node's list of edges to which it is connected


removeEdge

protected void removeEdge(Edge edge)
remove a reference to an edge from this node


getCommonAncestor

public Cluster getCommonAncestor(Node node)
return the common ancestor cluster of this node and the argument, ie recurse up the heirarchy of clusters until we meet a cluster to which both nodes are members or sub-members


getCommonEdges

public EdgeList getCommonEdges(Node node)
return a list of edges common to this node and the argument


delete

public void delete()
delete the node forever, removing all references to it and all edges that are attached to it

Specified by:
delete in class GraphElement

getEdges

public EdgeList getEdges()
Returns:
List of edges attached to the node

getInEdges

public EdgeList getInEdges()
Returns:
list of edges for which this is the end node

getOutEdges

public EdgeList getOutEdges()
Returns:
list of edges for which this is the start node

setEdges

public void setEdges(EdgeList edges)
set the edges by which this node is connected to other nodes copies the values in to preserve external references to the original list


setView

public void setView(NodeView view)
set the view representing all visual aspects of the node and make the node visible


getView

public NodeView getView()
get the view representing the node


setLayout

public void setLayout(NodeLayout layout)
set the layout properties of the node


getLayout

public NodeLayout getLayout()
get the layout properties of the node


setPosition

public void setPosition(javax.vecmath.Point3f newPosition)
set the position of the node in space


reposition

public void reposition(javax.vecmath.Vector3f delta)
adjust the node's position by delta

Parameters:
delta - the adjustment to make to the node's position

getPosition

public javax.vecmath.Point3f getPosition()
get the position of the node in space


setMass

public void setMass(float mass)
set the Mass of this node


getMass

public float getMass()
get the mass of this node


getDegree

public int getDegree()
Returns:
the number of edges connected to this node

getOutDegree

public int getOutDegree()
Returns:
the number of edges starting at this node

getInDegree

public int getInDegree()
Returns:
the number of edges ending at this node

getProperties

public java.util.Properties getProperties()
Description copied from class: GraphElement
Any properties loaded or saved in files con be stored in a Properties object. This method is called to extract the GraphElement's properties when the file is created.

Specified by:
getProperties in class GraphElement
Returns:
Custom properties associated with this GraphElement.

setProperties

public void setProperties(java.util.Properties p)
Specified by:
setProperties in class GraphElement

isNeighbour

public boolean isNeighbour(Node node)
Checks if there is an edge between this node and the argument

Parameters:
node - possible neighbour of this node
Returns:
true if such an edge exists

getNeighbours

public java.util.ArrayList<Node> getNeighbours()
Returns:
list of all nodes connected to this node by an edge