mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-13 00:05:35 +07:00
Changed MpqFileHandle equality contact to match only MpqFileHandle#path() and not FileHandle#type which is not set by MpqFileHandle
This commit is contained in:
parent
187ffe190b
commit
d1b12236b8
@ -21,6 +21,7 @@ import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
|
||||
@ -129,6 +130,26 @@ public final class MpqFileHandle extends FileHandle implements ReferenceCounted
|
||||
this.archive = mpq.map().slice(offset, CSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches FileHandle irrespective of {@link FileHandle#type}
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof MpqFileHandle) {
|
||||
MpqFileHandle other = (MpqFileHandle) o;
|
||||
return Objects.equals(filename, other.path());
|
||||
} else {
|
||||
if (!(o instanceof FileHandle)) return false;
|
||||
FileHandle other = (FileHandle) o;
|
||||
return super.equals(other);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return filename.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return toString == null
|
||||
|
Loading…
Reference in New Issue
Block a user