Skip to content

Commit

Permalink
refactor(path): Path -> Map 클래스명 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
da-nyee committed May 26, 2021
1 parent 451e87d commit d2dbb20
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import wooteco.subway.exception.StationNonexistenceException;
import wooteco.subway.line.dao.LineDao;
import wooteco.subway.path.domain.Lines;
import wooteco.subway.path.domain.Path;
import wooteco.subway.path.domain.Map;
import wooteco.subway.path.dto.PathResponse;
import wooteco.subway.station.dao.StationDao;
import wooteco.subway.station.domain.Station;
Expand All @@ -30,9 +30,9 @@ public PathResponse findShortestPaths(Long sourceStationId, Long targetStationId
Station targetStation = stationDao.findById(targetStationId)
.orElseThrow(StationNonexistenceException::new);

Path path = new Path(new Lines(lineDao.findAll()));
List<Station> stations = path.shortestPath(sourceStation, targetStation);
int distance = path.distance(sourceStation, targetStation);
Map map = new Map(new Lines(lineDao.findAll()));
List<Station> stations = map.shortestPath(sourceStation, targetStation);
int distance = map.distance(sourceStation, targetStation);

return new PathResponse(StationResponse.listOf(stations), distance);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

import java.util.List;

public class Path {
public class Map {
private final DijkstraShortestPath<Station, DefaultWeightedEdge> shortestPath;

public Path(Lines lines) {
public Map(Lines lines) {
this.shortestPath = new DijkstraShortestPath<>(graph(lines));
}

Expand Down

0 comments on commit d2dbb20

Please sign in to comment.