pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1783257 - /pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java
Date Thu, 16 Feb 2017 17:52:46 GMT
Author: tilman
Date: Thu Feb 16 17:52:46 2017
New Revision: 1783257

URL: http://svn.apache.org/viewvc?rev=1783257&view=rev
Log:
PDFBOX-3688: add equal() and hashCode()

Modified:
    pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java

Modified: pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java?rev=1783257&r1=1783256&r2=1783257&view=diff
==============================================================================
--- pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java (original)
+++ pdfbox/branches/2.0/pdfbox/src/main/java/org/apache/pdfbox/util/Matrix.java Thu Feb 16
17:52:46 2017
@@ -22,6 +22,7 @@ import org.apache.pdfbox.cos.COSNumber;
 
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Point2D;
+import java.util.Arrays;
 
 /**
  * This class will be used for matrix manipulation.
@@ -696,4 +697,28 @@ public final class Matrix implements Clo
                 single[7] + "]";
         return sb;
     }
+
+    @Override
+    public int hashCode()
+    {
+        return Arrays.hashCode(single);
+    }
+
+    @Override
+    public boolean equals(Object obj)
+    {
+        if (this == obj)
+        {
+            return true;
+        }
+        if (obj == null)
+        {
+            return false;
+        }
+        if (getClass() != obj.getClass())
+        {
+            return false;
+        }
+        return Arrays.equals(this.single, ((Matrix) obj).single);
+    }
 }



Mime
View raw message