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

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 DocumentRight Arrow Icon
Sheet1 Page 2 public static int length(AllRoutes r){ return r.length1() } public static City origin(AllRoutes r){ return r.origin1()
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/08/2008 for the course CS 370 taught by Professor Hafner during the Spring '08 term at Northeastern.

Page1 / 3

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

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online