All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.org.python.modules.jffi.NullMemory Maven / Gradle / Ivy

Go to download

Jython is an implementation of the high-level, dynamic, object-oriented language Python written in 100% Pure Java, and seamlessly integrated with the Java platform. It thus allows you to run Python on any Java platform.

There is a newer version: 2.7.4
Show newest version


package org.python.modules.jffi;

/**
 * An implementation of MemoryIO that throws an exception on any access.
 */
public class NullMemory extends InvalidMemory implements DirectMemory {
    static final NullMemory INSTANCE = new NullMemory();
    public NullMemory() {
        super("NULL pointer access");
    }

    public long getAddress() {
        return 0L;
    }

    public boolean isNull() {
        return true;
    }
    public final boolean isDirect() {
        return true;
    }

    @Override
    public boolean equals(Object obj) {
        return obj instanceof DirectMemory && ((DirectMemory) obj).getAddress() == 0;
    }

    @Override
    public int hashCode() {
        return 0;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy