[libbluray-devel] HScreenPoint: add equals() and toString()
hpi1
git at videolan.org
Sun Apr 17 14:57:15 CEST 2016
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sat Apr 16 23:09:28 2016 +0300| [1cc8ccd7be875e532b429afd138dd724e0c7bf49] | committer: hpi1
HScreenPoint: add equals() and toString()
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=1cc8ccd7be875e532b429afd138dd724e0c7bf49
---
.../bdj/java/org/havi/ui/HScreenPoint.java | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java b/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java
index 589c67a..ea43bbd 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenPoint.java
@@ -21,8 +21,7 @@ package org.havi.ui;
public class HScreenPoint {
public HScreenPoint(float x, float y) {
- this.x = x;
- this.y = y;
+ setLocation(x, y);
}
public void setLocation(float x, float y) {
@@ -30,6 +29,23 @@ public class HScreenPoint {
this.y = y;
}
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof HScreenPoint))
+ return false;
+
+ HScreenPoint other = (HScreenPoint)obj;
+ Float x1 = new Float(this.x);
+ Float y1 = new Float(this.y);
+ Float x2 = new Float(other.x);
+ Float y2 = new Float(other.y);
+ return x1.equals(x2) && y1.equals(y2);
+ }
+
+ public String toString() {
+ return "[" + x + "," + y + "]";
+ }
+
public float x;
public float y;
}
More information about the libbluray-devel
mailing list