-
Notifications
You must be signed in to change notification settings - Fork 1k
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
628bf95
commit 4248ffe
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...on/src/main/java/org/opentripplanner/apis/transmodel/mapping/RelativeDirectionMapper.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,33 @@ | ||
package org.opentripplanner.apis.transmodel.mapping; | ||
|
||
import org.opentripplanner.model.plan.RelativeDirection; | ||
|
||
/** | ||
* This mapper makes sure that only those values are returned which have a mapping in the Transmodel API, | ||
* as we don't really want to return all of them. | ||
*/ | ||
public class RelativeDirectionMapper { | ||
|
||
public static RelativeDirection map(RelativeDirection relativeDirection) { | ||
return switch (relativeDirection) { | ||
case DEPART, | ||
SLIGHTLY_LEFT, | ||
HARD_LEFT, | ||
LEFT, | ||
CONTINUE, | ||
SLIGHTLY_RIGHT, | ||
RIGHT, | ||
HARD_RIGHT, | ||
CIRCLE_CLOCKWISE, | ||
CIRCLE_COUNTERCLOCKWISE, | ||
ELEVATOR, | ||
UTURN_LEFT, | ||
UTURN_RIGHT -> relativeDirection; | ||
// for these the Transmodel API doesn't have a mapping. should it? | ||
case ENTER_STATION, | ||
EXIT_STATION, | ||
ENTER_OR_EXIT_STATION, | ||
FOLLOW_SIGNS -> RelativeDirection.CONTINUE; | ||
}; | ||
} | ||
} |
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