Skip to content

Commit

Permalink
small enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
paulheinr committed Jan 22, 2025
1 parent 688fc63 commit 3d3e30f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public PtFareConfigGroup() {
super(MODULE_NAME);
}

public void addPtFareParameterSet(PtFareParams ptFareParams) {
addParameterSet(ptFareParams);
}

@Override
public Map<String, String> getComments() {
Map<String, String> map = super.getComments();
Expand Down Expand Up @@ -60,14 +64,11 @@ public void setUpperBoundFactor(double upperBoundFactor) {

@Override
public ConfigGroup createParameterSet(final String type) {
switch (type) {
case DistanceBasedPtFareParams.SET_TYPE:
return new DistanceBasedPtFareParams();
case FareZoneBasedPtFareParams.SET_TYPE:
return new FareZoneBasedPtFareParams();
default:
throw new IllegalArgumentException(type);
}
return switch (type) {
case DistanceBasedPtFareParams.SET_TYPE -> new DistanceBasedPtFareParams();
case FareZoneBasedPtFareParams.SET_TYPE -> new FareZoneBasedPtFareParams();
default -> throw new IllegalArgumentException(type);
};
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public abstract class PtFareParams extends ReflectiveConfigGroup {
public static final String DESCRIPTION = "description";

private int order;

//nullable. If null, it will be ignored.
private String fareZoneShp;
private String transactionPartner;
private String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ void testChainedPtFareHandler() {
distanceBased2.setTransactionPartner(DISTANCE_BASED_TRANSACTION_PARTNER);
distanceBased2.setMinFare(7.0);

ptFareConfigGroup.addParameterSet(fareZoneBased);
PtFareParams fareZoneBased1;
ptFareConfigGroup.addPtFareParameterSet(fareZoneBased1);

ptFareConfigGroup.addPtFareParameterSet(fareZoneBased);
ptFareConfigGroup.addParameterSet(distanceBased);
ptFareConfigGroup.addParameterSet(distanceBased2);

Expand Down Expand Up @@ -145,7 +148,8 @@ public void install() {
// rb17 to Regensburg 2nd home location departs at 16:52 (beyond distance fare 1 zone, distance fare 2 applies, 10230.93m)
work2.setEndTime(16 * 3600. + 40 * 60);
Activity work3 = fac.createActivityFromCoord("work", new Coord(726645.48, 5433383.16));
// rb17 to Kelheim home location departs at 18:46, then transfer to bus 6022 (beyond distance fare 1 zone, distance fare 2 applies, 19871.38m)
// rb17 to Kelheim home location departs at 18:46, then transfer to bus 6022 (beyond distance fare 1 zone, distance fare 2 applies, 19871
// .38m)
work3.setEndTime(18 * 3600. + 40 * 60);
Activity home2 = fac.createActivityFromCoord("home", new Coord(710300.624, 5422165.737));

Expand Down

0 comments on commit 3d3e30f

Please sign in to comment.