Advertisement
Guest User

Node.java

a guest
Aug 28th, 2012
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. public class Node implements Comparable
  2. {
  3.     public Node parentNode;
  4.     public int xPosition;
  5.     public int yPosition;
  6.     public int movementCost;
  7.     public int totalCost;
  8.  
  9.     public Node(int x, int y)
  10.     {
  11.         movementCost = 0;
  12.         xPosition = x;
  13.         yPosition = y;
  14.     }
  15.  
  16.     public boolean equals(Object obj)
  17.     {
  18.         Node cNode = (Node) obj;
  19.         return (cNode.xPosition == xPosition && cNode.yPosition == yPosition);
  20.     }
  21.  
  22.     public int compareTo(Object o)
  23.     {
  24.         Node cNode = (Node) o;
  25.         return new Integer(totalCost).compareTo(cNode.totalCost);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement