Advertisement
Guest User

Movement.java

a guest
Aug 28th, 2012
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. public class Movement implements Comparable
  2. {
  3.     public Node node;
  4.     public int movementCost;
  5.     private int heuristicCost;
  6.  
  7.     public Movement(Node node, int movementCost, int heuristicCost)
  8.     {
  9.         this.node = node;
  10.         this.movementCost = movementCost;
  11.         this.heuristicCost = heuristicCost;
  12.     }
  13.  
  14.     public int getTotalCost()
  15.     {
  16.         return movementCost + heuristicCost;
  17.     }
  18.  
  19.     public int compareTo(Object o)
  20.     {
  21.         Movement cNode = (Movement) o;
  22.         return new Integer(getTotalCost()).compareTo(cNode.getTotalCost());
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement