-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d918c4e
commit 3ce18cc
Showing
9 changed files
with
78 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package org.opentripplanner.client.model; | ||
|
||
public record Agency(String name) {} |
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,3 @@ | ||
package org.opentripplanner.client.model; | ||
|
||
public record Currency(int digits, String code) {} |
18 changes: 18 additions & 0 deletions
18
src/main/java/org/opentripplanner/client/model/FareProductUse.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,18 @@ | ||
package org.opentripplanner.client.model; | ||
|
||
import jakarta.annotation.Nullable; | ||
|
||
public record FareProductUse(String id, FareProduct product) { | ||
|
||
public record FareProduct( | ||
String id, | ||
String name, | ||
Money price, | ||
@Nullable FareProduct.RiderCategory riderCategory, | ||
@Nullable FareProduct.FareMedium medium) { | ||
|
||
public record RiderCategory(String id, String name) {} | ||
|
||
public record FareMedium(String id, String name) {} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/org/opentripplanner/client/model/Itinerary.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,20 @@ | ||
package org.opentripplanner.client.model; | ||
|
||
import java.util.List; | ||
|
||
public record Itinerary(List<Leg> legs) { | ||
|
||
/** | ||
* Does this itinerary contain any legs that contain public transport? | ||
*/ | ||
public boolean hasTransit() { | ||
return legs.stream().anyMatch(Leg::isTransit); | ||
} | ||
|
||
/** | ||
* @return All legs that are using public transport. | ||
*/ | ||
public List<Leg> transitLegs() { | ||
return legs.stream().filter(Leg::isTransit).toList(); | ||
} | ||
} |
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,25 @@ | ||
package org.opentripplanner.client.model; | ||
|
||
import java.time.Duration; | ||
import java.time.OffsetDateTime; | ||
import java.util.List; | ||
import org.opentripplanner.client.model.TripPlan.Place; | ||
|
||
public record Leg( | ||
Place from, | ||
Place to, | ||
OffsetDateTime startTime, | ||
OffsetDateTime endTime, | ||
LegMode mode, | ||
Duration duration, | ||
double distance, | ||
Route route, | ||
List<FareProductUse> fareProducts) { | ||
|
||
/** | ||
* Is this leg using public transport? | ||
*/ | ||
public boolean isTransit() { | ||
return mode.isTransit(); | ||
} | ||
} |
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,5 @@ | ||
package org.opentripplanner.client.model; | ||
|
||
import java.math.BigDecimal; | ||
|
||
public record Money(BigDecimal amount, Currency currency) {} |
57 changes: 0 additions & 57 deletions
57
src/main/java/org/opentripplanner/client/model/TripPlan.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
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 |
---|---|---|
|
@@ -2,5 +2,8 @@ query { | |
routes { | ||
shortName | ||
mode | ||
agency { | ||
name | ||
} | ||
} | ||
} |
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