[libbluray-devel] add hashCode()

hpi1 git at videolan.org
Thu Jun 15 00:03:51 CEST 2017


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Jun  9 18:22:11 2017 +0300| [c4f45ed979a2087e4b9f1b7bfe75e9c6876eb1b5] | committer: hpi1

add hashCode()

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=c4f45ed979a2087e4b9f1b7bfe75e9c6876eb1b5
---

 src/libbluray/bdj/java/org/bluray/net/BDLocator.java     | 4 ++++
 src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java      | 4 ++++
 src/libbluray/bdj/java/org/davic/net/Locator.java        | 4 ++++
 src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java     | 4 ++++
 src/libbluray/bdj/java/org/havi/ui/HScreenRectangle.java | 8 ++++++++
 5 files changed, 24 insertions(+)

diff --git a/src/libbluray/bdj/java/org/bluray/net/BDLocator.java b/src/libbluray/bdj/java/org/bluray/net/BDLocator.java
index eb981179..84877eb5 100644
--- a/src/libbluray/bdj/java/org/bluray/net/BDLocator.java
+++ b/src/libbluray/bdj/java/org/bluray/net/BDLocator.java
@@ -198,6 +198,10 @@ public class BDLocator extends Locator {
      *
      */
 
+    public int hashCode() {
+        return url.hashCode();
+    }
+
     public boolean equals(Object obj) {
         if (obj == null)
             return false;
diff --git a/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java b/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
index e4f216e6..09985980 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
@@ -84,6 +84,10 @@ public class TitleImpl implements Title {
         return otherNum == titleNum;
     }
 
+    public int hashCode() {
+        return titleNum % 1023;
+    }
+
     public boolean hasMultipleInstances() {
         return false;
     }
diff --git a/src/libbluray/bdj/java/org/davic/net/Locator.java b/src/libbluray/bdj/java/org/davic/net/Locator.java
index cdc7d6be..0195d493 100644
--- a/src/libbluray/bdj/java/org/davic/net/Locator.java
+++ b/src/libbluray/bdj/java/org/davic/net/Locator.java
@@ -35,6 +35,10 @@ public class Locator implements javax.tv.locator.Locator {
         return url;
     }
 
+    public int hashCode() {
+        return toExternalForm().hashCode();
+    }
+
     public boolean equals(Object obj) {
         if (obj == null || !(obj instanceof Locator) || url == null)
             return false;
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java b/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java
index ea43bbdb..5ca43e6c 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java
@@ -29,6 +29,10 @@ public class HScreenPoint {
         this.y = y;
     }
 
+    public int hashCode() {
+        return Float.hashCode(x) + 31 * Float.hashCode(y);
+    }
+
     public boolean equals(Object obj)
     {
         if (!(obj instanceof HScreenPoint))
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenRectangle.java b/src/libbluray/bdj/java/org/havi/ui/HScreenRectangle.java
index f2deb822..2b4c7505 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenRectangle.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenRectangle.java
@@ -35,6 +35,14 @@ public class HScreenRectangle {
         this.height = Math.max(0.0f, height);
     }
 
+    public int hashCode() {
+        int result = Float.hashCode(x);
+        result = 31 * result + Float.hashCode(y);
+        result = 31 * result + Float.hashCode(width);
+        result = 31 * result + Float.hashCode(height);
+        return result;
+    }
+
     public boolean equals(Object obj)
     {
         if (!(obj instanceof HScreenRectangle))



More information about the libbluray-devel mailing list