diff --git a/src/main/java/moe/nekojimi/chords/Format.java b/src/main/java/moe/nekojimi/chords/Format.java index 0e26778..8391193 100644 --- a/src/main/java/moe/nekojimi/chords/Format.java +++ b/src/main/java/moe/nekojimi/chords/Format.java @@ -7,8 +7,7 @@ package moe.nekojimi.chords; import com.amihaiemil.eoyaml.Yaml; import com.amihaiemil.eoyaml.YamlMapping; -import java.util.regex.Matcher; -import java.util.regex.Pattern; +import java.util.Objects; import javax.json.JsonObject; /** @@ -145,4 +144,42 @@ class Format return "Format{" + "code=" + code + ", extension=" + extension + ", resolution=" + resolution + ", note=" + note + '}'; } + @Override + public int hashCode() + { + int hash = 7; + hash = 97 * hash + Objects.hashCode(this.extension); + hash = 97 * hash + Objects.hashCode(this.resolution); + hash = 97 * hash + (int) (this.size ^ (this.size >>> 32)); + hash = 97 * hash + this.samplerate; + hash = 97 * hash + (this.audioOnly ? 1 : 0); + return hash; + } + + @Override + public boolean equals(Object obj) + { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final Format other = (Format) obj; + if (this.size != other.size) + return false; + if (this.samplerate != other.samplerate) + return false; + if (this.audioOnly != other.audioOnly) + return false; + if (!Objects.equals(this.code, other.code)) + return false; + if (!Objects.equals(this.extension, other.extension)) + return false; + if (!Objects.equals(this.resolution, other.resolution)) + return false; + return true; + } + + }