Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
119cba8
docs(readme): update README.md
Dec 9, 2020
24f45e1
docs(readme): update README.md
Dec 9, 2020
20e82b6
chore(repository): change the path
Dec 10, 2020
d421f29
docs(readme): update README.md
Dec 10, 2020
19c2718
feat(subway): print the main screen
Dec 10, 2020
f68fa8d
feat(station-service): initialize subway stations
Dec 10, 2020
fa3c867
feat(line-service): initialize subway lines
Dec 10, 2020
b81f3a8
Merge branch 'main' into da-nyee
Dec 10, 2020
c413082
docs(readme): update README.md
Dec 10, 2020
38b451e
feat(subway): print the screens
Dec 10, 2020
9c77e8c
feat(controller): initialize stations, lines
Dec 11, 2020
ca5fc3a
feat(subway): scan a main input
Dec 11, 2020
0dd6a66
refactor(subway): rename enums
Dec 11, 2020
3864bbf
refactor(subway-controller): rename a function
Dec 11, 2020
9229eea
feat(subway): scan a station input
Dec 11, 2020
021f28d
feat(subway): scan a line input
Dec 11, 2020
b7070bd
feat(subway): scan a section input
Dec 11, 2020
fc47eb8
docs(readme): update README.md
Dec 11, 2020
a2267b1
refactor(subway): remove the code duplication
Dec 11, 2020
431bc65
refactor(subway): modify the code structure
Dec 11, 2020
8fac47e
style(feature): change the function arrangement
Dec 11, 2020
6220ddd
Update README.md
gracefulBrown Dec 12, 2020
ea8bf8c
style(subway): change the new line position
Dec 12, 2020
da0ed6f
refactor(subway): modify the code structure
Dec 12, 2020
6c86c02
refactor(subway): modify the code structure
Dec 12, 2020
9c907ef
feat(station-service): add a station
Dec 12, 2020
d815763
style(subway): separate the class
Dec 12, 2020
c19dc39
refactor(subway): change the return type
Dec 12, 2020
3280e26
refactor(subway-service): modify the function
Dec 12, 2020
d7238b7
feat(station-service): throw an exception
Dec 12, 2020
4f5bd25
style(subway): change the input function
Dec 12, 2020
4f43b79
refactor(subway): change the return type
Dec 12, 2020
78f0c73
feat(transit-map): organize the skeleton
Dec 12, 2020
bae5a69
fix(transit-map): modify the skeleton
Dec 12, 2020
dd12abc
feat(transit-map-service): initialize transit maps
Dec 12, 2020
23a271a
refactor(transit-map): change the data type
Dec 12, 2020
c7bbf1e
style(subway): separate each class
Dec 12, 2020
d278a4b
feat(transit-map): show the transit map
Dec 12, 2020
349b146
docs(readme): update README.md
Dec 12, 2020
2c59a08
docs(readme): update README.md
Dec 13, 2020
b0fcd87
feat(station-service): throw an exception
Dec 13, 2020
d95d6ef
refactor(station-service): throw an exception
Dec 13, 2020
c42913a
style(validation): rename the interface
Dec 13, 2020
c5f7e8e
refactor(station): modify the code structure
Dec 13, 2020
4ce2865
style(station): delete unused import statements
Dec 13, 2020
d88318a
feat(station-service): delete a station
Dec 13, 2020
eb6b7c1
docs(readme): update README.md
Dec 13, 2020
ffb25e5
style(validation): rename the interface, class
Dec 13, 2020
b71879d
refactor(subway): rename functions, classes
Dec 13, 2020
8e49bf8
feat(station-service): throw an exception
Dec 13, 2020
46733e5
feat(station-service): throw an exception
Dec 13, 2020
9bded62
refactor(subway): change the inheritance structure
Dec 13, 2020
8b1e506
feat(feature-interface): organize the skeleton
Dec 13, 2020
34fc22f
style(subway): delete unused import statements
Dec 13, 2020
ba49d47
style(transit-map): modify the function structure
Dec 13, 2020
e6b5dcd
style(station): change the package structure
Dec 13, 2020
b354a89
feat(station-service): show the station name
Dec 13, 2020
c0262eb
fix(station-service): show the station name
Dec 13, 2020
3d58d4c
refactor(station): modify the function
Dec 13, 2020
b20b6da
refactor(transit-map): modify the function
Dec 13, 2020
ca460ad
style(station): delete unused import statements
Dec 13, 2020
1a30448
refactor(station): rename classes
Dec 13, 2020
16e8b5a
feat(line-service): add a line
Dec 13, 2020
4fe0077
feat(line-service): organize the skeleton
Dec 13, 2020
ce3eb71
docs(readme): update README.md
Dec 13, 2020
f65b4e0
feat(line-service): scan up and down station names
Dec 13, 2020
a8493d6
style(subway): add a new line
Dec 13, 2020
0dab703
docs(readme): update README.md
Dec 13, 2020
b421b15
feat(line-service): delete a line
Dec 13, 2020
4cfd145
feat(line-service): show the line name
Dec 13, 2020
3277f94
style(subway): modify the code format
Dec 13, 2020
37776ce
fix(line-service): delete a line
Dec 13, 2020
82b212f
style(section): change the function position
Dec 13, 2020
1d5cc9f
feat(section-service): organize the skeleton
Dec 13, 2020
500f257
docs(readme): update README.md
Dec 14, 2020
d7297e1
refactor(subway): rename functions, classes
Dec 14, 2020
9cccaf5
style(feature): change the function position
Dec 14, 2020
96a555d
feat(section-service): scan names
Dec 14, 2020
839f690
feat(section-service): throw an exception
Dec 14, 2020
88fb0aa
style(section): change the function position
Dec 14, 2020
3d0fe2d
feat(section-service): throw an exception
Dec 14, 2020
4d0fea3
refactor(section): modify the code structure
Dec 14, 2020
23d1d4a
refactor(subway): rename classes
Dec 14, 2020
f103dd7
feat(section-service): add a section
Dec 14, 2020
c96cdf1
refactor(subway): rename classes
Dec 14, 2020
cce5262
docs(readme): update README.md
Dec 14, 2020
a605393
refactor(section-service): modify the skeleton
Dec 14, 2020
0f94530
feat(section-service): delete a section
Dec 14, 2020
384ae1d
feat(section-service): delete a section
Dec 14, 2020
04aa0c6
Merge branch 'da-nyee' of https://github.com/da-nyee/java-subway-map-…
Dec 14, 2020
416013a
feat(section-service): delete a section
Dec 14, 2020
645ea28
docs(readme): update README.md
Dec 14, 2020
5357161
refactor(subway): follow Java Code Conventions
Dec 14, 2020
608045e
docs(readme): update README.md
Dec 14, 2020
9a94457
docs(readme): update README.md
Dec 14, 2020
01e0b67
refactor(subway): follow the feedback
Dec 15, 2020
02d098c
refactor(subway): follow Java Code Conventions
Dec 15, 2020
f981bd8
docs(readme): update README.md
Dec 15, 2020
a71a258
docs(subway): follow Javadoc
Dec 15, 2020
40cca96
docs(readme): update README.md
Dec 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
362 changes: 362 additions & 0 deletions docs/README.md

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions src/main/java/subway/Application.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
package subway;

