Class AstarStrategy.Node
java.lang.Object
com.edu.xmum.CST210.AlgorithmStrategy.AstarStrategy.Node
- All Implemented Interfaces:
Comparable<AstarStrategy.Node>
- Enclosing class:
- AstarStrategy
Inner class representing a node in the A* algorithm.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompares this node to another node based on their f values.booleanChecks if this node is equal to another object.inthashCode()Generates a hash code for this node.
-
Constructor Details
-
Node
public Node(int x, int y, int g, int h) Constructor to initialize a node.- Parameters:
x- The x-coordinate of the node.y- The y-coordinate of the node.g- The cost from the start to this node.h- The estimated cost from this node to the goal.
-
-
Method Details
-
compareTo
Compares this node to another node based on their f values.- Specified by:
compareToin interfaceComparable<AstarStrategy.Node>- Parameters:
o- The other node to compare to.- Returns:
- The comparison result.
-
equals
Checks if this node is equal to another object. -
hashCode
public int hashCode()Generates a hash code for this node.
-