/** 
 *
 * www.tech-algorithm.com
 *
 */
public class Path {
    private Node endA, endB ;
    private float cost ;
    public Path(Node endA, Node endB, float cost) {
        this.endA = endA ;
        this.endB = endB ;
        this.cost = cost ;
    }
    public float getCost() {
        return cost ;
    }
    public void setCost(float cost) {
        this.cost = cost ;
    }
    public Node getEndA() {
        return endA ;
    }
    public Node getEndB() {
        return endB ;
    }
    public Node getEndNode(Node startNode) {
        if (endA.equals(startNode))
            return endB ;
        if (endB.equals(startNode))
            return endA ;
        return null ;
    }    
}

