Package one.microstream.collections.lazy
Class LazyHashMap.Segment<E extends LazyHashMap.Entry<K,V>>
java.lang.Object
one.microstream.collections.lazy.LazyHashMap.Segment<E>
- All Implemented Interfaces:
LazySegment<LazyHashMap.LazyHashMapSegmentEntryList<K,V>>,LazyClearController
- Enclosing class:
- LazyHashMap<K,V>
public final class LazyHashMap.Segment<E extends LazyHashMap.Entry<K,V>> extends Object implements LazyClearController, LazySegment<LazyHashMap.LazyHashMapSegmentEntryList<K,V>>
-
Method Summary
Modifier and Type Method Description booleanallowClear()Allow or deny clearing a lazy reference.voidallowUnload(boolean allow)intcompareHash(int hash)Compares the supplied hash to with the segments min and max properties.LazyHashMap.Entry<K,V>getByHash(int hash, Object key)Search for an entry by its keys hash and value.LazyHashMap.LazyHashMapSegmentEntryList<K,V>getData()booleanisLoaded()Check if the lazy loaded data of this segment has been loaded.booleanisModified()Check if this segment has modifications that are not yet persisted.intsize()get the number of contained element in this segment.StringtoString()Returns the string representation of this segment.booleanunloadAllowed()voidunloadSegment()Unload the lazy data of this segment
-
Method Details
-
size
public int size()Description copied from interface:LazySegmentget the number of contained element in this segment.- Specified by:
sizein interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>- Returns:
- number of contained elements;
-
isLoaded
public boolean isLoaded()Description copied from interface:LazySegmentCheck if the lazy loaded data of this segment has been loaded.- Specified by:
isLoadedin interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>- Returns:
- true if loaded, otherwise false.
-
isModified
public boolean isModified()Description copied from interface:LazySegmentCheck if this segment has modifications that are not yet persisted.- Specified by:
isModifiedin interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>- Returns:
- true if there are modifications not yet persisted, otherwise false.
-
unloadSegment
public void unloadSegment()Description copied from interface:LazySegmentUnload the lazy data of this segment- Specified by:
unloadSegmentin interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>
-
getData
- Specified by:
getDatain interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>
-
compareHash
public int compareHash(int hash)Compares the supplied hash to with the segments min and max properties.- Parameters:
hash- to be compared with.- Returns:
- hash < 0: -1
hash >= max: 1
min < hash < max: 0.
-
getByHash
Search for an entry by its keys hash and value.- Parameters:
hash- the key hashkey- the key value- Returns:
- found entry or null
-
allowClear
public boolean allowClear()Description copied from interface:LazyClearControllerAllow or deny clearing a lazy reference.- Specified by:
allowClearin interfaceLazyClearController- Returns:
- true if clearing the lazy reference is allowed, otherwise false.
-
toString
Returns the string representation of this segment. Key-value pairs will be coded as 'key'='value'. If the segment is unloaded it will not get loaded, the key-value pairs stored in an unloaded segment will not be included in the returned string. Instead, it just reports the number of unloaded elements. -
allowUnload
public void allowUnload(boolean allow)- Specified by:
allowUnloadin interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>
-
unloadAllowed
public boolean unloadAllowed()- Specified by:
unloadAllowedin interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>
-