[libbluray-devel] add hashCode()

hpi1 git at videolan.org
Sat Jun 10 13:50:13 CEST 2017


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

add hashCode()

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

 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 ++++
 3 files changed, 12 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;



More information about the libbluray-devel mailing list