You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/04/17 14:30:44 UTC
svn commit: r765968 - in
/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime:
Pointer.java Pointer32.java Pointer64.java
Author: mturk
Date: Fri Apr 17 12:30:44 2009
New Revision: 765968
URL: http://svn.apache.org/viewvc?rev=765968&view=rev
Log:
Add Pointer equals method
Modified:
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java?rev=765968&r1=765967&r2=765968&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java Fri Apr 17 12:30:44 2009
@@ -59,6 +59,17 @@
public abstract boolean IsNull();
/**
+ * Compares this {@code Pointer} to the specified object.
+ *
+ * @param other a {@code Pointer}
+ * @return true if the class of this {@code Pointer} object and the
+ * class of {@code other} are exactly equal, and the C/C++
+ * pointers being pointed to by these objects are also
+ * equal. Returns false otherwise.
+ */
+ public abstract boolean equals(Object other);
+
+ /**
* Called by the garbage collector when the object is destroyed.
* The class will free internal resources allocated by the Operating system.
* @see Object#finalize()
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java?rev=765968&r1=765967&r2=765968&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer32.java Fri Apr 17 12:30:44 2009
@@ -36,6 +36,17 @@
CLEANUP = clr;
}
+ public boolean equals(Object other)
+ {
+ if (other == null)
+ return false;
+ if (other == this)
+ return true;
+ if (Pointer32.class != other.getClass())
+ return false;
+ return POINTER == ((Pointer32)other).POINTER;
+ }
+
public boolean IsNull()
{
return POINTER == 0;
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java?rev=765968&r1=765967&r2=765968&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer64.java Fri Apr 17 12:30:44 2009
@@ -36,6 +36,17 @@
CLEANUP = clr;
}
+ public boolean equals(Object other)
+ {
+ if (other == null)
+ return false;
+ if (other == this)
+ return true;
+ if (Pointer64.class != other.getClass())
+ return false;
+ return POINTER == ((Pointer64)other).POINTER;
+ }
+
public boolean IsNull()
{
return POINTER == 0L;