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 boolean
allowClear()
Allow or deny clearing a lazy reference.void
allowUnload(boolean allow)
int
compareHash(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()
boolean
isLoaded()
Check if the lazy loaded data of this segment has been loaded.boolean
isModified()
Check if this segment has modifications that are not yet persisted.int
size()
get the number of contained element in this segment.String
toString()
Returns the string representation of this segment.boolean
unloadAllowed()
void
unloadSegment()
Unload the lazy data of this segment
-
Method Details
-
size
public int size()Description copied from interface:LazySegment
get the number of contained element in this segment.- Specified by:
size
in interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>
- Returns:
- number of contained elements;
-
isLoaded
public boolean isLoaded()Description copied from interface:LazySegment
Check if the lazy loaded data of this segment has been loaded.- Specified by:
isLoaded
in interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>
- Returns:
- true if loaded, otherwise false.
-
isModified
public boolean isModified()Description copied from interface:LazySegment
Check if this segment has modifications that are not yet persisted.- Specified by:
isModified
in 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:LazySegment
Unload the lazy data of this segment- Specified by:
unloadSegment
in interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>
-
getData
- Specified by:
getData
in 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:LazyClearController
Allow or deny clearing a lazy reference.- Specified by:
allowClear
in 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:
allowUnload
in interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>
-
unloadAllowed
public boolean unloadAllowed()- Specified by:
unloadAllowed
in interfaceLazySegment<E extends LazyHashMap.Entry<K,V>>
-