-
Notifications
You must be signed in to change notification settings - Fork 491
new #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
honggyuSHIN
wants to merge
1
commit into
woowacourse:main
Choose a base branch
from
honggyuSHIN:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
new #168
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,7 +1,19 @@ | ||
| package pairmatching; | ||
|
|
||
| import pairmatching.controller.CrewController; | ||
| import pairmatching.service.CrewService; | ||
| import pairmatching.service.MissionService; | ||
| import pairmatching.view.InputView; | ||
| import pairmatching.view.OutputView; | ||
|
|
||
| public class Application { | ||
| public static void main(String[] args) { | ||
| // TODO 구현 진행 | ||
| CrewService crewService = new CrewService(); | ||
| MissionService missionService = new MissionService(); | ||
| InputView inputView = new InputView(); | ||
| OutputView outputView = new OutputView(); | ||
| CrewController crewController = new CrewController(crewService,missionService, inputView, outputView); | ||
| crewController.run(); | ||
| } | ||
| } |
This file contains hidden or 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,70 @@ | ||
| package pairmatching.controller; | ||
|
|
||
| import pairmatching.missionModel.Course; | ||
| import pairmatching.missionModel.Level; | ||
| import pairmatching.missionModel.Mission; | ||
| import pairmatching.service.CrewService; | ||
| import pairmatching.service.MissionService; | ||
| import pairmatching.view.InputView; | ||
| import pairmatching.view.OutputView; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public class CrewController { | ||
| private final CrewService crewService; | ||
| private final MissionService missionService; | ||
| private final InputView inputView; | ||
| private final OutputView outputView; | ||
|
|
||
| public CrewController(CrewService crewService, MissionService missionService, InputView inputView, OutputView outputView) { | ||
| this.crewService = crewService; | ||
| this.missionService = missionService; | ||
| this.inputView = inputView; | ||
| this.outputView = outputView; | ||
| } | ||
|
|
||
| public void run() { | ||
| String userChoose = printFunctionChoose(); | ||
|
|
||
| List<Mission> missions = saveMission(); | ||
| setMissions(missions); | ||
| String chooseMission = inputView.printMissions(); | ||
| String[] chooseMissions = chooseMission.split(","); | ||
| Mission userChooseMission = changeToMission(chooseMissions[0],chooseMissions[1],chooseMissions[2]); | ||
| if (userChoose.equals("1")) { | ||
| fairMatching(missions, userChooseMission); | ||
| } | ||
| } | ||
|
|
||
| private Mission changeToMission(String chooseMission, String chooseMission1, String chooseMission2) { | ||
| Course course = Course.valueOf(chooseMission); | ||
| Level level = Level.valueOf(chooseMission1); | ||
| return new Mission(course, level, chooseMission2); | ||
| } | ||
|
|
||
| private void setMissions(List<Mission> missions) { | ||
|
|
||
| } | ||
|
|
||
| private void fairMatching(Mission userChooseMission) { | ||
| crewService.checkPair(userChooseMission); | ||
| } | ||
|
|
||
|
|
||
|
|
||
|
|
||
| public List<Mission> saveMission() { | ||
| return missionService.saveMissions(); | ||
| } | ||
|
|
||
|
|
||
| public String printFunctionChoose() { | ||
| return inputView.printFunctionChoose(); | ||
| } | ||
|
|
||
|
|
||
| public void readCrewFile() { | ||
| List<String> backendCrews = crewService.readBackendCrewFile(); | ||
|
|
||
| } | ||
| } |
This file contains hidden or 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,13 @@ | ||
| package pairmatching.crewModel; | ||
|
|
||
| public class BackendCrew { | ||
| private final String name; | ||
|
|
||
| public BackendCrew(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
| } |
This file contains hidden or 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,13 @@ | ||
| package pairmatching.crewModel; | ||
|
|
||
| public class FrontendCrew { | ||
| private final String name; | ||
|
|
||
| public FrontendCrew(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
| } |
This file contains hidden or 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,19 @@ | ||
| package pairmatching.missionModel; | ||
|
|
||
| public enum Course { | ||
| BACKEND("백엔드"), | ||
| FRONTEND("프론트엔드"), | ||
| ; | ||
|
|
||
| private String name; | ||
|
|
||
| Course(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return this.name; | ||
| } | ||
|
|
||
| // 추가 기능 구현 | ||
| } |
30 changes: 30 additions & 0 deletions
30
src/main/java/pairmatching/missionModel/CrewsPerBackend.java
This file contains hidden or 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,30 @@ | ||
| package pairmatching.missionModel; | ||
|
|
||
| import pairmatching.crewModel.BackendCrew; | ||
| import pairmatching.crewModel.FrontendCrew; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| public class CrewsPerBackend { | ||
| private final Map<Mission, List<BackendCrew>> backendCrewsPerMission; | ||
|
|
||
| public CrewsPerBackend(Map<Mission, List<BackendCrew>> backendCrewsPerMission) { | ||
| this.backendCrewsPerMission = backendCrewsPerMission; | ||
| } | ||
|
|
||
| public CrewsPerBackend() { | ||
| this.backendCrewsPerMission = new HashMap<>(); | ||
| } | ||
|
|
||
| public List<BackendCrew> getBackendCrewsPerMission(Mission mission) { | ||
| return backendCrewsPerMission.getOrDefault(mission, null); | ||
| } | ||
|
|
||
| public void addBackendCrewsPerMission(Mission mission, List<BackendCrew> backendCrews) { | ||
| backendCrewsPerMission.put(mission, backendCrews); | ||
| } | ||
|
|
||
| } | ||
30 changes: 30 additions & 0 deletions
30
src/main/java/pairmatching/missionModel/CrewsPerFrontend.java
This file contains hidden or 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,30 @@ | ||
| package pairmatching.missionModel; | ||
|
|
||
| import pairmatching.crewModel.FrontendCrew; | ||
|
|
||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| public class CrewsPerFrontend { | ||
| private final Map<Mission, List<FrontendCrew>> frontendCrewsPerMission; | ||
|
|
||
| public CrewsPerFrontend(Map<Mission, List<FrontendCrew>> frontendCrewsPerMission) { | ||
| this.frontendCrewsPerMission = frontendCrewsPerMission; | ||
| } | ||
|
|
||
| public CrewsPerFrontend() { | ||
| this.frontendCrewsPerMission = new HashMap<>(); | ||
| } | ||
|
|
||
| public Map<Mission, List<FrontendCrew>> getFrontendCrewsPerMission() { | ||
| return frontendCrewsPerMission; | ||
| } | ||
|
|
||
| public void addFrontendCrewsPerMission(Mission mission, List<FrontendCrew> frontendCrew) { | ||
| frontendCrewsPerMission.put(mission, frontendCrew); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| } |
This file contains hidden or 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,21 @@ | ||
| package pairmatching.missionModel; | ||
|
|
||
| public enum Level { | ||
| LEVEL1("레벨1"), | ||
| LEVEL2("레벨2"), | ||
| LEVEL3("레벨3"), | ||
| LEVEL4("레벨4"), | ||
| LEVEL5("레벨5"); | ||
|
|
||
| private String name; | ||
|
|
||
| Level(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return this.name; | ||
| } | ||
|
|
||
| // 추가 기능 구현 | ||
| } |
This file contains hidden or 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,48 @@ | ||
| package pairmatching.missionModel; | ||
|
|
||
|
|
||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| public class Mission { | ||
| private Course course; | ||
| private Level level; | ||
| private List<String> tasks; | ||
|
|
||
| public Mission(Course course, Level level) { | ||
| this.course = course; | ||
| this.level = level; | ||
| this.tasks = new ArrayList<>(); | ||
| } | ||
|
|
||
| public Mission(Course course, Level level, String task) { | ||
| this.course = course; | ||
| this.level = level; | ||
| this.tasks = new ArrayList<>(); | ||
| this.tasks.add(task); | ||
| } | ||
|
|
||
| public void addTask(String task) { | ||
| tasks.add(task); | ||
| } | ||
|
|
||
| public Course getCourse() { | ||
| return course; | ||
| } | ||
|
|
||
| public Level getLevel() { | ||
| return level; | ||
| } | ||
|
|
||
| public List<String> getTasks() { | ||
| return tasks; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "Course: " + course.getName() + ", Level: " + level.getName() + ", Tasks: " + tasks; | ||
| } | ||
|
|
||
| } | ||
|
|
This file contains hidden or 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,75 @@ | ||
| package pairmatching.service; | ||
|
|
||
| import pairmatching.crewModel.BackendCrew; | ||
| import pairmatching.crewModel.FrontendCrew; | ||
| import pairmatching.missionModel.CrewsPerBackend; | ||
|
|
||
| import pairmatching.missionModel.CrewsPerFrontend; | ||
| import pairmatching.missionModel.Mission; | ||
|
|
||
| import java.nio.file.Files; | ||
| import java.nio.file.Paths; | ||
| import java.util.List; | ||
|
|
||
| public class CrewService { | ||
| List<FrontendCrew> frontendCrews; | ||
| List<BackendCrew> backendCrews; | ||
|
|
||
| public List<String> readFrontendCrewFile() { | ||
| String frontendFilePath = "src/main/resources/frontend-crew.md"; | ||
| List<String> frontendCrewsNames = null; | ||
| try { | ||
| frontendCrewsNames = Files.readAllLines(Paths.get(frontendFilePath)); | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } | ||
| return frontendCrewsNames; | ||
| } | ||
|
|
||
| public List<String> readBackendCrewFile() { | ||
| String backendFilePath = "src/main/resources/backend-crew.md"; | ||
| List<String> backendCrewNames = null; | ||
| try { | ||
| backendCrewNames = Files.readAllLines(Paths.get(backendFilePath)); | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } | ||
| return backendCrewNames; | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 파일 입출력에 관해서 io 계층을 만들고 거기서 파일을 읽고 그걸 컨트롤러에서 사용할 수 있게 구현하는 것도 좋을 것 같숩니다 |
||
|
|
||
| public List<FrontendCrew> saveFrontendCrews(List<String> frontendCrewNames) { | ||
| try { | ||
| for (String crewName : frontendCrewNames) { | ||
| frontendCrews.add(new FrontendCrew(crewName)); | ||
| } | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } | ||
| return frontendCrews; | ||
| } | ||
|
|
||
| public List<BackendCrew> saveBackendCrews(List<String> backendCrewNames) { | ||
| try { | ||
| for (String crewName : backendCrewNames) { | ||
| backendCrews.add(new BackendCrew(crewName)); | ||
| } | ||
| } catch (Exception e) { | ||
| e.printStackTrace(); | ||
| } | ||
| return backendCrews; | ||
| } | ||
|
|
||
| public List<BackendCrew> matchBackendCrew(Mission userMission) { | ||
| if (userMission.getCourse().equals("백엔드")) { | ||
| CrewsPerBackend crewsPerBackend = new CrewsPerBackend(); | ||
| List<BackendCrew> matchCrews = crewsPerBackend.getBackendCrewsPerMission(userMission); | ||
| if (matchCrews != null) { | ||
| return matchCrews; | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| public void checkPair(Mission userChooseMission) { | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이미 BackendCrew라는 클래스를 두어서 백엔드 크루 객체가 그 의미(백 or 프론트)를 표현하고 있어서 CrewsPer~ 계층을 두 개를 두어서 구분할 필요는 없을 것 같다는 생각이 듭니당!