org.samcrow
Class Node

java.lang.Object
  extended by org.samcrow.Node
All Implemented Interfaces:
java.lang.Comparable<Node>
Direct Known Subclasses:
Destination, Waypoint

public abstract class Node
extends java.lang.Object
implements java.lang.Comparable<Node>

Base class for nodes

Author:
Sam Crow

Field Summary
protected static int CIRCLE_RADIUS
           
protected  java.util.Collection<Link> links
           
protected  int x
           
protected  int y
           
 
Constructor Summary
Node(int inX, int inY)
          Construct a node with a given location and no links
 
Method Summary
 void addLink(Link inLink)
           
 int compareTo(Node o)
           
 boolean equals(java.lang.Object obj)
           
 org.lekan.graphics.SGObject getDrawObject()
          Get the SGObjects to draw this node
 java.util.Collection<Link> getLinks()
           
 int getX()
          Get the X-coordinate of this node
 int getY()
          Get the Y-coordinate of this node
 int hashCode()
           
 boolean isInArea(java.awt.event.MouseEvent e)
          Check if the location of a given MouseEvent is inside the circle that represents this Node
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CIRCLE_RADIUS

protected static final int CIRCLE_RADIUS
See Also:
Constant Field Values

x

protected int x

y

protected int y

links

protected java.util.Collection<Link> links
Constructor Detail

Node

public Node(int inX,
            int inY)
Construct a node with a given location and no links

Parameters:
inX - The X coordinate of the node
inY - The Y coordinate of the node
Method Detail

addLink

public final void addLink(Link inLink)

getDrawObject

public org.lekan.graphics.SGObject getDrawObject()
Get the SGObjects to draw this node

Returns:
a collection of SGObjects to draw

getLinks

public final java.util.Collection<Link> getLinks()

getX

public final int getX()
Get the X-coordinate of this node

Returns:
the X-coordinate

getY

public final int getY()
Get the Y-coordinate of this node

Returns:
the Y-coordinate

isInArea

public boolean isInArea(java.awt.event.MouseEvent e)
Check if the location of a given MouseEvent is inside the circle that represents this Node

Parameters:
e - the MouseEvent to check
Returns:
if the MouseEvent was inside this Node's circle

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(Node o)
Specified by:
compareTo in interface java.lang.Comparable<Node>