diff --git a/src/main/java/de/uniluebeck/mi/projmi6/model/Icd10Code.java b/src/main/java/de/uniluebeck/mi/projmi6/model/Icd10Code.java index b4c0964..45d9055 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/model/Icd10Code.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/model/Icd10Code.java @@ -1,5 +1,5 @@ package de.uniluebeck.mi.projmi6.model; - +import java.io.*; /** * A simple, immutable class that wraps an ICD10 code entry from the db. */ @@ -12,7 +12,7 @@ public class Icd10Code { private final int version; - public Icd10Code(String icd10Code, String text, int version){ + public Icd10Code(String icd10Code, String text, int version) { this.code = icd10Code; this.text = text; this.version = version; @@ -32,6 +32,18 @@ public class Icd10Code { @Override public String toString() { - return code+" - "+ text; + return code + " - " + text; } -} + + + public boolean isLastElementANumber(Icd10Code icd10code) { + String lastElement = icd10code.getCode().substring(icd10code.getCode().length() - 1); + boolean isNumber = false; + char[] lastEl = lastElement.toCharArray(); + if (Character.isDigit(lastEl[0])) { + isNumber = true; + } + return isNumber; + } + +} \ No newline at end of file