root/trunk/PhysicalEdge.java
| Revision 3, 0.6 kB (checked in by dpaola2, 1 month ago) |
|---|
| Line | |
|---|---|
| 1 | // PhysicalEdge - copyright Tom Felker, <tfelker2@uiuc.edu>, December 2004 |
| 2 | // |
| 3 | // subclass of edge that connects two physical nodes |
| 4 | |
| 5 | import java.io.*; |
| 6 | |
| 7 | public class PhysicalEdge extends Edge implements Serializable { |
| 8 | |
| 9 | public PhysicalEdge(int a, int b) { |
| 10 | super(a, b); |
| 11 | } |
| 12 | |
| 13 | public Cost computeDeltaGCost(Node from, Cost gCostOfFrom, Search s) { |
| 14 | return new Cost(((PhysicalNode)from).distanceTo(((PhysicalNode)getOtherNode(from))) / s.walkingSpeed ); |
| 15 | } |
| 16 | |
| 17 | // we could cache the distance or cost calculation if we wanted to |
| 18 | // but maybe it won't be used that often |
| 19 | // optimize later... |
| 20 | |
| 21 | } |
Note: See TracBrowser for help on using the browser.
