Package libai.ants
Class Node
- java.lang.Object
-
- libai.ants.Node
-
- All Implemented Interfaces:
java.lang.Comparable<Node>
public class Node extends java.lang.Object implements java.lang.Comparable<Node>
This class belong to the core classes of the Ant Framework.Implements a single node of a problem Graph. It stores the graph index, distance relative to other Node and heuristic information It is mainly used as a handy tool to compute candidate list nodes.
-
-
Field Summary
Fields Modifier and Type Field Description protected double
distance
Distance according to other nodeprotected double
heuristicInfo
Heuristic informationprotected int
index
Index of the node in the graph
-
Constructor Summary
Constructors Constructor Description Node(int index, double distance, double heuristicInfo)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Node n)
Implements Comparable interface.double
getDistance()
double
getHeuristicInfo()
int
getIndex()
java.lang.String
toString()
Return the string representation of this node.
-
-
-
Method Detail
-
compareTo
public int compareTo(Node n)
Implements Comparable interface. Compares two nodes.- Specified by:
compareTo
in interfacejava.lang.Comparable<Node>
- Parameters:
n
- another node object
-
toString
public java.lang.String toString()
Return the string representation of this node. Useful for debugging.- Overrides:
toString
in classjava.lang.Object
- Returns:
- An string with the index, distance and heuristic information of the node.
-
getIndex
public int getIndex()
- Returns:
- the index
-
getHeuristicInfo
public double getHeuristicInfo()
- Returns:
- the heuristicInfo
-
getDistance
public double getDistance()
- Returns:
- the distance
-
-