org.deken.game.pathfinding
Class NodeFourWay

java.lang.Object
  extended by org.deken.game.pathfinding.NodeFourWay
All Implemented Interfaces:
Node

public class NodeFourWay
extends java.lang.Object
implements Node

Title: NodeFourWay

Description: TODO

Copyright: Copyright (c) Feb 11, 2012

Version:
1.0
Author:
Gary Deken

Constructor Summary
NodeFourWay(int xLocation, int yLocation)
           
 
Method Summary
 void addNode(Node node, int distance, java.util.List<java.lang.String> path)
          Add a connecting Node that is X distance away, with a path containing points.
 void clear()
           
 NodeLink getConnectionFromLocation(int x, int y)
          Gets the NodeLink that contains the given location.
 java.util.List<NodeLink> getConnections()
          Returns the connection nodes with distance to that node.
 int getDistanceFromStart()
          Used by pathfinding, the total distance from the start.
 GameLocation getGameLocation()
          The location of this node as a tile location.
 java.lang.String getLocationKey()
          Returns the Location as a String.
 Node getPathParent()
          Used by pathfinding, gets the node traveled through to get to this node.
 void setDistanceFromStart(int distanceFromStart)
          Used by pathfinding, sets the total distance from the start.
 void setPathParent(Node node)
          Used by pathfinding, sets the node traveled through to get to this node.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NodeFourWay

public NodeFourWay(int xLocation,
                   int yLocation)
Method Detail

addNode

public void addNode(Node node,
                    int distance,
                    java.util.List<java.lang.String> path)
Description copied from interface: Node
Add a connecting Node that is X distance away, with a path containing points.

Specified by:
addNode in interface Node
Parameters:
node -
distance -
path -

clear

public void clear()
Specified by:
clear in interface Node

getConnections

public java.util.List<NodeLink> getConnections()
Description copied from interface: Node
Returns the connection nodes with distance to that node.

Specified by:
getConnections in interface Node
Returns:
List

getConnectionFromLocation

public NodeLink getConnectionFromLocation(int x,
                                          int y)
Description copied from interface: Node
Gets the NodeLink that contains the given location. If the location is not in any of the links, null is returned.

Specified by:
getConnectionFromLocation in interface Node
Returns:
NodeLink

getDistanceFromStart

public int getDistanceFromStart()
Description copied from interface: Node
Used by pathfinding, the total distance from the start.

Specified by:
getDistanceFromStart in interface Node
Returns:
int

getGameLocation

public GameLocation getGameLocation()
Description copied from interface: Node
The location of this node as a tile location.

Specified by:
getGameLocation in interface Node
Returns:
GameLocation

getLocationKey

public java.lang.String getLocationKey()
Description copied from interface: Node
Returns the Location as a String. This use LocationUtils to build the location key.

Specified by:
getLocationKey in interface Node
Returns:
String

getPathParent

public Node getPathParent()
Description copied from interface: Node
Used by pathfinding, gets the node traveled through to get to this node.

Specified by:
getPathParent in interface Node
Returns:
Node

setDistanceFromStart

public void setDistanceFromStart(int distanceFromStart)
Description copied from interface: Node
Used by pathfinding, sets the total distance from the start.

Specified by:
setDistanceFromStart in interface Node

setPathParent

public void setPathParent(Node node)
Description copied from interface: Node
Used by pathfinding, sets the node traveled through to get to this node.

Specified by:
setPathParent in interface Node

toString

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