-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Split along responsibilities.
- Loading branch information
Showing
9 changed files
with
69 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package ch.naviqore.raptor.model; | ||
|
||
public class RouteStop { | ||
public record RouteStop() { | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/ch/naviqore/raptor/model/RouteTraversalBuilder.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,39 @@ | ||
package ch.naviqore.raptor.model; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PACKAGE) | ||
public class RouteTraversalBuilder { | ||
|
||
private final Map<String, Integer> routes = new HashMap<>(); | ||
private final Map<String, Integer> stops = new HashMap<>(); | ||
|
||
public static RouteTraversalBuilder builder() { | ||
return new RouteTraversalBuilder(); | ||
} | ||
|
||
public RouteTraversalBuilder addRoute(String id) { | ||
if (routes.containsKey(id)) { | ||
throw new IllegalArgumentException("Route " + id + " already exists"); | ||
} | ||
routes.put(id, routes.size()); | ||
return this; | ||
} | ||
|
||
public RouteTraversalBuilder addStopTime() { | ||
return this; | ||
} | ||
|
||
public RouteTraversalBuilder addRouteStop(String id, String routeid) { | ||
if (routes.containsKey(id)) { | ||
throw new IllegalArgumentException("Route " + id + " already exists"); | ||
} | ||
return this; | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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