-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: lines 캐싱전략 shortestPath로 이동
업데이트 시 캐싱 초기화 확인완료
- Loading branch information
Showing
7 changed files
with
24 additions
and
36 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
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
14 changes: 12 additions & 2 deletions
14
src/main/java/wooteco/subway/path/domain/strategy/shortestpath/ShortestPathStrategy.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 |
---|---|---|
@@ -1,12 +1,22 @@ | ||
package wooteco.subway.path.domain.strategy.shortestpath; | ||
|
||
import org.jgrapht.GraphPath; | ||
import org.jgrapht.graph.DefaultWeightedEdge; | ||
import wooteco.subway.line.domain.Line; | ||
import wooteco.subway.station.domain.Station; | ||
|
||
import java.util.List; | ||
|
||
public abstract class ShortestPathStrategy { | ||
public abstract List<Station> getVertexList(List<Line> lines, Station source, Station target); | ||
public List<Station> getVertexList(List<Line> lines, Station source, Station target) { | ||
GraphPath<Station, DefaultWeightedEdge> graphPath = graphPath(lines, source, target); | ||
return graphPath.getVertexList(); | ||
} | ||
|
||
public abstract int getWeight(List<Line> lines, Station source, Station target); | ||
public int getWeight(List<Line> lines, Station source, Station target) { | ||
GraphPath<Station, DefaultWeightedEdge> graphPath = graphPath(lines, source, target); | ||
return (int) graphPath.getWeight(); | ||
} | ||
|
||
public abstract GraphPath<Station, DefaultWeightedEdge> graphPath(List<Line> lines, Station source, Station target); | ||
} |