public class ExternallyLockedStoredList<T> extends Object implements IStoredList<T>, IOrderedList<T>
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ExternallyLockedStoredList.ObjectInfo<T> |
static class |
ExternallyLockedStoredList.StoredListIterator<T> |
| Constructor and Description |
|---|
ExternallyLockedStoredList(boolean Support_Random_Scans) |
| Modifier and Type | Method and Description |
|---|---|
IObjectInfo<T> |
add(T subject)
store an element
|
IObjectInfo<T> |
addUnlocked(T subject)
store an element, while the SL is unlocked
|
boolean |
contains(T obj)
is this object contained in the SL ?
|
void |
dump(org.slf4j.Logger logger,
String msg)
Dump list content, used for Debug.
|
IStoredListIterator<T> |
establishListOrderedScan(IObjectInfo<T> OrderedScanPivot,
boolean ascending)
establish a scan position in one direction ascending (twrds head) or descending (towards
tail).
|
ExternallyLockedStoredList.StoredListIterator<T> |
establishListScan(boolean random_scan)
establish a scan position.
|
protected ExternallyLockedStoredList.StoredListIterator<T> |
establishOrderedPos(ExternallyLockedStoredList.ObjectInfo<T> OrderedScanPivot,
boolean ascending,
ExternallyLockedStoredList.StoredListIterator<T> res) |
protected ExternallyLockedStoredList.StoredListIterator<T> |
establishPos(boolean random_scan,
ExternallyLockedStoredList.StoredListIterator<T> res) |
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()
get head of SL
|
Object |
getKey(int id) |
IObjectInfo<T> |
getLargerInOrder(IObjectInfo<T> ref)
in an ordered SL, get the element larger than ref
|
T |
getObjectFromHead()
get object from head of SL
|
IObjectInfo<T> |
getSmallerInOrder(IObjectInfo<T> ref)
in an ordered SL, get the element smaller than ref
|
IStoredList<T> |
getValue(int id) |
boolean |
invalidate()
Sets an indication that this StoredList is invalid.
|
boolean |
isEmpty()
Returns true if this list is empty, i.e.
|
protected boolean |
isInvalid() |
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
|
protected IStoredListIterator<T> |
nextPos(ExternallyLockedStoredList.StoredListIterator<T> slh) |
boolean |
optimizeScanForSingleObject()
return true if we can save iterator creation and get a single entry
|
void |
remove(IObjectInfo<T> oi)
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> oi)
remove an element described by ObjectInfo, while the SL is unlocked
|
int |
size()
Returns the amount of elements in the StoredList.
|
IObjectInfo<T> |
storeBeforeCeiling(IObjectInfo<T> theCeiling,
T subject)
given an ObjectInfo of an existing element, store a new element right "before" this one.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitestablishListScanpublic ExternallyLockedStoredList(boolean Support_Random_Scans)
public int size()
ICollectionsize in interface ICollection<T>ICollection.isEmpty()public boolean optimizeScanForSingleObject()
optimizeScanForSingleObject in interface IStoredList<T>public boolean isEmpty()
ICollectionisEmpty in interface ICollection<T>true if list is empty; false otherwise.public IObjectInfo<T> getHead()
getHead in interface IStoredList<T>public T getObjectFromHead()
getObjectFromHead in interface IStoredList<T>protected ExternallyLockedStoredList.StoredListIterator<T> establishPos(boolean random_scan, ExternallyLockedStoredList.StoredListIterator<T> res)
protected ExternallyLockedStoredList.StoredListIterator<T> establishOrderedPos(ExternallyLockedStoredList.ObjectInfo<T> OrderedScanPivot, boolean ascending, ExternallyLockedStoredList.StoredListIterator<T> res)
protected IStoredListIterator<T> nextPos(ExternallyLockedStoredList.StoredListIterator<T> slh)
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)
addUnlocked in interface IStoredList<T>subject - element to store.null if
StoredList has been invalidated.public IObjectInfo<T> storeBeforeCeiling(IObjectInfo<T> theCeiling, T subject)
storeBeforeCeiling in interface IOrderedList<T>theCeiling - a ceiling to the new element (towards the head); when null, the
ceiling will be the Head.subject - a new element, to be inserted before the ceiling (towards the tail)Note: not relevant for random scans
public IObjectInfo<T> getLargerInOrder(IObjectInfo<T> ref)
getLargerInOrder in interface IOrderedList<T>ref - a reference to an OI (element in the )public IObjectInfo<T> getSmallerInOrder(IObjectInfo<T> ref)
getSmallerInOrder in interface IOrderedList<T>ref - a reference to an OI (element in the )public void remove(IObjectInfo<T> oi)
remove in interface IStoredList<T>oi - an existing element between Tail and Headpublic void removeUnlocked(IObjectInfo<T> oi)
removeUnlocked in interface IStoredList<T>oi - an existing element between Tail and Headpublic 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.protected boolean isInvalid()
public void dump(org.slf4j.Logger logger,
String msg)
IStoredListdump in interface IStoredList<T>logger - logger to usemsg - message to add in logpublic ExternallyLockedStoredList.StoredListIterator<T> establishListScan(boolean random_scan)
establishListScan in interface ICollection<T>random_scan - true enable random scan; false start from head.public IStoredListIterator<T> establishListOrderedScan(IObjectInfo<T> OrderedScanPivot, boolean ascending)
establishListOrderedScan in interface IOrderedList<T>OrderedScanPivot - a pivot from which to start this scan. if null, pivot is
Head (if ascending is true); Tail otherwiseascending - if true scan from pivot towards head; if
false scan from pivot towards tail.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 boolean isMultiObjectCollection()
ICollectionisMultiObjectCollection in interface ICollection<T>true if its an actual list; false otherwisepublic boolean isIterator()
IObjectsListisIterator in interface IObjectsListpublic 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.