Package com.tangosol.util
Class MultiBinaryLongMap.MaskedLongMapHolder
java.lang.Object
com.tangosol.util.MultiBinaryLongMap.MaskedLongMapHolder
- Direct Known Subclasses:
- MultiBinaryLongMap.LeftoverLongMapHolder
- Enclosing class:
- MultiBinaryLongMap
MaskedLongMapHolder is used to produce 
MultiBinaryLongMap.MaskedBinaryLongMap
 instances backed by a shared BinaryLongMap. MaskedBinaryLongMap instances
 created by this holder are thread-safe and are all protected by the same
 shared and exclusive locks.- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected final BinaryLongMapThe BinaryLongMap shared by the component masked BLMs.protected final longThe bit-mask describing which bits in the underlying BLM representation are reserved (and may not be allocated by this holder).protected final LockThe shared lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.protected final LockThe exclusive lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.protected List<MultiBinaryLongMap.MaskedBinaryLongMap> The list ofreservedmasked BLMs, ordered by increasing shift-position.protected longThe bit-mask describing which bits in the underlying BLM representation are free.
- 
Constructor SummaryConstructorsConstructorDescriptionMaskedLongMapHolder(BinaryLongMap blm, Lock lockSMaster) Construct a MaskedLongMapHolder backed by the specified blm.MaskedLongMapHolder(BinaryLongMap blm, Lock lockSMaster, long lMaskReserved) Construct a MaskedLongMapHolder backed by the specified blm with the specified reserved bit-mask.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcheckRep()Debugging function to check the representational invariant.Return the BinaryLongMap that provides the underlying storage for this MaskedLongMapHolder.protected MultiBinaryLongMap.MaskedBinaryLongMapinstantiateMaskedBinaryLongMap(int cShift, int cBits) Factory method for instantiating MaskedBinaryLongMap instances associated with this MaskedLongMapHolder.booleanisEmpty()Return true iff all non-reserved bits are free (not in-use).booleanRelease a masked BLM that wasreservedfrom this MaskedLongMapHolder.reserveMap(int cBits) Reserve and return a masked BLM from this MaskedLongMapHolder if available, or null otherwise.protected voidshiftMaskedMap(MultiBinaryLongMap.MaskedBinaryLongMap blm, int cShiftRight) Shift the representation of the specified MaskedBinaryLongMap by the specified number of bits to the right.
- 
Field Details- 
m_listBLMsThe list ofreservedmasked BLMs, ordered by increasing shift-position.
- 
f_lMaskReservedprotected final long f_lMaskReservedThe bit-mask describing which bits in the underlying BLM representation are reserved (and may not be allocated by this holder).
- 
m_lMaskFreeprotected long m_lMaskFreeThe bit-mask describing which bits in the underlying BLM representation are free.
- 
f_lockSThe shared lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.
- 
f_lockXThe exclusive lock used to protected the logical contents of the maps exposed by this MaskedLongMapHolder.
- 
f_blmThe BinaryLongMap shared by the component masked BLMs.
 
- 
- 
Constructor Details- 
MaskedLongMapHolderConstruct 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
 
- 
MaskedLongMapHolderConstruct 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 Details- 
getDelegateMapReturn the BinaryLongMap that provides the underlying storage for this MaskedLongMapHolder.- Returns:
- the underlying BinaryLongMap
 
- 
reserveMapReserve and return a masked BLM from this MaskedLongMapHolder if available, or null otherwise. Reserved maps must bereleasedwhen no longer needed.- Parameters:
- cBits- the number of bits to use to store each value
- Returns:
- a masked BLM, or null
 
- 
releaseMapRelease a masked BLM that wasreservedfrom this MaskedLongMapHolder.- Parameters:
- blm- the masked BLM to release
- Returns:
- true iff the MaskedLongMapHolder becomes empty as a result
 
- 
isEmptypublic 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)
 
- 
instantiateMaskedBinaryLongMapprotected 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)
 
- 
shiftMaskedMapShift 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
 
- 
checkRepprotected void checkRep()Debugging function to check the representational invariant.
 
-