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

com.alachisoft.ncache.serialization.util.SerializationBitSet Maven / Gradle / Ivy

There is a newer version: 5.3.3
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.alachisoft.ncache.serialization.util;

import java.io.Serializable;

/**
 * @author numan_hanif
 */

public class SerializationBitSet implements Cloneable, Serializable {

    private byte _bitset;

    public SerializationBitSet() {
    }

    public SerializationBitSet(byte bitset) {
        this._bitset = bitset;
    }

    public byte getData() {
        return _bitset;
    }

    public void setData(byte bitset) {
        _bitset = bitset;
    }

    ///  Bit set specific functions. 
    public boolean IsAnyBitSet(byte bit) {
        return ((_bitset & bit) != 0);
    }

    public boolean IsBitSet(byte bit) {
        return ((_bitset & bit) == bit);
    }

    public void SetBit(byte bit) {
        _bitset |= bit;
    }

    public void UnsetBit(byte bit) {
        _bitset &= (~bit & 0xff);
    }

    public void Set(byte bitsToSet, byte bitsToUnset) {
        SetBit(bitsToSet);
        UnsetBit(bitsToUnset);
    }

    public Object Clone() {
        SerializationBitSet other = new SerializationBitSet();
        other._bitset = _bitset;
        return other;
    }

    public void Dispose() {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy