forked from opentripplanner/OpenTripPlanner
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add advanced new york fares engine. (#20)
* first attempt to implement NYC fare rules (fixed fare, zone-to-zone, transfers, peak hours) * update code comment * bug fix and add more testing data (NYCT & MTABC) * return fares for all fare types and include fares in each leg
- Loading branch information
1 parent
631b8ca
commit f371eec
Showing
10 changed files
with
732 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/main/java/org/opentripplanner/routing/core/FareBundle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* This program is free software: you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public License | ||
as published by the Free Software Foundation, either version 3 of | ||
the License, or (at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
|
||
package org.opentripplanner.routing.core; | ||
|
||
import org.opentripplanner.routing.core.Fare; | ||
import org.opentripplanner.routing.core.Fare.FareType; | ||
import java.util.Map; | ||
|
||
/** | ||
* A fare bundle is a combination of total fare and each leg's fare | ||
*/ | ||
public class FareBundle { | ||
public Fare fare; | ||
public Map<String, Fare> legFares; // a map of leg identifier and its fare | ||
|
||
public FareBundle( Fare fare, Map<String, Fare> legFares) { | ||
this.fare = fare; | ||
this.legFares = legFares; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,6 +49,8 @@ class Ride { | |
|
||
AgencyAndId route; | ||
|
||
int routeType; | ||
|
||
AgencyAndId trip; | ||
|
||
Set<String> zones; | ||
|
35 changes: 35 additions & 0 deletions
35
src/main/java/org/opentripplanner/routing/impl/NycAdvancedFareServiceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* This program is free software: you can redistribute it and/or | ||
modify it under the terms of the GNU Lesser General Public License | ||
as published by the Free Software Foundation, either version 3 of | ||
the License, or (props, at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
|
||
package org.opentripplanner.routing.impl; | ||
|
||
import org.onebusaway.gtfs.services.GtfsRelationalDao; | ||
import org.opentripplanner.routing.services.FareService; | ||
import org.opentripplanner.routing.services.FareServiceFactory; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
public class NycAdvancedFareServiceFactory implements FareServiceFactory { | ||
|
||
public FareService makeFareService() { | ||
return new NycAdvancedFareServiceImpl(); | ||
} | ||
|
||
@Override | ||
public void processGtfs(GtfsRelationalDao dao) { | ||
} | ||
|
||
@Override | ||
public void configure(JsonNode config) { | ||
} | ||
} |
Oops, something went wrong.