Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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);
}
}
}
Loading