{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw4 - package geography import java.util.Comparator public...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 package geography import java.util.Comparator public abstract class AllRoutes { private static Empty e p // Basic creators, to be located within the AllRoutes class. / public static AllRoutes empty(){ if (e == null){ e = new Empty() } return e } public static AllRoutes addLeg(AllRoutes allR, Route r){ return new AddLeg(allR, r) } // Derived creators, to be located within the AllRoutes class. public static AllRoutes select(AllRoutes allR, Comparator<Route> c, Route r){ return allR.select1(c, r) } public static AllRoutes sort(AllRoutes allR, Comparator<Route> c){ return allR.sort1(c) } public static AllRoutes insert(AllRoutes allR, Comparator<Route> c, Route r){ return allR.insert1(c, r) } // Predicate public static boolean isEmpty(AllRoutes ar){ return ar.isEmpty1() } // Accessors public static int numberOfLegs(AllRoutes r){ return r.numberOfLegs1() }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Sheet1 Page 2 public static int length(AllRoutes r){ return r.length1() } public static City origin(AllRoutes r){ return r.origin1() } public static City destination(AllRoutes r){ return r.destination1() } public static Route firstLeg(AllRoutes r){
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}