Skip to content

Commit 934cddd

Browse files
committed
🐛 fix : 리버스 경로 수정
1 parent f3e72c5 commit 934cddd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/main/java/com/example/Centralthon/domain/route/algo/PathStitcher.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import lombok.NoArgsConstructor;
77

88
import java.util.ArrayList;
9+
import java.util.Collections;
910
import java.util.List;
1011
import java.util.Map;
1112

@@ -23,6 +24,12 @@ public static CombinedPath stitch(List<Integer> order, Map<SegmentKey, PedSegmen
2324
if (seg == null) throw new RouteSegmentMissingException();
2425

2526
List<LocationRes> p = seg.path();
27+
28+
if (i > j && p != null && p.size() >= 2) {
29+
p = new ArrayList<>(p);
30+
Collections.reverse(p);
31+
}
32+
2633
if (merged.isEmpty()) merged.addAll(p);
2734
else {
2835
if (!p.isEmpty() && !merged.isEmpty()

0 commit comments

Comments
 (0)