Skip to content

Commit

Permalink
fix: Give All data & Sorted By Name
Browse files Browse the repository at this point in the history
  • Loading branch information
Lunawood committed Dec 9, 2024
1 parent 7d79afd commit ebb2818
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -64,6 +65,20 @@ public class ToothController {

// 3. Count Frequency
Map<String, Integer> frequency = new HashMap<>();
frequency.put("UNDER_FRONT", 0);
frequency.put("UP_FRONT", 0);
frequency.put("UNDER_RIGHT_CANINE", 0);
frequency.put("UP_RIGHT_CANINE", 0);
frequency.put("UNDER_RIGHT_MOLAR_OUTSIDE", 0);
frequency.put("UP_RIGHT_MOLAR_OUTSIDE", 0);
frequency.put("UP_LEFT_MOLAR_CHEWING_SIDE", 0);
frequency.put("UP_RIGHT_MOLAR_CHEWING_SIDE", 0);
frequency.put("DOWN_RIGHT_MOLAR_CHEWING_SIDE", 0);
frequency.put("DOWN_LEFT_MOLAR_CHEWING_SIDE", 0);
frequency.put("UP_LEFT_MOLAR_OUTSIDE", 0);
frequency.put("UNDER_LEFT_MOLAR_OUTSIDE", 0);
frequency.put("UNDER_LEFT_CANINE", 0);
frequency.put("UP_LEFT_CANINE", 0);

for (String instruction : Instructions) {
frequency.put(instruction, frequency.getOrDefault(instruction, 0) + 1);
Expand All @@ -87,6 +102,8 @@ public class ToothController {
toothReports.add(toothReport);
}

Collections.sort(toothReports);

// 4. Get Sequence Data
User user = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,26 @@ public class ToothDataAnalyzer {

@Getter
@Setter
public static class ToothReport {
public static class ToothReport implements Comparable<ToothReport>{
private String name;
private String percent;
private String description;

@Override
public int compareTo(ToothReport other) {
// null 체크
if (this.name == null && other.name == null) {
return 0;
}
if (this.name == null) {
return -1;
}
if (other.name == null) {
return 1;
}

// name을 기준으로 오름차순 정렬
return this.name.compareTo(other.name);
}
}
}

0 comments on commit ebb2818

Please sign in to comment.