package sokobanevo.pathfinding;

/**
 * Node representation in A* algorithm.
 * 
 * Designed for use by Astar class.
 * 
 * @author Payne
 */
public class AstarNode implements Comparable{
    
    private final int x;
    private final int y;
    private final boolean passable;
    private int gCost;
    private int hCost;
    
    public AstarNode(int x, int y, boolean passable, int gCost, int hCost){
        this.x = x;
        this.y = y;
        this.passable = passable;
        this.gCost = gCost;
        this.hCost = hCost;
    }
    
    public int getHCost(){
        return hCost;
    }
    
    public void setHCost(int cost){
        this.hCost = cost;
    }
    
    public int getGCost(){
        return gCost;
    }
    
    public void setGCost(int cost){
        this.gCost = cost;
    }
    
    public int getFCost(){
        return hCost + gCost;
    }
    
    public int getX(){
        return x;
    }
    
    public int getY(){
        return y;
    }
    
    @Override
    public int compareTo(Object o){
        return this.getFCost() - ((AstarNode) o).getFCost();
    }
}
