|
|
|
Mladen Turk-3
|
Author: mturk
Date: Fri Jul 3 05:47:36 2009 New Revision: 790794 URL: http://svn.apache.org/viewvc?rev=790794&view=rev Log: API rename Added: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/AbstractPointer.java - copied, changed from r790713, commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java Removed: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.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 Copied: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/AbstractPointer.java (from r790713, 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/AbstractPointer.java?p2=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/AbstractPointer.java&p1=commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Pointer.java&r1=790713&r2=790794&rev=790794&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/AbstractPointer.java Fri Jul 3 05:47:36 2009 @@ -22,7 +22,7 @@ * </p> * @since Runtime 1.0 */ -public abstract class Pointer implements Comparable<Pointer> +abstract class AbstractPointer implements Pointer { /** @@ -30,11 +30,28 @@ */ public static final int DEFAULT_ALIGNMENT = 8; + /** + * Create new {@code null} {@link Pointer} instance. + * <p> + * Depending on the platform the created {@code Pointer} + * object is either {@code Pointer32} for 32-bit machines + * or {@code 64-bit} for 64-bit machines. + * </p> + * + */ + public static Pointer createInstance() + { + if (Platform.SIZEOF_POINTER == 8) + return new Pointer32(); + else + return new Pointer64(); + } + /* * Pointer can only be created from the native code. * Suppress any instantiation except from internal classes. */ - protected Pointer() + protected AbstractPointer() { // No Instance } @@ -92,11 +109,6 @@ } /** - * Size in bytes of the storage needed to represent the Pointer. - */ - public static final int SIZEOF = Platform.SIZEOF_POINTER; - - /** * Address of the internal pointer. * <p> * Depending on the operating system the {@code Number} can be Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.java URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.java?rev=790794&r1=790793&r2=790794&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.java (original) +++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DirectBuffer.java Fri Jul 3 05:47:36 2009 @@ -23,7 +23,7 @@ * * @since Runtime 1.0 */ -public interface DirectBuffer extends Comparable<Pointer> { +public interface DirectBuffer extends Pointer { /** * Cast {@code this} buffer to {@link Pointer Pointer}. @@ -32,41 +32,6 @@ */ public Pointer asPointer(); - /** - * Free the allocated resource by the Operating system. - * - * @see Pointer#free() - * @throws Throwable the {@code Exception} raised by this method. - */ - public void free() - throws Throwable; - - /** - * Check if the buffer is valid - * @return true if the internal pointer is not {@code NULL}. - * @see Pointer#IsNull() - */ - public boolean IsNull(); - - /** - * Size of the memory area this pointer consumes. - * - * @return Internal pointer size. - * @see Pointer#sizeof() - */ - public long sizeof(); - - /** - * Compares this {@code DirectBuffer} to the specified object. - * - * @param other a {@code DirectBuffer} - * @return true if the class of this {@code DirectBuffer} 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. - * @see Pointer#equals() - */ - public boolean equals(Object other); } 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=790794&r1=790793&r2=790794&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 Jul 3 05:47:36 2009 @@ -24,7 +24,7 @@ * </p> * @since Runtime 1.0 */ -class Pointer32 extends Pointer { +class Pointer32 extends AbstractPointer { protected int CLEANUP; protected int POINTER; 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=790794&r1=790793&r2=790794&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 Jul 3 05:47:36 2009 @@ -24,7 +24,7 @@ * </p> * @since Runtime 1.0 */ -class Pointer64 extends Pointer { +class Pointer64 extends AbstractPointer { protected long CLEANUP; protected long POINTER; |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |