summaryrefslogtreecommitdiff
path: root/src/main/java/dev/dnpm/oshelper/atc/AtcCode.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/dev/dnpm/oshelper/atc/AtcCode.java')
-rw-r--r--src/main/java/dev/dnpm/oshelper/atc/AtcCode.java143
1 files changed, 72 insertions, 71 deletions
diff --git a/src/main/java/dev/dnpm/oshelper/atc/AtcCode.java b/src/main/java/dev/dnpm/oshelper/atc/AtcCode.java
index 61685d6..beff5bf 100644
--- a/src/main/java/dev/dnpm/oshelper/atc/AtcCode.java
+++ b/src/main/java/dev/dnpm/oshelper/atc/AtcCode.java
@@ -29,75 +29,76 @@ import java.util.Objects;
*/
public class AtcCode implements AgentCode {
- private final String code;
- private final String name;
- private final String synonyms;
-
- private final String version;
-
- public AtcCode(String code, String name) {
- this(code, name, null);
- }
-
- public AtcCode(String code, String name, String version) {
- this(code, name, version, "");
- }
-
- public AtcCode(String code, String name, String version, String synonyms) {
- this.code = code;
- this.name = name;
- this.synonyms = synonyms;
- this.version = version;
- }
-
- public String getCode() {
- return code;
- }
-
- public String getName() {
- return name;
- }
-
- public String getSynonyms() {
- return this.synonyms;
- }
-
- public CodeSystem getSystem() {
- return CodeSystem.ATC;
- }
-
- public String getVersion() {
- return version;
- }
-
- @Override
- public int compareTo(final AgentCode agentCode) {
- return this.name.toLowerCase().compareTo(agentCode.getName().toLowerCase());
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- AgentCode otherAgentCode = (AgentCode) o;
- return Objects.equals(code.toLowerCase(), otherAgentCode.getCode().toLowerCase())
- && Objects.equals(name.toLowerCase(), otherAgentCode.getName().toLowerCase())
- && Objects.equals(version, otherAgentCode.getVersion());
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(code.toLowerCase(), name.toLowerCase());
- }
-
- /**
- * Checks for usable ATC code starting at level 2
- * @param code Code to be checked
- * @return Will return <code>true</code> if code matches ATC code scheme
- */
- public static boolean isAtcCode(String code) {
- return null != code
- && ! code.isBlank()
- && code.matches("[ABCDGHJLMNPRSV][0-2][1-9]([A-Z]([A-Z](\\d{2})?)?)?");
- }
+ private final String code;
+ private final String name;
+ private final String synonyms;
+
+ private final String version;
+
+ public AtcCode(String code, String name) {
+ this(code, name, null);
+ }
+
+ public AtcCode(String code, String name, String version) {
+ this(code, name, version, "");
+ }
+
+ public AtcCode(String code, String name, String version, String synonyms) {
+ this.code = code;
+ this.name = name;
+ this.synonyms = synonyms;
+ this.version = version;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getSynonyms() {
+ return this.synonyms;
+ }
+
+ public CodeSystem getSystem() {
+ return CodeSystem.ATC;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ @Override
+ public int compareTo(final AgentCode agentCode) {
+ return this.name.toLowerCase().compareTo(agentCode.getName().toLowerCase());
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ AgentCode otherAgentCode = (AgentCode) o;
+ return Objects.equals(code.toLowerCase(), otherAgentCode.getCode().toLowerCase())
+ && Objects.equals(name.toLowerCase(), otherAgentCode.getName().toLowerCase())
+ && Objects.equals(version, otherAgentCode.getVersion());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(code.toLowerCase(), name.toLowerCase());
+ }
+
+ /**
+ * Checks for usable ATC code starting at level 2
+ *
+ * @param code Code to be checked
+ * @return Will return <code>true</code> if code matches ATC code scheme
+ */
+ public static boolean isAtcCode(String code) {
+ return null != code
+ && !code.isBlank()
+ && code.matches("[ABCDGHJLMNPRSV][0-2][1-9]([A-Z]([A-Z](\\d{2})?)?)?");
+ }
}