public class RwlSegmentedStoredList<T> extends Object implements IStoredList<T>
Constructor and Description |
---|
RwlSegmentedStoredList(IReusableResourcePool<ReadWriteLock> locksPool) |
Modifier and Type | Method and Description |
---|---|
IObjectInfo<T> |
add(T subject)
store an element
|
IObjectInfo<T> |
addUnlocked(T subject)
Store an element in the list, while the SL is unlocked .
|
boolean |
contains(T obj)
is this object contained in the SL ?
|
void |
dump(Logger logger,
String msg)
Dump list content, used for Debug.
|
IStoredListIterator<T> |
establishListScan(boolean random_scan)
establish a scan position.
|
void |
freeSLHolder(IStoredListIterator<T> slh)
this method is called by outside scan that want to quit the scan and return the slholder to
the factory
|
int |
getHashCode(int id) |
IObjectInfo<T> |
getHead()
Goes over all the segments and finds the first element.
|
Object |
getKey(int id) |
T |
getObjectFromHead()
Returns the value of the first element in the list (fifo)
|
IStoredList<T> |
getValue(int id) |
boolean |
invalidate()
Sets an indication that this StoredList is invalid.
|
boolean |
isEmpty()
Returns true if the list is empty
|
boolean |
isIterator()
is the list an iterator or basic list ?
|
boolean |
isMultiObjectCollection()
is it an actual multi object container.
|
boolean |
isNativeHashEntry() |
IStoredListIterator<T> |
next(IStoredListIterator<T> slh)
get the next element in scan order
|
boolean |
optimizeScanForSingleObject()
return true if we can save iterator creation and get a single entry
|
protected void |
remove_impl(com.j_spaces.kernel.list.RwlSegmentedStoredList.Segment<T> segment,
com.j_spaces.kernel.list.RwlSegmentedStoredList.ObjectInfo<T> oi)
remove an element described by ObjectInfo
|
void |
remove(IObjectInfo<T> poi)
remove an element described by ObjectInfo
|
boolean |
removeByObject(T obj)
given an object scan the list, find it and remove it, returns true if found
|
void |
removeUnlocked(IObjectInfo<T> poi)
Remove an element described by ObjectInfo, while the SL is unlocked.
|
int |
size()
Returns the amount of elements in the StoredList.
|
protected IObjectInfo<T> |
store_impl(com.j_spaces.kernel.list.RwlSegmentedStoredList.Segment<T> segment,
com.j_spaces.kernel.list.RwlSegmentedStoredList.ObjectInfo<T> oi)
store an element in segment
|
public RwlSegmentedStoredList(IReusableResourcePool<ReadWriteLock> locksPool)
public int size()
ICollection
size
in interface ICollection<T>
ICollection.isEmpty()
public boolean isEmpty()
isEmpty
in interface ICollection<T>
true
if list is empty; false
otherwise.public IObjectInfo<T> getHead()
getHead
in interface IStoredList<T>
public T getObjectFromHead()
IStoredList
getObjectFromHead
in interface IStoredList<T>
public boolean optimizeScanForSingleObject()
optimizeScanForSingleObject
in interface IStoredList<T>
public IStoredListIterator<T> establishListScan(boolean random_scan)
establishListScan
in interface ICollection<T>
random_scan
- true
enable random scan; false
start from head.public IStoredListIterator<T> next(IStoredListIterator<T> slh)
next
in interface ICollection<T>
slh
- Holder representing a pivot position.null
if reached end of scan.public void freeSLHolder(IStoredListIterator<T> slh)
freeSLHolder
in interface IStoredList<T>
slh
- Holder resource to return to pool; can be null
.public IObjectInfo<T> add(T subject)
add
in interface ICollection<T>
subject
- element to store.null
if
StoredList has been invalidated.public IObjectInfo<T> addUnlocked(T subject)
IStoredList
addUnlocked
in interface IStoredList<T>
subject
- element to store.null
if
StoredList has been invalidated.protected IObjectInfo<T> store_impl(com.j_spaces.kernel.list.RwlSegmentedStoredList.Segment<T> segment, com.j_spaces.kernel.list.RwlSegmentedStoredList.ObjectInfo<T> oi)
public void remove(IObjectInfo<T> poi)
remove
in interface IStoredList<T>
poi
- an existing element between Tail and Headpublic void removeUnlocked(IObjectInfo<T> poi)
IStoredList
removeUnlocked
in interface IStoredList<T>
poi
- an existing element between Tail and Headprotected void remove_impl(com.j_spaces.kernel.list.RwlSegmentedStoredList.Segment<T> segment, com.j_spaces.kernel.list.RwlSegmentedStoredList.ObjectInfo<T> oi)
segment
- TODOpublic boolean removeByObject(T obj)
removeByObject
in interface ICollection<T>
obj
- element to removetrue
if object was removed; false
otherwise (if element
wasn't found)public boolean contains(T obj)
contains
in interface ICollection<T>
obj
- the element to search fortrue
if element exists in the StoredList; false
otherwise.public boolean invalidate()
invalidate
in interface IStoredList<T>
true
if StoredList was set to invalid; false
otherwise.public boolean isMultiObjectCollection()
ICollection
isMultiObjectCollection
in interface ICollection<T>
true
if its an actual list; false
otherwisepublic boolean isIterator()
IObjectsList
isIterator
in interface IObjectsList
public void dump(Logger logger, String msg)
IStoredList
dump
in interface IStoredList<T>
logger
- logger to usemsg
- message to add in logpublic int getHashCode(int id)
getHashCode
in interface IHashEntry<Object,IStoredList<T>>
public Object getKey(int id)
getKey
in interface IHashEntry<Object,IStoredList<T>>
public IStoredList<T> getValue(int id)
getValue
in interface IHashEntry<Object,IStoredList<T>>
public boolean isNativeHashEntry()
isNativeHashEntry
in interface IHashEntry<Object,IStoredList<T>>
true
if this is a native hashmap entryCopyright © GigaSpaces.