diff --git a/README.md b/README.md
index bb0c84ebb..3e1fea825 100644
--- a/README.md
+++ b/README.md
@@ -3,251 +3,47 @@
-## ๐ ๊ธฐ๋ฅ ์๊ตฌ์ฌํญ
-
-> ํ๋ฆฌ์ฝ์ค 3์ฃผ์ฐจ ๋ฏธ์
์์ ์ฌ์ฉํ ์ฝ๋๋ฅผ ์ฐธ๊ณ ํด๋ ๋ฌด๊ดํ๋ค.
-
-### ์ด๊ธฐ ์ค์
-- ํ๋ก๊ทธ๋จ ์์ ์ ์ญ, ๋
ธ์ , ๊ตฌ๊ฐ ์ ๋ณด๋ฅผ ์ด๊ธฐ ์ค์ ํด์ผ ํ๋ค.
-- ๊ฑฐ๋ฆฌ์ ์์ ์๊ฐ์ ์์ ์ ์์ด๋ฉฐ ๋จ์๋ km์ ๋ถ์ ์๋ฏธํ๋ค.
-- ์๋์ ์ฌ์ ๋ฑ๋ก ์ ๋ณด๋ก ๋ฐ๋์ ์ด๊ธฐ ์ค์ ์ ํ๋ค.
-
-```
- 1. ์งํ์ฒ ์ญ์ผ๋ก ๊ต๋์ญ, ๊ฐ๋จ์ญ, ์ญ์ผ์ญ, ๋จ๋ถํฐ๋ฏธ๋์ญ, ์์ฌ์ญ, ์์ฌ์๋ฏผ์์ฒ์ญ, ๋งค๋ด์ญ์ด ๋ฑ๋ก๋์ด ์๋ค.
- 2. ์งํ์ฒ ๋
ธ์ ์ผ๋ก 2ํธ์ , 3ํธ์ , ์ ๋ถ๋น์ ์ด ๋ฑ๋ก๋์ด ์๋ค.
- 3. ๋
ธ์ ์ ์ญ์ด ์๋์ ๊ฐ์ด ๋ฑ๋ก๋์ด ์๋ค.(์ผ์ชฝ ๋์ด ์ํ ์ข
์ )
- - 2ํธ์ : ๊ต๋์ญ - ( 2km / 3๋ถ ) - ๊ฐ๋จ์ญ - ( 2km / 3๋ถ ) - ์ญ์ผ์ญ
- - 3ํธ์ : ๊ต๋์ญ - ( 3km / 2๋ถ ) - ๋จ๋ถํฐ๋ฏธ๋์ญ - ( 6km / 5๋ถ ) - ์์ฌ์ญ - ( 1km / 1๋ถ ) - ๋งค๋ด์ญ
- - ์ ๋ถ๋น์ : ๊ฐ๋จ์ญ - ( 2km / 8๋ถ ) - ์์ฌ์ญ - ( 10km / 3๋ถ ) - ์์ฌ์๋ฏผ์์ฒ์ญ
- ```
-
-### ๊ฒฝ๋ก ์กฐํ ๊ธฐ๋ฅ
-- ์ถ๋ฐ์ญ๊ณผ ๋์ฐฉ์ญ์ ์
๋ ฅ๋ฐ์ ๊ฒฝ๋ก๋ฅผ ์กฐํํ๋ค.
-- ๊ฒฝ๋ก ์กฐํ ์ ์ด ๊ฑฐ๋ฆฌ, ์ด ์์ ์๊ฐ๋ ํจ๊ป ์ถ๋ ฅํ๋ค.
-- ๊ฒฝ๋ก ์กฐํ ๊ธฐ์ค์ `์ต๋จ ๊ฑฐ๋ฆฌ` `์ต์ ์๊ฐ`์ด ์๋ค.
-
-### ์์ธ ์ฒ๋ฆฌ
-- ๊ฒฝ๋ก ์กฐํ ์ ์ถ๋ฐ์ญ๊ณผ ๋์ฐฉ์ญ์ด ๊ฐ์ผ๋ฉด ์๋ฌ๋ฅผ ์ถ๋ ฅํ๋ค.
-- ๊ฒฝ๋ก ์กฐํ ์ ์ถ๋ฐ์ญ๊ณผ ๋์ฐฉ์ญ์ด ์ฐ๊ฒฐ๋์ด ์์ง ์์ผ๋ฉด ์๋ฌ๋ฅผ ์ถ๋ ฅํ๋ค.
-- ๊ทธ ์ธ ์ ์์ ์ผ๋ก ํ๋ก๊ทธ๋จ์ด ์ํ๋์ง ์์ ๊ฒฝ์ฐ ์๋ฌ๋ฅผ ์ถ๋ ฅํ๋ค.
-
-
-
-## โ๐ป ์
์ถ๋ ฅ ์๊ตฌ์ฌํญ
-- `ํ๋ก๊ทธ๋๋ฐ ์คํ ๊ฒฐ๊ณผ ์์`์ ๋์ผํ๊ฒ ์
์ถ๋ ฅ์ ๊ตฌํํ๋ค.
-- ๊ธฐ๋ํ๋ ์ถ๋ ฅ ๊ฒฐ๊ณผ๋ `[INFO]`๋ฅผ ๋ถ์ฌ์ ์ถ๋ ฅํ๋ค. ์ถ๋ ฅ๊ฐ์ ํ์์ ์์์ ๋์ผํ๊ฒ ํ๋ค.
-- ์๋ฌ ๋ฐ์ ์ `[ERROR]`๋ฅผ ๋ถ์ฌ์ ์ถ๋ ฅํ๋ค. ์๋ฌ์ ๋ฌธ๊ตฌ๋ ์์ ๋กญ๊ฒ ์์ฑํ๋ค.
-
-### ๐ป ํ๋ก๊ทธ๋๋ฐ ์คํ ๊ฒฐ๊ณผ ์์
-#### ๊ฒฝ๋ก ์กฐํ
-```
-## ๋ฉ์ธ ํ๋ฉด
-1. ๊ฒฝ๋ก ์กฐํ
-Q. ์ข
๋ฃ
-
-## ์ํ๋ ๊ธฐ๋ฅ์ ์ ํํ์ธ์.
-1
-
-## ๊ฒฝ๋ก ๊ธฐ์ค
-1. ์ต๋จ ๊ฑฐ๋ฆฌ
-2. ์ต์ ์๊ฐ
-B. ๋์๊ฐ๊ธฐ
-
-## ์ํ๋ ๊ธฐ๋ฅ์ ์ ํํ์ธ์.
-1
-
-## ์ถ๋ฐ์ญ์ ์
๋ ฅํ์ธ์.
-๊ต๋์ญ
-
-## ๋์ฐฉ์ญ์ ์
๋ ฅํ์ธ์.
-์์ฌ์ญ
-
-## ์กฐํ ๊ฒฐ๊ณผ
-[INFO] ---
-[INFO] ์ด ๊ฑฐ๋ฆฌ: 4km
-[INFO] ์ด ์์ ์๊ฐ: 11๋ถ
-[INFO] ---
-[INFO] ๊ต๋์ญ
-[INFO] ๊ฐ๋จ์ญ
-[INFO] ์์ฌ์ญ
-
-## ๋ฉ์ธ ํ๋ฉด
-1. ๊ฒฝ๋ก ์กฐํ
-Q. ์ข
๋ฃ
-
-...
-```
-
-#### ์๋ฌ ์ถ๋ ฅ ์์
-
-```
-## ๋ฉ์ธ ํ๋ฉด
-1. ๊ฒฝ๋ก ์กฐํ
-Q. ์ข
๋ฃ
-
-## ์ํ๋ ๊ธฐ๋ฅ์ ์ ํํ์ธ์.
-1
-
-## ๊ฒฝ๋ก ๊ธฐ์ค
-1. ์ต๋จ ๊ฑฐ๋ฆฌ
-2. ์ต์ ์๊ฐ
-B. ๋์๊ฐ๊ธฐ
-
-## ์ํ๋ ๊ธฐ๋ฅ์ ์ ํํ์ธ์.
-1
-
-## ์ถ๋ฐ์ญ์ ์
๋ ฅํ์ธ์.
-๊ฐ๋จ์ญ
-
-## ๋์ฐฉ์ญ์ ์
๋ ฅํ์ธ์.
-๊ฐ๋จ์ญ
-
-[ERROR] ์ถ๋ฐ์ญ๊ณผ ๋์ฐฉ์ญ์ด ๋์ผํฉ๋๋ค.
-
-## ๊ฒฝ๋ก ๊ธฐ์ค
-1. ์ต๋จ ๊ฑฐ๋ฆฌ
-2. ์ต์ ์๊ฐ
-B. ๋์๊ฐ๊ธฐ
-
-## ์ํ๋ ๊ธฐ๋ฅ์ ์ ํํ์ธ์.
-
-...
-
-```
-
-
-
-## ๐ฑ ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ์ฌํญ
-- ์๋ฐ ์ฝ๋ ์ปจ๋ฒค์
์ ์งํค๋ฉด์ ํ๋ก๊ทธ๋๋ฐํ๋ค.
- - ๊ธฐ๋ณธ์ ์ผ๋ก [Google Java Style Guide](https://google.github.io/styleguide/javaguide.html)์ ์์น์ผ๋ก ํ๋ค.
- - ๋จ, ๋ค์ฌ์ฐ๊ธฐ๋ '2 spaces'๊ฐ ์๋ '4 spaces'๋ก ํ๋ค.
-- indent(์ธ๋ดํธ, ๋ค์ฌ์ฐ๊ธฐ) depth๋ฅผ 3์ด ๋์ง ์๋๋ก ๊ตฌํํ๋ค. 2๊น์ง๋ง ํ์ฉํ๋ค.
- - ์๋ฅผ ๋ค์ด while๋ฌธ ์์ if๋ฌธ์ด ์์ผ๋ฉด ๋ค์ฌ์ฐ๊ธฐ๋ 2์ด๋ค.
- - ํํธ: indent(์ธ๋ดํธ, ๋ค์ฌ์ฐ๊ธฐ) depth๋ฅผ ์ค์ด๋ ์ข์ ๋ฐฉ๋ฒ์ ํจ์(๋๋ ๋ฉ์๋)๋ฅผ ๋ถ๋ฆฌํ๋ฉด ๋๋ค.
-- 3ํญ ์ฐ์ฐ์๋ฅผ ์ฐ์ง ์๋๋ค.
-- ํจ์(๋๋ ๋ฉ์๋)์ ๊ธธ์ด๊ฐ 15๋ผ์ธ์ ๋์ด๊ฐ์ง ์๋๋ก ๊ตฌํํ๋ค.
- - ํจ์(๋๋ ๋ฉ์๋)๊ฐ ํ ๊ฐ์ง ์ผ๋ง ์ ํ๋๋ก ๊ตฌํํ๋ค.
-- else ์์ฝ์ด๋ฅผ ์ฐ์ง ์๋๋ค.
- - ํํธ: if ์กฐ๊ฑด์ ์์ ๊ฐ์ returnํ๋ ๋ฐฉ์์ผ๋ก ๊ตฌํํ๋ฉด else๋ฅผ ์ฌ์ฉํ์ง ์์๋ ๋๋ค.
- - else๋ฅผ ์ฐ์ง ๋ง๋ผ๊ณ ํ๋ switch/case๋ก ๊ตฌํํ๋ ๊ฒฝ์ฐ๊ฐ ์๋๋ฐ switch/case๋ ํ์ฉํ์ง ์๋๋ค.
-- ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ์ฌํญ์์ ๋ณ๋๋ก ๋ณ๊ฒฝ ๋ถ๊ฐ ์๋ด๊ฐ ์๋ ๊ฒฝ์ฐ ํ์ผ ์์ ๊ณผ ํจํค์ง ์ด๋์ ์์ ๋กญ๊ฒ ํ ์ ์๋ค.
-- ์์ธ ์ํฉ ์ ์๋ฌ ๋ฌธ๊ตฌ๋ฅผ ์ถ๋ ฅํด์ผ ํ๋ค. ๋จ, ์๋ฌ ๋ฌธ๊ตฌ๋ `[ERROR]` ๋ก ์์ํด์ผ ํ๋ค.
-
-### ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ์ฌํญ - Application
-- Application ํด๋์ค๋ฅผ ํ์ฉํด ๊ตฌํํด์ผ ํ๋ค.
-- Application์ ํจํค์ง ๊ตฌ์กฐ๋ ๋ณ๊ฒฝํ์ง ์๋๋ค.
-- Application ํด๋์ค์ ์๋ Scanner๋ฅผ ์ฌ์ฉํ๊ณ ๋ณ๋์ Scanner ๊ฐ์ฒด๋ฅผ ๋ง๋ค์ง ์๋๋ค.
-```java
-public class Application {
- public static void main(String[] args) {
- final Scanner scanner = new Scanner(System.in);
- ...
- }
-}
-```
-
-### ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ์ฌํญ - Station, Line
-- Station, Line ํด๋์ค๋ฅผ ํ์ฉํ์ฌ ์งํ์ฒ ์ญ๊ณผ ๋
ธ์ ์ ๊ตฌํํด์ผ ํ๋ค.
-- ์ ๊ณตํ๋ ๊ฐ ํด๋์ค์ ๊ธฐ๋ณธ ์์ฑ์๋ฅผ ์ถ๊ฐํ ์ ์๋ค.
-- ํ๋(์ธ์คํด์ค ๋ณ์)์ธ name์ ์ ๊ทผ ์ ์ด์ private์ ๋ณ๊ฒฝํ ์ ์๋ค.
-- ๊ฐ๋ฅํ๋ฉด setter ๋ฉ์๋(ex. setXXX)๋ฅผ ์ถ๊ฐํ์ง ์๊ณ ๊ตฌํํ๋ค.
-
-```java
-public class Station {
- private String name;
-
- public Station(String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- // ์ถ๊ฐ ๊ธฐ๋ฅ ๊ตฌํ
-}
-
-```
-
-### ํ๋ก๊ทธ๋๋ฐ ์๊ตฌ์ฌํญ - StationRepository, LineRepository
-- Station๊ณผ Line์ ์ํ๋ฅผ ์ ์ฅํ ์ ์๋ StationRepository, LineRepository๋ฅผ ์ ๊ณตํ๋ค.
-- ํ์ ์ StationRepository, LineRepository ์ด ์ธ ์ถ๊ฐ๋ก Repository๋ฅผ ๋ง๋ค ์ ์๋ค.
-- ์ถ๊ฐ๋ก ์์ฑ๋๋ ๊ฐ์ฒด์ ๋ํด์ XXXRepository ๋ค์ด๋ฐ์ผ๋ก ์ ์ฅ ํด๋์ค๋ฅผ ์ถ๊ฐํ๋ค.
-- ๊ฐ์ฒด๋ค์ ์ํ๋ฅผ ๊ด๋ฆฌํ๊ธฐ ์ํด์ XXXRepository ํด๋์ค๋ฅผ ํ์ฉํด ์ ์ฅ ๋ก์ง์ ๊ตฌํํด์ผ ํ๋ค.
-- ์์ฑ๋ ๋ฉ์๋๋ ์์ ํ ์ ์๊ณ , ํ์์ ๋ฐ๋ผ ๋ฉ์๋๋ฅผ ์์ ๋กญ๊ฒ ์ถ๊ฐํ ์ ์๋ค.
-
-```java
-public class StationRepository {
- private static final List stations = new ArrayList<>();
-
- public static List stations() {
- return Collections.unmodifiableList(stations);
- }
-
- public static void addStation(Station station) {
- stations.add(station);
- }
-
- public static boolean deleteStation(String name) {
- return stations.removeIf(station -> Objects.equals(station.getName(), name));
- }
-
- public static void deleteAll() {
- stations.clear();
- }
-}
-```
-
-
-
-## โ๏ธํํธ
-### ์ต๋จ ๊ฒฝ๋ก ๋ผ์ด๋ธ๋ฌ๋ฆฌ
-- jgrapht ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ํ์ฉํ๋ฉด ๊ฐํธํ๊ฒ ์ต๋จ๊ฑฐ๋ฆฌ๋ฅผ ์กฐํํ ์ ์์
-- Dijkstra ์๊ณ ๋ฆฌ์ฆ์ ๋ฐ๋์ ์ดํดํ ํ์๋ ์๊ณ ๋ฏธ์
์ ์ ์ฉํ ์ ๋๋ก๋ง ์ดํดํ๋ฉด ๋จ
-- JGraphtTest ํด๋์ค์ ํ
์คํธ๋ฅผ ํ์ฉํ์ฌ ๋ฏธ์
์ ํ์ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๊ธฐ๋ฅ์ ํ์ตํ ์ ์์
-- ์ ์ (vertex)๊ณผ ๊ฐ์ (edge), ๊ทธ๋ฆฌ๊ณ ๊ฐ์ค์น ๊ฐ๋
์ ์ด์ฉ
- - ์ ์ : ์งํ์ฒ ์ญ
- - ๊ฐ์ : ์งํ์ฒ ์ญ ์ฐ๊ฒฐ์ ๋ณด
- - ๊ฐ์ค์น: ๊ฑฐ๋ฆฌ or ์์ ์๊ฐ
-- ์ต๋จ ๊ฑฐ๋ฆฌ ๊ธฐ์ค ์กฐํ ์ ๊ฐ์ค์น๋ฅผ ๊ฑฐ๋ฆฌ๋ก ์ค์
-
-```java
-@Test
-public void getDijkstraShortestPath() {
- WeightedMultigraph graph
- = new WeightedMultigraph(DefaultWeightedEdge.class);
- graph.addVertex("v1");
- graph.addVertex("v2");
- graph.addVertex("v3");
- graph.setEdgeWeight(graph.addEdge("v1", "v2"), 2);
- graph.setEdgeWeight(graph.addEdge("v2", "v3"), 2);
- graph.setEdgeWeight(graph.addEdge("v1", "v3"), 100);
-
- DijkstraShortestPath dijkstraShortestPath = new DijkstraShortestPath(graph);
- List shortestPath = dijkstraShortestPath.getPath("v3", "v1").getVertexList();
-
- assertThat(shortestPath.size()).isEqualTo(3);
-}
-```
-
-#### ํ
์คํธ ์ค๋ช
-
-
-
-- ์ญ ์ฌ์ด์ ๊ฑฐ๋ฆฌ๋ฅผ ๊ณ ๋ คํ์ง ์๋ ๊ฒฝ์ฐ V1->V3 ๊ฒฝ๋ก๊ฐ ์ต๋จ ๊ฒฝ๋ก
-- ์ญ ์ฌ์ด์ ๊ฑฐ๋ฆฌ๋ฅผ ๊ณ ๋ คํ ๊ฒฝ์ฐ V1->V3 ๊ฒฝ๋ก์ ๊ฑฐ๋ฆฌ๋ 100km, V1->V2->V3 ๊ฒฝ๋ก์ ๊ฑฐ๋ฆฌ๋ 4km์ด๋ฏ๋ก ์ต๋จ ๊ฒฝ๋ก๋ V1->V2->V3
-
-
-
-## ๐ ์งํ ์๊ตฌ์ฌํญ
-- ๋ฏธ์
์ [java-subway-path-precourse ์ ์ฅ์](https://github.com/woowacourse/java-subway-path-precourse) ๋ฅผ fork/cloneํด ์์ํ๋ค.
-- ๊ธฐ๋ฅ์ ๊ตฌํํ๊ธฐ ์ ์ java-subway-path-precourse/docs/README.md ํ์ผ์ ๊ตฌํํ ๊ธฐ๋ฅ ๋ชฉ๋ก์ ์ ๋ฆฌํด ์ถ๊ฐํ๋ค.
-- git์ commit ๋จ์๋ ์ ๋จ๊ณ์์ README.md ํ์ผ์ ์ ๋ฆฌํ ๊ธฐ๋ฅ ๋ชฉ๋ก ๋จ์๋ก ์ถ๊ฐํ๋ค.
- - [AngularJS Commit Message Conventions](https://gist.github.com/stephenparish/9941e89d80e2bc58a153) ์ฐธ๊ณ ํด commit log๋ฅผ ๋จ๊ธด๋ค.
-- [ํ๋ฆฌ์ฝ์ค ๊ณผ์ ์ ์ถ ๋ฌธ์](https://github.com/woowacourse/woowacourse-docs/tree/master/precourse) ์ ์ฐจ๋ฅผ ๋ฐ๋ผ ๋ฏธ์
์ ์ ์ถํ๋ค.
- - [ํ๋ฆฌ์ฝ์ค ๊ณผ์ FAQ](https://github.com/woowacourse/woowacourse-docs/tree/master/precourse/faq) ๋ฌธ์๋ฅผ ์ฐธ๊ณ ํ์ฌ ์งํํ ์ ์๋ค.
-
-
-## ๐ License
-
-This project is [MIT](https://github.com/woowacourse/java-subway-path-precourse/blob/master/LICENSE.md) licensed.
+## ๊ธฐ๋ณธ ์ค์
+- ์ญ, ๋
ธ์ , ๊ตฌ๊ฐ์ ๋ณด๋ฅผ ์ด๊ธฐ์ค์ ํ๋ค.
+- ๊ตฌ๊ฐ์ `๋
ธ์ `, `์ํ์ชฝ์ญ`, `ํํ์ชฝ์ญ`, `๊ฑฐ๋ฆฌ`, `์๊ฐ` ์ผ๋ก ์ด๋ฃจ์ด์ ธ ์๋ค.
+```
+1. ์งํ์ฒ ์ญ์ผ๋ก ๊ต๋์ญ, ๊ฐ๋จ์ญ, ์ญ์ผ์ญ, ๋จ๋ถํฐ๋ฏธ๋์ญ, ์์ฌ์ญ, ์์ฌ์๋ฏผ์์ฒ์ญ, ๋งค๋ด์ญ์ด ๋ฑ๋ก๋์ด ์๋ค.
+2. ์งํ์ฒ ๋
ธ์ ์ผ๋ก 2ํธ์ , 3ํธ์ , ์ ๋ถ๋น์ ์ด ๋ฑ๋ก๋์ด ์๋ค.
+3. ๋
ธ์ ์ ์ญ์ด ์๋์ ๊ฐ์ด ๋ฑ๋ก๋์ด ์๋ค.(์ผ์ชฝ ๋์ด ์ํ ์ข
์ )
+ - 2ํธ์ : ๊ต๋์ญ - ( 2km / 3๋ถ ) - ๊ฐ๋จ์ญ - ( 2km / 3๋ถ ) - ์ญ์ผ์ญ
+ - 3ํธ์ : ๊ต๋์ญ - ( 3km / 2๋ถ ) - ๋จ๋ถํฐ๋ฏธ๋์ญ - ( 6km / 5๋ถ ) - ์์ฌ์ญ - ( 1km / 1๋ถ ) - ๋งค๋ด์ญ
+ - ์ ๋ถ๋น์ : ๊ฐ๋จ์ญ - ( 2km / 8๋ถ ) - ์์ฌ์ญ - ( 10km / 3๋ถ ) - ์์ฌ์๋ฏผ์์ฒ์ญ
+```
+
+## ๊ตฌํ ๊ธฐ๋ฅ ๋ชฉ๋ก
+- ์ด๊ธฐ ์ค์ ์ ์ํด ์ญ, ๋
ธ์ , ๊ตฌ๊ฐ ์ ๋ณด๋ฅผ ์ถ๊ฐํ ์ ์์ด์ผ ํ๋ค.
+- ๋ฉ์ธ ํ๋ฉด์์ ๋ฉ๋ด๋ฅผ ์ถ๋ ฅํ๋ค.
+- ๋ฉ์ธ ํ๋ฉด์์ ๊ฒฝ๋ก ์กฐํ์ ์ข
๋ฃ์ค ์
๋ ฅ์ ๋ฐ๋๋ค. (1: ๊ฒฝ๋ก์กฐํ, Q: ์ข
๋ฃ)
+- ๊ฒฝ๋ก ๊ธฐ์ค ํ๋ฉด์์ ๋ฉ๋ด๋ฅผ ์ถ๋ ฅํ๋ค.
+- ๊ฒฝ๋ก ๊ธฐ์ค์ ์
๋ ฅ๋ฐ๋๋ค. (1: ์ต๋จ๊ฑฐ๋ฆฌ, 2: ์ต์์๊ฐ)
+- ๊ฒฝ๋ก๋ฅผ ์กฐํํ๋ค.
+ - ์ถ๋ฐ์ญ์ ์
๋ ฅ๋ฐ๋๋ค.
+ - ๋์ฐฉ์ญ์ ์
๋ ฅ๋ฐ๋๋ค.
+ - (๊ฒฝ๋ก ๊ธฐ์ค) ์ถ๋ฐ์ญ์์ ๋์ฐฉ์ญ๊น์ง์ ๊ฐ ์ ์๋ ์ต๋จ ๊ฑฐ๋ฆฌ์ธ ๊ฒฝ๋ก๋ฅผ ๊ณ์ฐํ๋ค.
+ - (์๊ฐ ๊ธฐ์ค) ์ถ๋ฐ์ญ์์ ๋์ฐฉ์ญ๊น์ง์ ์ด ์์์๊ฐ์ด ๊ฐ์ฅ ์งง์ ๊ฒฝ๋ก๋ฅผ ๊ณ์ฐํ๋ค.
+ - ์ฐพ์๋ธ ๊ฒฝ๋ก์ ๊ฑฐ๋ฆฌ์ ์์์๊ฐ์ ์ถ๋ ฅํ๋ค.
+- ์ข
๋ฃํ๋ค.
+
+`์์ธ์ฒ๋ฆฌ`
+- ๋ฉ์ธํ๋ฉด๊ณผ ๊ฒฝ๋ก๊ธฐ์ค ์
๋ ฅํ๋ฉด์์ ์ ํด์ง ํค์๋๊ฐ ์๋ ์
๋ ฅ์ ๋ชจ๋ ์์ธ์ฒ๋ฆฌ
+- ๊ฒฝ๋ก์กฐํ์ ์ถ๋ฐ์ญ๊ณผ ๋์ฐฉ์ญ์ด ๊ฐ์ ๊ฒฝ์ฐ
+- ์ถ๋ฐ์ญ๊ณผ ๋์ฐฉ์ญ์ด ์ฐ๊ฒฐ๋์ด ์์ง ์์ ๊ฒฝ์ฐ
+
+## ๊ฐ์ฒด
+- ํ๋ฉด ๊ด๋ฆฌ ๊ฐ์ฒด
+- ๋ฉ์ธ ํ๋ฉด
+- ๊ฒฝ๋ก ๊ธฐ์ค ์ ํ ํ๋ฉด
+- ๊ธฐ๋ฅ ํ๋ฉด
+- ์ถ๋ ฅ
+- ์
๋ ฅ
+- ์ญ
+- ์ญ ๋ ํฌ์งํ ๋ฆฌ
+- ๋
ธ์
+- ๋
ธ์ ๋ ํฌ์งํ ๋ฆฌ
+- ๊ตฌ๊ฐ
+- ๊ตฌ๊ฐ ๋ ํฌ์งํ ๋ฆฌ
diff --git a/gradlew b/gradlew
index 2fe81a7d9..9b9244cd2 100755
--- a/gradlew
+++ b/gradlew
@@ -34,7 +34,7 @@ while [ -h "$PRG" ] ; do
else
PRG=`dirname "$PRG"`"/$link"
fi
-done
+GO_BACK
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
@@ -137,7 +137,7 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
- done
+ GO_BACK
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
@@ -155,7 +155,7 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
- done
+ GO_BACK
case $i in
0) set -- ;;
1) set -- "$args0" ;;
@@ -172,7 +172,7 @@ fi
# Escape application args
save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; GO_BACK
echo " "
}
APP_ARGS=`save "$@"`
diff --git a/src/main/java/subway/Application.java b/src/main/java/subway/Application.java
index 0bcf786cc..4a06e12fb 100644
--- a/src/main/java/subway/Application.java
+++ b/src/main/java/subway/Application.java
@@ -1,10 +1,54 @@
package subway;
+import subway.domain.*;
+import subway.screen.MainScreen;
+import subway.screen.ScreenManager;
+import subway.screen.ScreenModel;
+
+import java.util.Arrays;
+import java.util.List;
import java.util.Scanner;
public class Application {
public static void main(String[] args) {
final Scanner scanner = new Scanner(System.in);
- // TODO: ํ๋ก๊ทธ๋จ ๊ตฌํ
+ initialize();
+ ScreenManager.addNextMenuScreen(new MainScreen(scanner));
+
+ while (!ScreenManager.isEmpty()) {
+ try {
+ ScreenModel nextScreen = ScreenManager.pop();
+ ScreenManager.show(nextScreen);
+ } catch (IllegalArgumentException e) {
+ System.out.println(e.getMessage());
+ ScreenManager.addNextMenuScreen(new MainScreen(scanner));
+ }
+ }
+ }
+
+ private static void initialize() {
+ List stations = Arrays.asList(new Station("๊ต๋์ญ"), new Station("๊ฐ๋จ์ญ")
+ , new Station("์ญ์ผ์ญ"), new Station("๋จ๋ถํฐ๋ฏธ๋์ญ"), new Station("์์ฌ์ญ")
+ , new Station("์์ฌ์๋ฏผ์์ฒ์ญ"), new Station("๋งค๋ด์ญ"));
+ stations.stream().forEach(station -> StationRepository.addStation(station));
+
+ List lines = Arrays.asList(new Line("2ํธ์ ").addTerminus("๊ต๋์ญ", "์ญ์ผ์ญ")
+ , new Line("3ํธ์ ").addTerminus("๊ต๋์ญ", "๋งค๋ด์ญ")
+ , new Line("์ ๋ถ๋น์ ").addTerminus("๊ฐ๋จ์ญ", "์์ฌ์๋ฏผ์์ฒ์ญ"));
+ lines.stream().forEach(line -> LineRepository.addLine(line));
+
+ SectionRepository.addSection("2ํธ์ ", "๊ฐ๋จ์ญ", 1);
+ SectionRepository.addSection("3ํธ์ ", "๋จ๋ถํฐ๋ฏธ๋์ญ", 1);
+ SectionRepository.addSection("3ํธ์ ", "์์ฌ์ญ", 2);
+ SectionRepository.addSection("์ ๋ถ๋น์ ", "์์ฌ์ญ", 1);
+
+ SectionRepository.addSectinonDistanceAndTime("๊ต๋์ญ", "๊ฐ๋จ์ญ", 2, 3);
+ SectionRepository.addSectinonDistanceAndTime("๊ฐ๋จ์ญ", "์ญ์ผ์ญ", 2, 3);
+ SectionRepository.addSectinonDistanceAndTime("๊ต๋์ญ", "๋จ๋ถํฐ๋ฏธ๋์ญ", 3, 2);
+ SectionRepository.addSectinonDistanceAndTime("๋จ๋ถํฐ๋ฏธ๋์ญ", "์์ฌ์ญ", 6, 5);
+ SectionRepository.addSectinonDistanceAndTime("์์ฌ์ญ", "๋งค๋ด์ญ", 1, 1);
+ SectionRepository.addSectinonDistanceAndTime("๊ฐ๋จ์ญ", "์์ฌ์ญ", 2, 8);
+ SectionRepository.addSectinonDistanceAndTime("์์ฌ์ญ", "์์ฌ์๋ฏผ์์ฒ์ญ", 10, 3);
+
}
}
diff --git a/src/main/java/subway/Menu/Menu.java b/src/main/java/subway/Menu/Menu.java
new file mode 100644
index 000000000..05467cdbc
--- /dev/null
+++ b/src/main/java/subway/Menu/Menu.java
@@ -0,0 +1,46 @@
+package subway.Menu;
+
+public class Menu {
+ public enum Main {
+ ROUTE_INQUIRY("1", "๊ฒฝ๋ก์กฐํ"),
+ QUIT("Q", "์ข
๋ฃ");
+
+ private String code;
+ private String korean;
+
+ Main(String code, String korean) {
+ this.code = code;
+ this.korean = korean;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getKorean() {
+ return korean;
+ }
+ }
+
+ public enum ROUTE_CRITERIA {
+ SHORTEST_DISTANCE("1", "์ต๋จ ๊ฑฐ๋ฆฌ"),
+ SHORTEST_TIME("2", "์ต์ ์๊ฐ"),
+ BACK("B", "๋์๊ฐ๊ธฐ");
+
+ private String code;
+ private String korean;
+
+ ROUTE_CRITERIA(String code, String korean) {
+ this.code = code;
+ this.korean = korean;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getKorean() {
+ return korean;
+ }
+ }
+}
diff --git a/src/main/java/subway/PathResult.java b/src/main/java/subway/PathResult.java
new file mode 100644
index 000000000..fa40092b0
--- /dev/null
+++ b/src/main/java/subway/PathResult.java
@@ -0,0 +1,27 @@
+package subway;
+
+import java.util.List;
+
+public class PathResult {
+ List shortestPath;
+ int distance;
+ int requiredTime;
+
+ public PathResult(List shortestPath, int distance, int requiredTime) {
+ this.shortestPath = shortestPath;
+ this.distance = distance;
+ this.requiredTime = requiredTime;
+ }
+
+ public List getShortestPath() {
+ return shortestPath;
+ }
+
+ public int getDistance() {
+ return distance;
+ }
+
+ public int getRequiredTime() {
+ return requiredTime;
+ }
+}
diff --git a/src/main/java/subway/domain/Line.java b/src/main/java/subway/domain/Line.java
index f4d738d5a..3c2ef9771 100644
--- a/src/main/java/subway/domain/Line.java
+++ b/src/main/java/subway/domain/Line.java
@@ -1,6 +1,9 @@
package subway.domain;
+import java.util.LinkedList;
+
public class Line {
+ private static LinkedList line = new LinkedList<>();
private String name;
public Line(String name) {
@@ -11,5 +14,13 @@ public String getName() {
return name;
}
- // ์ถ๊ฐ ๊ธฐ๋ฅ ๊ตฌํ
+ public void addSection(int sequence, Station station) {
+ line.add(sequence, station);
+ }
+
+ public Line addTerminus(String upBoundTerminus, String downBoundTerminus) {
+ line.addFirst(StationRepository.findStation(upBoundTerminus));
+ line.addLast(StationRepository.findStation(downBoundTerminus));
+ return this;
+ }
}
diff --git a/src/main/java/subway/domain/LineRepository.java b/src/main/java/subway/domain/LineRepository.java
index 2c4a723c9..69bfd17cc 100644
--- a/src/main/java/subway/domain/LineRepository.java
+++ b/src/main/java/subway/domain/LineRepository.java
@@ -23,4 +23,10 @@ public static boolean deleteLineByName(String name) {
public static void deleteAll() {
lines.clear();
}
+
+ public static Line findLine(String name) {
+ return lines.stream()
+ .filter(line -> line.getName().equals(name))
+ .findFirst().orElseThrow(() -> new IllegalArgumentException("[ERROR] ์กด์ฌํ์ง ์๋ ๋
ธ์ "));
+ }
}
diff --git a/src/main/java/subway/domain/Section.java b/src/main/java/subway/domain/Section.java
new file mode 100644
index 000000000..aed82e2f8
--- /dev/null
+++ b/src/main/java/subway/domain/Section.java
@@ -0,0 +1,40 @@
+package subway.domain;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+public class Section {
+
+ private Set stations = new HashSet<>();
+ private int distance;
+ private int requiredTime;
+
+ public Section(String station1, String station2, int distance, int requiredTime) {
+ stations.add(station1);
+ stations.add(station2);
+ this.distance = distance;
+ this.requiredTime = requiredTime;
+ }
+
+ public boolean isInShortestPath(List shortestPath) {
+ for(int i=0; i getStations() {
+ return stations;
+ }
+
+ public int getDistance() {
+ return distance;
+ }
+
+ public int getRequiredTime() {
+ return requiredTime;
+ }
+}
diff --git a/src/main/java/subway/domain/SectionRepository.java b/src/main/java/subway/domain/SectionRepository.java
new file mode 100644
index 000000000..0417a1d08
--- /dev/null
+++ b/src/main/java/subway/domain/SectionRepository.java
@@ -0,0 +1,94 @@
+package subway.domain;
+
+import org.jgrapht.GraphPath;
+import org.jgrapht.alg.shortestpath.DijkstraShortestPath;
+import org.jgrapht.graph.DefaultWeightedEdge;
+import org.jgrapht.graph.WeightedMultigraph;
+import subway.Menu.Menu;
+import subway.PathResult;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SectionRepository {
+
+ static WeightedMultigraph graphByDistance = new WeightedMultigraph(DefaultWeightedEdge.class);
+ static WeightedMultigraph graphByCost = new WeightedMultigraph(DefaultWeightedEdge.class);
+ static List sections = new ArrayList<>();
+
+ public static void addSection(String lineName, String stationName, int sequence) {
+ Line line = LineRepository.findLine(lineName);
+ Station station = StationRepository.findStation(stationName);
+ line.addSection(sequence, station);
+ }
+
+ public static void addSectinonDistanceAndTime(String station1, String station2, int distance, int requiredTime) {
+ addVertex(station1, station2);
+ setEdgeWeight(station1, station2, distance, requiredTime);
+ sections.add(new Section(station1, station2, distance, requiredTime));
+ }
+
+ private static void setEdgeWeight(String station1, String station2, int distance, int requiredTime) {
+ graphByDistance.setEdgeWeight(graphByDistance.addEdge(station1, station2), distance);
+ graphByCost.setEdgeWeight(graphByCost.addEdge(station1, station2), requiredTime);
+ }
+
+ public static PathResult findshortestPath(String input, String departure, String destination) {
+ validateDepartureAndDestination(departure, destination);
+
+ WeightedMultigraph graph = null;
+ if (input.equals(Menu.ROUTE_CRITERIA.SHORTEST_DISTANCE.getCode())) {
+ graph = graphByDistance;
+ }
+ if (input.equals(Menu.ROUTE_CRITERIA.SHORTEST_TIME.getCode())) {
+ graph = graphByCost;
+ }
+ List shortestPath = getShortestPath(graph, departure, destination);
+
+ return new PathResult(shortestPath, calculateDistance(shortestPath), calculateRequiredTime(shortestPath));
+ }
+
+ public static List getShortestPath(WeightedMultigraph graph, String departure, String destination) {
+ DijkstraShortestPath dijkstraShortestPath = new DijkstraShortestPath(graph);
+ GraphPath graphPath = dijkstraShortestPath.getPath(departure, destination);
+ return graphPath.getVertexList();
+
+ }
+
+ private static void validateDepartureAndDestination(String departure, String destination) {
+ StationRepository.findStation(departure);
+ StationRepository.deleteStation(destination);
+ if (departure.equals(destination)) {
+ throw new IllegalArgumentException("[ERROR] ์ถ๋ฐ์ญ๊ณผ ๋์ฐฉ์ญ์ด ๊ฐ์ต๋๋ค.");
+ }
+ }
+
+ private static int calculateRequiredTime(List shortestPath) {
+ return sections.stream()
+ .filter(section -> section.isInShortestPath(shortestPath))
+ .mapToInt(Section::getRequiredTime)
+ .sum();
+ }
+
+ private static int calculateDistance(List shortestPath) {
+ return sections.stream()
+ .filter(section -> section.isInShortestPath(shortestPath))
+ .mapToInt(Section::getDistance)
+ .sum();
+ }
+
+ private static void addVertex(String station1, String station2) {
+ if (!graphByDistance.containsVertex(station1)) {
+ graphByDistance.addVertex(station1);
+ }
+ if (!graphByDistance.containsVertex(station2)) {
+ graphByDistance.addVertex(station2);
+ }
+ if (!graphByCost.containsVertex(station1)) {
+ graphByCost.addVertex(station1);
+ }
+ if (!graphByCost.containsVertex(station2)) {
+ graphByCost.addVertex(station2);
+ }
+ }
+}
diff --git a/src/main/java/subway/domain/StationRepository.java b/src/main/java/subway/domain/StationRepository.java
index 8ed9d103f..a475e9e85 100644
--- a/src/main/java/subway/domain/StationRepository.java
+++ b/src/main/java/subway/domain/StationRepository.java
@@ -23,4 +23,10 @@ public static boolean deleteStation(String name) {
public static void deleteAll() {
stations.clear();
}
+
+ public static Station findStation(String name) {
+ return stations.stream()
+ .filter(station -> station.getName().equals(name))
+ .findFirst().orElseThrow(() -> new IllegalArgumentException(("[ERROR] ์กด์ฌํ์ง ์๋ ์ญ")));
+ }
}
diff --git a/src/main/java/subway/screen/FeatureScreen.java b/src/main/java/subway/screen/FeatureScreen.java
new file mode 100644
index 000000000..fc003f153
--- /dev/null
+++ b/src/main/java/subway/screen/FeatureScreen.java
@@ -0,0 +1,38 @@
+package subway.screen;
+
+import subway.PathResult;
+import subway.view.InputView;
+import subway.view.OutputView;
+
+import java.util.Scanner;
+
+import static subway.domain.SectionRepository.*;
+
+public class FeatureScreen implements ScreenModel {
+
+ private final Scanner scanner;
+ private final String input;
+
+ public FeatureScreen(Scanner scanner, String input) {
+ this.scanner = scanner;
+ this.input = input;
+ }
+
+ @Override
+ public String showScreen() {
+ InputView inputView = new InputView(scanner);
+ String departure = inputView.enterDeparture();
+ String destination = inputView.enterDestination();
+ PathResult pathResult = findshortestPath(input, departure, destination);
+ OutputView.printRouteResult(pathResult);
+
+
+
+ return GO_MAIN;
+ }
+
+ @Override
+ public ScreenModel getNextScreen(String input) {
+ return new MainScreen(scanner);
+ }
+}
diff --git a/src/main/java/subway/screen/MainScreen.java b/src/main/java/subway/screen/MainScreen.java
new file mode 100644
index 000000000..fb7e25466
--- /dev/null
+++ b/src/main/java/subway/screen/MainScreen.java
@@ -0,0 +1,40 @@
+package subway.screen;
+
+import subway.Menu.Menu;
+import subway.view.InputView;
+import subway.view.OutputView;
+
+import java.util.Arrays;
+import java.util.Scanner;
+
+public class MainScreen implements ScreenModel {
+
+ private final Scanner scanner;
+
+ public MainScreen(Scanner scanner) {
+ this.scanner = scanner;
+ }
+
+ @Override
+ public String showScreen() {
+ InputView inputView = new InputView(scanner);
+
+ OutputView.printMainMenu();
+ return inputView.enterFeature();
+ }
+
+ @Override
+ public ScreenModel getNextScreen(String input) {
+ if (anyMatchToMenu(input)){
+ return new SelectCriteriaScreen(scanner);
+ }
+ throw new IllegalArgumentException("[ERROR] ์๋ชป๋ ์
๋ ฅ์
๋๋ค.\n");
+ }
+
+ @Override
+ public boolean anyMatchToMenu(String input) {
+ return Arrays.stream(Menu.Main.values())
+ .anyMatch(menu -> menu.getCode().equals(input));
+ }
+
+}
diff --git a/src/main/java/subway/screen/ScreenManager.java b/src/main/java/subway/screen/ScreenManager.java
new file mode 100644
index 000000000..b7ce74e1a
--- /dev/null
+++ b/src/main/java/subway/screen/ScreenManager.java
@@ -0,0 +1,34 @@
+package subway.screen;
+
+import java.util.Objects;
+import java.util.Stack;
+
+public class ScreenManager {
+ private static Stack screens = new Stack<>();
+
+ public static boolean isEmpty() {
+ if (screens.isEmpty()) {
+ return true;
+ }
+ return false;
+ }
+
+ public static void show(ScreenModel screen) {
+ String result = screen.showScreen();
+ if (result == ScreenModel.GO_BACK) {
+ return;
+ }
+ addNextMenuScreen(screen.getNextScreen(result));
+
+ }
+
+ public static void addNextMenuScreen(ScreenModel nextScreen) {
+ if (!Objects.isNull(nextScreen)) {
+ screens.push(nextScreen);
+ }
+ }
+
+ public static ScreenModel pop() {
+ return screens.pop();
+ }
+}
diff --git a/src/main/java/subway/screen/ScreenModel.java b/src/main/java/subway/screen/ScreenModel.java
new file mode 100644
index 000000000..45a0d35d0
--- /dev/null
+++ b/src/main/java/subway/screen/ScreenModel.java
@@ -0,0 +1,23 @@
+package subway.screen;
+
+import subway.Menu.Menu;
+
+import java.util.Arrays;
+
+public interface ScreenModel {
+ public static final String GO_MAIN = "0";
+ public static final String GO_BACK = "-1";
+ public static final ScreenModel NOTHING = null;
+
+ public default String showScreen() {
+ return GO_BACK;
+ }
+
+ public default ScreenModel getNextScreen(String input) {
+ return NOTHING;
+ }
+
+ public default boolean anyMatchToMenu(String input) {
+ return false;
+ }
+}
diff --git a/src/main/java/subway/screen/SelectCriteriaScreen.java b/src/main/java/subway/screen/SelectCriteriaScreen.java
new file mode 100644
index 000000000..11fe93e36
--- /dev/null
+++ b/src/main/java/subway/screen/SelectCriteriaScreen.java
@@ -0,0 +1,44 @@
+package subway.screen;
+
+import subway.Menu.Menu;
+import subway.view.InputView;
+import subway.view.OutputView;
+
+import java.util.Arrays;
+import java.util.Scanner;
+
+public class SelectCriteriaScreen implements ScreenModel {
+
+ private final Scanner scanner;
+
+ public SelectCriteriaScreen(Scanner scanner) {
+ this.scanner = scanner;
+ }
+
+ @Override
+ public String showScreen() {
+ InputView inputView = new InputView(scanner);
+
+ OutputView.printCriteriaMenu();
+ String input = inputView.enterFeature();
+ if (input.equals(Menu.Main.QUIT)) {
+ return GO_BACK;
+ }
+ return input;
+ }
+
+ @Override
+ public ScreenModel getNextScreen(String input) {
+ if (anyMatchToMenu(input)) {
+ return new FeatureScreen(scanner, input);
+ }
+ throw new IllegalArgumentException("[ERROR] ์๋ชป๋ ์
๋ ฅ์
๋๋ค.\n");
+ }
+
+ @Override
+ public boolean anyMatchToMenu(String input) {
+ return Arrays.stream(Menu.ROUTE_CRITERIA.values())
+ .anyMatch(menu -> menu.getCode().equals(input));
+ }
+
+}
diff --git a/src/main/java/subway/view/InputView.java b/src/main/java/subway/view/InputView.java
new file mode 100644
index 000000000..0ca9b7d96
--- /dev/null
+++ b/src/main/java/subway/view/InputView.java
@@ -0,0 +1,29 @@
+package subway.view;
+
+import java.util.Scanner;
+
+public class InputView {
+
+ private final Scanner scanner;
+
+ public InputView(Scanner scanner) {
+ this.scanner = scanner;
+ }
+
+ public String enterFeature() {
+ System.out.println("## ์ํ๋ ๊ธฐ๋ฅ์ ์ ํํ์ธ์.");
+ return scanner.nextLine();
+ }
+
+ public String enterDeparture() {
+ System.out.println();
+ System.out.println("## ์ถ๋ฐ์ญ์ ์
๋ ฅํ์ธ์.");
+ return scanner.nextLine();
+ }
+
+ public String enterDestination() {
+ System.out.println();
+ System.out.println("## ๋์ฐฉ์ญ์ ์
๋ ฅํ์ธ์.");
+ return scanner.nextLine();
+ }
+}
diff --git a/src/main/java/subway/view/OutputView.java b/src/main/java/subway/view/OutputView.java
new file mode 100644
index 000000000..05167b51a
--- /dev/null
+++ b/src/main/java/subway/view/OutputView.java
@@ -0,0 +1,43 @@
+package subway.view;
+
+import subway.Menu.Menu;
+import subway.PathResult;
+
+import java.util.List;
+
+public class OutputView {
+
+ private static final String newLine = "\n";
+
+ public static void printMainMenu() {
+ String message = "## ๋ฉ์ธ ํ๋ฉด" + newLine;
+ for (Menu.Main menu : Menu.Main.values()) {
+ message += String.format("%s. %s" + newLine, menu.getCode(), menu.getKorean());
+ }
+ System.out.println(message);
+ }
+
+ public static void printCriteriaMenu() {
+ String message = "## ๊ฒฝ๋ก ๊ธฐ์ค" + newLine;
+ for (Menu.ROUTE_CRITERIA menu : Menu.ROUTE_CRITERIA.values()) {
+ message += String.format("%s. %s" + newLine, menu.getCode(), menu.getKorean());
+ }
+ System.out.println(message);
+ }
+
+ public static void printRouteResult(PathResult pathResult) {
+ List shortestPath = pathResult.getShortestPath();
+ int shortestPathDistance = pathResult.getDistance();
+ int requiredTime = pathResult.getRequiredTime();
+
+ System.out.println();
+ System.out.println("## ์กฐํ ๊ฒฐ๊ณผ");
+ System.out.println("[INFO] ---");
+ System.out.println(String.format("[INFO] ์ด ๊ฑฐ๋ฆฌ: %dkm", shortestPathDistance));
+ System.out.println(String.format("[INFO] ์ด ์์์๊ฐ: %d๋ถ", requiredTime));
+ System.out.println("[INFO] ---");
+ shortestPath.stream()
+ .forEach(station -> System.out.println("[INFO] " + station));
+ System.out.println();
+ }
+}