// HeapVal extends Comparable : find in HeapVal.java public class coord implements HeapValue, java.io.Serializable { int y, x; int estcost; // total cost, including knowndist and estimate int knowndist; // distance (cost) from source node, excluding estimate boolean interior = false; // coord on frontier or interior coord prev; // pointer to previous coordinate on path. public coord(int a, int b) {y=a; x=b;} //other vars set externally public void copy(coord B) // replace information with those from coord B, { // but retain heap index info. This method should y = B.y; x = B.x; // be called when a better coord is found on the estcost = B.estcost; // frontier "list" knowndist = B.knowndist; interior = B.interior; prev = B.prev; }//copy public boolean equals(Object oc) // conforms to old java specs { if (oc==null || !(oc instanceof coord)) return false; coord c = (coord)oc; return (x==c.x && y==c.y); } public int compareTo(coord c) // compares cost, not compatible with .equals { return estcost - c.estcost; // reverse comparison: want smallest first } // for HeapVal interface, allows repositioning once estcost changes protected int Hi; // index in heap (for HeapAware interface) public int getIndex() { return Hi; } public void setIndex(int i) { Hi=i; } } // coord