import subway.controller.SubwayController;

import java.util.Scanner;

/**
* Application.java : 메인 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class Application {
public static void main(String[] args) {
final Scanner scanner = new Scanner(System.in);
// TODO: 프로그램 구현
SubwayController subwayController = new SubwayController();
subwayController.runSubway(scanner);
}
}
18 changes: 18 additions & 0 deletions src/main/java/subway/controller/LineController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package subway.controller;

import subway.service.line.LineService;

import java.util.Scanner;

/**
* LineController.java : 지하철 노선에 대한 컨트롤러 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class LineController {
public static void startLine(Scanner scanner) {
LineService lineService = new LineService();
lineService.manage(scanner);
}
}
18 changes: 18 additions & 0 deletions src/main/java/subway/controller/SectionController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package subway.controller;

import subway.service.section.SectionService;

import java.util.Scanner;

/**
* SectionController.java : 지하철 구간에 대한 컨트롤러 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class SectionController {
public static void startSection(Scanner scanner) {
SectionService sectionService = new SectionService();
sectionService.manage(scanner);
}
}
18 changes: 18 additions & 0 deletions src/main/java/subway/controller/StationController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package subway.controller;

import subway.service.station.StationService;

import java.util.Scanner;

/**
* StationController.java : 지하철 역에 대한 컨트롤러 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class StationController {
public static void startStation(Scanner scanner) {
StationService stationService = new StationService();
stationService.manage(scanner);
}
}
32 changes: 32 additions & 0 deletions src/main/java/subway/controller/SubwayController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package subway.controller;

import subway.service.subway.SubwayService;
import subway.service.initialization.LineInitialization;
import subway.service.initialization.StationInitialization;
import subway.service.initialization.TransitMapInitialization;

import java.util.Scanner;

/**
* SubwayController.java : 지하철에 대한 컨트롤러 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class SubwayController {
public void runSubway(Scanner scanner) {
initializeSubway();
startSubway(scanner);
}

public static void initializeSubway() {
StationInitialization.initializeStations();
LineInitialization.initializeLines();
TransitMapInitialization.initializeTransitMaps();
}

public static void startSubway(Scanner scanner) {
SubwayService subwayService = new SubwayService();
subwayService.manage(scanner);
}
}
15 changes: 15 additions & 0 deletions src/main/java/subway/controller/TransitMapController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package subway.controller;

import subway.service.transitmap.TransitMapService;

/**
* TransitMapController.java : 지하철 노선도에 대한 컨트롤러 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class TransitMapController {
public static void startTransitMap() {
TransitMapService.showTransitMap();
}
}
6 changes: 6 additions & 0 deletions src/main/java/subway/domain/Line.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package subway.domain;

/**
* Line.java : 지하철 노선에 대한 도메인 모델 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class Line {
private String name;

Expand Down
31 changes: 31 additions & 0 deletions src/main/java/subway/domain/Section.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package subway.domain;

/**
* Section.java : 지하철 구간에 대한 도메인 모델 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class Section {
private final String lineName;
private final String stationName;
private final String order;

public Section(String lineName, String stationName, String order) {
this.lineName = lineName;
this.stationName = stationName;
this.order = order;
}

public String getLineName() {
return lineName;
}

public String getStationName() {
return stationName;
}

public String getOrder() {
return order;
}
}
6 changes: 6 additions & 0 deletions src/main/java/subway/domain/Station.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
package subway.domain;

/**
* Station.java : 지하철 역에 대한 도메인 모델 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class Station {
private String name;

Expand Down
25 changes: 25 additions & 0 deletions src/main/java/subway/domain/Stations.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package subway.domain;

/**
* Stations.java : 지하철 상행 종점역, 하행 종점역에 대한 도메인 모델 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class Stations {
private final String upStationName;
private final String downStationName;

public Stations(String upStationName, String downStationName) {
this.upStationName = upStationName;
this.downStationName = downStationName;
}

public String getUpStationName() {
return upStationName;
}

public String getDownStationName() {
return downStationName;
}
}
27 changes: 27 additions & 0 deletions src/main/java/subway/domain/TransitMap.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package subway.domain;

import java.util.LinkedList;

/**
* TransitMap.java : 지하철 노선도에 대한 도메인 모델 클래스
*
* @author Daeun lee
* @version 1.0
*/
public class TransitMap {
private Line transitMapLine;
private LinkedList<Station> transitMapStations;

public TransitMap(Line transitMapLine, LinkedList<Station> transitMapStations) {
this.transitMapLine = transitMapLine;
this.transitMapStations = transitMapStations;
}

public Line getTransitMapLine() {
return transitMapLine;
}

public LinkedList<Station> getTransitMapStations() {
return transitMapStations;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
package subway.domain;
package subway.repository;

import subway.domain.Line;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
* LineRepository.java : 지하철 노선에 대한 저장소 클래스
*/
public class LineRepository {
private static final List<Line> lines = new ArrayList<>();

Expand All @@ -19,4 +24,13 @@ public static void addLine(Line line) {
public static boolean deleteLineByName(String name) {
return lines.removeIf(line -> Objects.equals(line.getName(), name));
}

public static List<String> lineNames() {
List<String> lineNames = new ArrayList<>();

for (Line line : lines) {
lineNames.add(line.getName());
}
return lineNames;
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
package subway.domain;
package subway.repository;

import subway.domain.Station;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;

/**
* StationRepository.java : 지하철 역에 대한 저장소 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class StationRepository {
private static final List<Station> stations = new ArrayList<>();

Expand All @@ -19,4 +27,13 @@ public static void addStation(Station station) {
public static boolean deleteStation(String name) {
return stations.removeIf(station -> Objects.equals(station.getName(), name));
}

public static List<String> stationNames() {
List<String> stationNames = new ArrayList<>();

for (Station station : stations) {
stationNames.add(station.getName());
}
return stationNames;
}
}
78 changes: 78 additions & 0 deletions src/main/java/subway/repository/TransitMapRepository.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package subway.repository;

import subway.domain.Line;
import subway.domain.Station;
import subway.domain.TransitMap;

import java.util.*;

/**
* TransitMapRepository.java : 지하철 노선도에 대한 저장소 클래스
*
* @author Daeun Lee
* @version 1.0
*/
public class TransitMapRepository {
private static final Map<Line, LinkedList<Station>> transitMaps = new LinkedHashMap<>();

public static Map<Line, LinkedList<Station>> transitMaps() {
return Collections.unmodifiableMap(transitMaps);
}

public static void addTransitMap(TransitMap transitMap) {
transitMaps.put(transitMap.getTransitMapLine(), transitMap.getTransitMapStations());
}

public static void deleteTransitMap(Line line) {
transitMaps.remove(line);
}

public static List<String> transitMapsLineNames() {
List<String> transitMapsLineNames = new ArrayList<>();

for (Map.Entry<Line, LinkedList<Station>> entry : transitMaps.entrySet()) {
Line key = entry.getKey();
transitMapsLineNames.add(key.getName());
}
return transitMapsLineNames;
}

public static List<LinkedList<String>> transitMapsStationNames() {
List<LinkedList<String>> transitMapsStationNames = new ArrayList<>();

for (Map.Entry<Line, LinkedList<Station>> entry : transitMaps.entrySet()) {
LinkedList<String> transitMapStationNames = new LinkedList<>();
LinkedList<Station> values = entry.getValue();

for (Station value : values) {
transitMapStationNames.add(value.getName());
}
transitMapsStationNames.add(transitMapStationNames);
}
return transitMapsStationNames;
}

public static List<String> transitMapStations(String lineName) {
List<String> transitMapStations = new ArrayList<>();

for (Map.Entry<Line, LinkedList<Station>> entry : transitMaps.entrySet()) {
Line key = entry.getKey();
String keyName = key.getName();
LinkedList<Station> values = entry.getValue();

if (keyName.equals(lineName)) {
transitMapStations = getTransitMapStations(values);
}
}
return transitMapStations;
}

public static List<String> getTransitMapStations(LinkedList<Station> values) {
List<String> transitMapStations = new ArrayList<>();

for (Station value : values) {
transitMapStations.add(value.getName());
}
return transitMapStations;
}
}
Loading