jwo.landserf.structure.msn
Class GraphNode

java.lang.Object
  extended by jwo.landserf.structure.msn.GraphNode

public class GraphNode
extends Object

Structure to store a graph node. A node represents a 3d location and feature type.

Version:
2.3, 14th May, 2006.
Author:
Jo Wood

Constructor Summary
GraphNode(float x, float y, float z, int type, int id)
          Creates a locational graph node of the given feature type.
 
Method Summary
 int getGraphID()
          Reports the ID of the graph to which this node belongs.
 int getID()
          Reports the ID of this node.
 GraphJunction getJunction()
          Returns the junction at which this node is the centre, or null if the node is not connected to anything.
 GraphNode getOtherNode()
          Reports the first node connected to this one, or null if node not connected to an edge.
 int getType()
          Reports the type of feature at the node.
 int getValency()
          Reports the valency of the node (number of edges connected to it).
 float getX()
          Reports the x coordinate of the node.
 float getY()
          Reports the y coordinate of the node.
 float getZ()
          Reports the z coordinate of the node.
 boolean isUniversal()
          Reports whether the node is universal.
 void makeUniversal()
          Makes the feature universal.
 void removeUniversal()
          Removes universal status from feature.
 void setGraphID(int id)
          Sets the ID of the graph to which this node belongs.
 void setJunction(GraphJunction junction)
          Associates the given junction with this node.
 void setNodeID(int id)
          Sets the ID of the node with the given value.
 String toString()
          Provides a text summary of the node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphNode

public GraphNode(float x,
                 float y,
                 float z,
                 int type,
                 int id)
Creates a locational graph node of the given feature type.

Parameters:
x - x location of the node.
y - y location of the node.
z - height of the node.
type - Feature type (SurfParam.PIT, SurfParam.PASS etc).
id - Identifier for this node.
Method Detail

toString

public String toString()
Provides a text summary of the node.

Overrides:
toString in class Object
Returns:
String representation of the node

getX

public float getX()
Reports the x coordinate of the node.

Returns:
x coordinate of the node.

getY

public float getY()
Reports the y coordinate of the node.

Returns:
y coordinate of the node.

getZ

public float getZ()
Reports the z coordinate of the node.

Returns:
z coordinate of the node.

getType

public int getType()
Reports the type of feature at the node.

Returns:
type of feature at the node.

getGraphID

public int getGraphID()
Reports the ID of the graph to which this node belongs.

Returns:
ID of graph to which this node belongs.

getID

public int getID()
Reports the ID of this node.

Returns:
ID of this node.

getJunction

public GraphJunction getJunction()
Returns the junction at which this node is the centre, or null if the node is not connected to anything.

Returns:
Junction represented by this node or null if isolated from network.

getValency

public int getValency()
Reports the valency of the node (number of edges connected to it).

Returns:
Valency of the node.

getOtherNode

public GraphNode getOtherNode()
Reports the first node connected to this one, or null if node not connected to an edge. Note this method only has meaning if it is univalent. Polyvalent nodes will return an arbitrary connected node.

Returns:
Node connected to this one or null if not connected.

isUniversal

public boolean isUniversal()
Reports whether the node is universal.

Returns:
True if node represents a universal pit or peak.

setGraphID

public void setGraphID(int id)
Sets the ID of the graph to which this node belongs.

Parameters:
id - ID of graph to which this node belongs.

setNodeID

public void setNodeID(int id)
Sets the ID of the node with the given value.

Parameters:
id - New ID of node.

setJunction

public void setJunction(GraphJunction junction)
Associates the given junction with this node.

Parameters:
junction - Junction to be associated with this node.

makeUniversal

public void makeUniversal()
Makes the feature universal. Can only be applied to pits and peaks. If the node is of any other type, its status is not changed.


removeUniversal

public void removeUniversal()
Removes universal status from feature. Can only be applied to pits and peaks. If the node is of any other type, its status is not changed.



Copyright Jo Wood, 1996-2009, last modified, 17th April, 2009