From fb91356b7777dfa5b6088bcc3a48b43924c1c0fd Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Thu, 3 Sep 2026 14:35:10 +0200 Subject: build: apply Spotless plugin (#293) --- src/main/java/dev/dnpm/oshelper/atc/AtcCode.java | 143 ++++++++++++----------- 1 file changed, 72 insertions(+), 71 deletions(-) (limited to 'src/main/java/dev/dnpm/oshelper/atc/AtcCode.java') 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 true 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 true 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})?)?)?"); + } } -- cgit v1.2.3