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

Alachisoft.NCache.Common.DataStructures.EnumerationPointer Maven / Gradle / Ivy

package Alachisoft.NCache.Common.DataStructures;

import Alachisoft.NCache.Common.Net.Address;
import com.alachisoft.ncache.serialization.core.io.ICompactSerializable;
import com.alachisoft.ncache.serialization.core.io.NCacheObjectInput;
import com.alachisoft.ncache.serialization.core.io.NCacheObjectOutput;

import java.io.IOException;
import java.util.UUID;

public class EnumerationPointer implements ICompactSerializable {
    private String _id = UUID.randomUUID().toString();
    private int _chunkId = -1;
    private boolean _isDisposable = false;
    private Address _nodeIpAddress;// = "";
    private boolean _isSocketServerDispose = false;

    public EnumerationPointer() {
    }

    public EnumerationPointer(String id, int chunkId) {
        _id = id;
        _chunkId = chunkId;
    }

    public boolean isGroupPointer() {
        return false;
    }

    public final boolean getHasFinished() {
        return _chunkId == -1;
    }

    public final Address getNodeIpAddress() {
        return _nodeIpAddress;
    }

    public final void setNodeIpAddress(Address value) {
        _nodeIpAddress = value;
    }

    public final String getId() {
        return _id;
    }

    public final int getChunkId() {
        return _chunkId;
    }

    public final void setChunkId(int value) {
        _chunkId = value;
    }

    public final boolean isDisposable() {
        return _isDisposable;
    }

    public final void setDisposable(boolean value) {
        _isDisposable = value;
    }

    public final boolean isSocketServerDispose() {
        return _isSocketServerDispose;
    }

    public final void setSocketServerDispose(boolean value) {
        _isSocketServerDispose = value;
    }

    public final void Reset() {
        _chunkId = -1;
    }

    @Override
    public boolean equals(Object obj) {
        boolean equals = false;

        if (obj instanceof EnumerationPointer) {
            EnumerationPointer other = (EnumerationPointer) ((obj instanceof EnumerationPointer) ? obj : null);
            equals = _id.equals(other._id);
        }

        return equals;
    }

    @Override
    public int hashCode() {
        if (_id != null) {
            return _id.hashCode();
        } else {
            return super.hashCode();
        }
    }

    //C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
    ///#region ICompactSerializable Members
    public void deserialize(NCacheObjectInput reader) throws IOException, ClassNotFoundException {
        _id = reader.readUTF();
        _chunkId = reader.readInt();
        _isDisposable = reader.readBoolean();
        _nodeIpAddress = (Address) reader.readObject();//reader.readUTF();
        _isSocketServerDispose = reader.readBoolean();
    }

    public void serialize(NCacheObjectOutput writer) throws IOException {
        writer.writeUTF(_id);
        writer.writeInt(_chunkId);
        writer.writeBoolean(_isDisposable);
        writer.writeObject(_nodeIpAddress);
        writer.writeBoolean(_isSocketServerDispose);
    }
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
    ///#endregion
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy