Class MultiBinaryLongMap.MaskedLongMapHolder

    • Field Detail

      • f_lMaskReserved

        protected final long f_lMaskReserved
        The bit-mask describing which bits in the underlying BLM representation are reserved (and may not be allocated by this holder).
      • m_lMaskFree

        protected long m_lMaskFree
        The bit-mask describing which bits in the underlying BLM representation are free.
      • f_lockS

        protected final Lock f_lockS
        The shared lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.
      • f_lockX

        protected final Lock f_lockX
        The exclusive lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.
      • f_blm

        protected final BinaryLongMap f_blm
        The BinaryLongMap shared by the component masked BLMs.
    • Constructor Detail

      • MaskedLongMapHolder

        public MaskedLongMapHolder​(BinaryLongMap blm,
                                   Lock lockSMaster)
        Construct a MaskedLongMapHolder backed by the specified blm.
        Parameters:
        blm - the BinaryLongMap that the component masked maps are backed by
        lockSMaster - the shared master-lock for the MultiBinaryLongMap
      • MaskedLongMapHolder

        public MaskedLongMapHolder​(BinaryLongMap blm,
                                   Lock lockSMaster,
                                   long lMaskReserved)
        Construct a MaskedLongMapHolder backed by the specified blm with the specified reserved bit-mask.
        Parameters:
        blm - the BinaryLongMap that the component masked maps are backed by
        lockSMaster - the shared master-lock for the MultiBinaryLongMap
        lMaskReserved - the bit-mask representing the reserved bits
    • Method Detail

      • getDelegateMap

        public BinaryLongMap getDelegateMap()
        Return the BinaryLongMap that provides the underlying storage for this MaskedLongMapHolder.
        Returns:
        the underlying BinaryLongMap
      • reserveMap

        public BinaryLongMap reserveMap​(int cBits)
        Reserve and return a masked BLM from this MaskedLongMapHolder if available, or null otherwise. Reserved maps must be released when no longer needed.
        Parameters:
        cBits - the number of bits to use to store each value
        Returns:
        a masked BLM, or null
      • releaseMap

        public boolean releaseMap​(MultiBinaryLongMap.MaskedBinaryLongMap blm)
        Release a masked BLM that was reserved from this MaskedLongMapHolder.
        Parameters:
        blm - the masked BLM to release
        Returns:
        true iff the MaskedLongMapHolder becomes empty as a result
      • isEmpty

        public boolean isEmpty()
        Return true iff all non-reserved bits are free (not in-use).
        Returns:
        true iff all non-reserved bits are free (not in use)
      • instantiateMaskedBinaryLongMap

        protected MultiBinaryLongMap.MaskedBinaryLongMap instantiateMaskedBinaryLongMap​(int cShift,
                                                                                        int cBits)
        Factory method for instantiating MaskedBinaryLongMap instances associated with this MaskedLongMapHolder.
        Parameters:
        cShift - the shift position of the masked BLM
        cBits - the bit-width of values represented by the BLM
        Returns:
        a MaskedBinaryLongMap with the specified shift and mask associated with this LongMapHolder (and backed by the underlying BLM)
      • shiftMaskedMap

        protected void shiftMaskedMap​(MultiBinaryLongMap.MaskedBinaryLongMap blm,
                                      int cShiftRight)
        Shift the representation of the specified MaskedBinaryLongMap by the specified number of bits to the right.

        Note: the caller must hold exclusive access to the underlying BLM (and by extension, exclusive access to all derived masked maps).

        Parameters:
        blm - the MaskedBinaryLongMap to shift
        cShiftRight - the number of bits to shift to the right
      • checkRep

        protected void checkRep()
        Debugging function to check the representational invariant.