001 package ps6; 002 import java.util.Iterator; 003 004 /** 005 * A Directions is a description of how to travel from one Address to 006 * another. 007 * @specfield start : Address // starting point 008 * @specfield end : Address // destination 009 * @specfield length : double // traveling distance, in miles (not rounded) 010 * @specfield directions : sequence[String] // 011 * directions for traveling from start to end. Each 012 * String in the sequence must be one line of directions, in the format 013 * specified in <a href="../../psets/ps6/ps6.html#dirs-format">PS6 014 * text based interface</a>, <b>excluding</b> the first line which 015 * states where you start <b>and</b> the final line which gives the length/time 016 * of the trip. The strings <b>must not</b> include newlines at their 017 * ends. The order of the Strings in the sequence must correspond to the order 018 * of the lines in the directions from start to end. 019 */ 020 public interface Directions extends Iterable<String> { 021 022 // a Directions is the result of a query to a DirectionsFinder 023 024 /** @return this.length. */ 025 public double getLength (); 026 027 /** @return an Iterator of Strings over this.directions */ 028 public Iterator<String> iterator(); 029 030 /** @return this.start */ 031 public Address getStart (); 032 033 /** @return this.end */ 034 public Address getEnd (); 035 }