[UNI-100] refactor : 코어 루트 삭제에 따른 조회 로직 수정#36
Conversation
mikekks
left a comment
There was a problem hiding this comment.
고생하셨습니다! 일단 리뷰남긴 곳 제외하고는 이해는 했는데 들여쓰기로 계속 되니 확실히 depth 가 좀 깊긴 하네요,, 이 부분 고민해보겠습니다!
uniro_backend/src/main/java/com/softeer5/uniro_backend/route/service/RouteService.java
Show resolved
Hide resolved
uniro_backend/src/main/java/com/softeer5/uniro_backend/route/service/RouteService.java
Show resolved
Hide resolved
| List<Long> endNodes = adjMap.entrySet() | ||
| .stream() | ||
| .filter(entry -> entry.getValue().size() == 1) // 리스트 크기가 1인 항목 필터링 | ||
| .map(Map.Entry::getKey) | ||
| .collect(Collectors.toList()); | ||
|
|
||
| //끝 노드가 2개인 경우 둘 중 하나에서 출발 | ||
| if(endNodes.size()==2){ | ||
| startNode = nodeMap.get(endNodes.get(0)); | ||
| return List.of(getSingleRoutes(adjMap, startNode)); | ||
| } | ||
|
|
||
| // 그 외의 경우의 수는 모두 사이클만 존재하거나, 규칙에 어긋난 맵 | ||
| throw new InvalidMapException("Invalid Map", ErrorCode.INVALID_MAP); |
| // 코어루트를 이루는 node들을 List로 저장 | ||
| List<RouteCoordinatesInfo> coreRoute = new ArrayList<>(); | ||
| coreRoute.add(RouteCoordinatesInfo.of(r.getId(),now.getId(), now.getXY(),currentNode.getId(),currentNode.getXY())); | ||
| routeSet.add(r.getId()); |
There was a problem hiding this comment.
코어 노드 및 코어노드와 붙어있는 노드 넣는 작업인가요??
There was a problem hiding this comment.
맞습니다! BFS과정 중 dequeue 한 뒤, 인접한 다음 코어노드까지 가는 길에 있는 모든 서브노드를 coreRoute로 묶는 과정입니다.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
📝 PR 타입
🚀 변경 사항
코어 루트가 삭제되어 대학교의 모든 route를 조회하는 로직을 수정하였습니다.
💡 To Reviewer
🧪 테스트 결과
<<테스트 결과>>

<<코어노드가 없는 (일자로 된 경우) 지도에서의 예외처리 테스트>>

✅ 반영 브랜치