diff --git a/src/MakkahCity.java b/src/MakkahCity.java index 2565937..fbf296c 100644 --- a/src/MakkahCity.java +++ b/src/MakkahCity.java @@ -79,60 +79,60 @@ public class MakkahCity { } private static void makeStreets(){ - stdStreet[StreetNames.KA_STREET] = new Street(22700,3); - stdStreet[StreetNames.FOURTH_HIGHWAY] = new Street(24600,4); - stdStreet[StreetNames.KUDAY] = new Street(22000,3); - stdStreet[StreetNames.STREET1] = new Street(4000,2); - stdStreet[StreetNames.STREET2] = new Street(7000,2); - stdStreet[StreetNames.STREET3] = new Street(400,2); - stdStreet[StreetNames.STREET4] = new Street(8200,2); - stdStreet[StreetNames.IBRAHIM_ALKHALIL] = new Street(100,2); //TODO: [7]Change numbers + stdStreet[StreetNames.KA_STREET.ordinal()] = new Street(22700,3); + stdStreet[StreetNames.FOURTH_HIGHWAY.ordinal()] = new Street(24600,4); + stdStreet[StreetNames.KUDAY.ordinal()] = new Street(22000,3); + stdStreet[StreetNames.STREET1.ordinal()] = new Street(4000,2); + stdStreet[StreetNames.STREET2.ordinal()] = new Street(7000,2); + stdStreet[StreetNames.STREET3.ordinal()] = new Street(400,2); + stdStreet[StreetNames.STREET4.ordinal()] = new Street(8200,2); + stdStreet[StreetNames.IBRAHIM_ALKHALIL.ordinal()] = new Street(100,2); //TODO: [7]Change numbers } private static void makeRoutes() { - stdRoutes[RouteName.mashierToAlHijra1] = new Route( + stdRoutes[RouteName.mashierToAlHijra1.ordinal()] = new Route( new Street[]{ - stdStreet[StreetNames.STREET1], - stdStreet[StreetNames.STREET2], - stdStreet[StreetNames.KUDAY]}, + stdStreet[StreetNames.STREET1.ordinal()], + stdStreet[StreetNames.STREET2.ordinal()], + stdStreet[StreetNames.KUDAY.ordinal()]}, District.ALHIJRA, Mashier.ARAFAT); - stdRoutes[RouteName.mashierToAlHijra2] = new Route(new Street[]{ - stdStreet[StreetNames.STREET1], - stdStreet[StreetNames.FOURTH_HIGHWAY], - stdStreet[StreetNames.STREET4] + stdRoutes[RouteName.mashierToAlHijra2.ordinal()] = new Route(new Street[]{ + stdStreet[StreetNames.STREET1.ordinal()], + stdStreet[StreetNames.FOURTH_HIGHWAY.ordinal()], + stdStreet[StreetNames.STREET4.ordinal()] },District.ALHIJRA, Mashier.ARAFAT); - stdRoutes[RouteName.mashierToAlMansoor1] = new Route( + stdRoutes[RouteName.mashierToAlMansoor1.ordinal()] = new Route( new Street[]{ - stdStreet[StreetNames.STREET1], - stdStreet[StreetNames.STREET2], - stdStreet[StreetNames.KA_STREET], - stdStreet[StreetNames.STREET3] + stdStreet[StreetNames.STREET1.ordinal()], + stdStreet[StreetNames.STREET2.ordinal()], + stdStreet[StreetNames.KA_STREET.ordinal()], + stdStreet[StreetNames.STREET3.ordinal()] },District.ALMANSOOR, Mashier.ARAFAT); - stdRoutes[RouteName.mashierToAlMansoor2] = new Route( + stdRoutes[RouteName.mashierToAlMansoor2.ordinal()] = new Route( new Street[]{ - stdStreet[StreetNames.STREET1], - stdStreet[StreetNames.STREET2], - stdStreet[StreetNames.KUDAY], - stdStreet[StreetNames.IBRAHIM_ALKHALIL]//TODO: [8]is actually half of ibrahim khalil. + stdStreet[StreetNames.STREET1.ordinal()], + stdStreet[StreetNames.STREET2.ordinal()], + stdStreet[StreetNames.KUDAY.ordinal()], + stdStreet[StreetNames.IBRAHIM_ALKHALIL.ordinal()]//TODO: [8]is actually half of ibrahim khalil. },District.ALMANSOOR, Mashier.ARAFAT); //Optimal for Almansoor - stdRoutes[RouteName.mashierToAlMansoor3] = new Route( + stdRoutes[RouteName.mashierToAlMansoor3.ordinal()] = new Route( new Street[]{ - stdStreet[StreetNames.STREET1], - stdStreet[StreetNames.FOURTH_HIGHWAY], - stdStreet[StreetNames.IBRAHIM_ALKHALIL] + stdStreet[StreetNames.STREET1.ordinal()], + stdStreet[StreetNames.FOURTH_HIGHWAY.ordinal()], + stdStreet[StreetNames.IBRAHIM_ALKHALIL.ordinal()] },District.ALMANSOOR, Mashier.ARAFAT); - stdRoutes[RouteName.mashierToAlAzizi1] = new Route( + stdRoutes[RouteName.mashierToAlAzizi1.ordinal()] = new Route( new Street[]{ - stdStreet[StreetNames.STREET1], - stdStreet[StreetNames.STREET2], - stdStreet[StreetNames.KA_STREET] + stdStreet[StreetNames.STREET1.ordinal()], + stdStreet[StreetNames.STREET2.ordinal()], + stdStreet[StreetNames.KA_STREET.ordinal()] },District.ALAZIZIYA, Mashier.ARAFAT); } diff --git a/src/RouteName.java b/src/RouteName.java index 7d91e26..cdb7fa0 100644 --- a/src/RouteName.java +++ b/src/RouteName.java @@ -1,10 +1,10 @@ -public class RouteName { - public static final int mashierToAlMansoor1 = 0; - public static final int mashierToAlMansoor2 = 1; - public static final int mashierToAlMansoor3 = 2; - public static final int mashierToAlHijra1 = 3; - public static final int mashierToAlHijra2 = 4; - public static final int mashierToAlAzizi1 = 5; +public enum RouteName { + mashierToAlMansoor1, + mashierToAlMansoor2 , + mashierToAlMansoor3, + mashierToAlHijra1, + mashierToAlHijra2, + mashierToAlAzizi1 } diff --git a/src/StreetNames.java b/src/StreetNames.java index 067a227..0a1ae9f 100644 --- a/src/StreetNames.java +++ b/src/StreetNames.java @@ -1,15 +1,15 @@ /** * Street names with their corresponding indices in MakkahCity. */ -public class StreetNames { +public enum StreetNames { - public static final int KA_STREET = 0; - public static final int KUDAY = 1; - public static final int FOURTH_HIGHWAY = 2; - public static final int STREET1 = 3; - public static final int STREET2 = 4; - public static final int STREET3 = 5; - public static final int STREET4 = 6; - public static final int IBRAHIM_ALKHALIL = 7; + KA_STREET, + KUDAY, + FOURTH_HIGHWAY, + STREET1, + STREET2, + STREET3, + STREET4, + IBRAHIM_ALKHALIL }