Add equals and hashcode to Format.
This commit is contained in:
parent
d9a7da27f2
commit
de807b4524
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue