From 984cd026b0ae924a3790d907571f432c172d9374 Mon Sep 17 00:00:00 2001 From: Alexander Zolotov Date: Thu, 22 Jan 2015 15:23:22 +0300 Subject: [PATCH] Add hashCode and equals for ImageInfo index value --- .../intellij/images/util/ImageInfoReader.java | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/images/src/org/intellij/images/util/ImageInfoReader.java b/images/src/org/intellij/images/util/ImageInfoReader.java index 7dd764faa328..c84d13ab6d05 100644 --- a/images/src/org/intellij/images/util/ImageInfoReader.java +++ b/images/src/org/intellij/images/util/ImageInfoReader.java @@ -20,7 +20,10 @@ import com.intellij.util.io.UnsyncByteArrayInputStream; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.io.*; +import java.io.DataInput; +import java.io.DataInputStream; +import java.io.IOException; +import java.io.RandomAccessFile; /** * @author spleaner @@ -243,6 +246,28 @@ public class ImageInfoReader { this.height = height; this.bpp = bpp; } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof Info)) return false; + + Info info = (Info)o; + + if (width != info.width) return false; + if (height != info.height) return false; + if (bpp != info.bpp) return false; + + return true; + } + + @Override + public int hashCode() { + int result = width; + result = 31 * result + height; + result = 31 * result + bpp; + return result; + } } }