Class AbstractStoredList<T>

java.lang.Object
com.j_spaces.kernel.AbstractStoredList<T>
All Implemented Interfaces:
IHashEntry<Object,IStoredList<T>>, ICollection<T>, IStoredList<T>, IObjectsList, Iterable<T>
Direct Known Subclasses:
SimpleLockStoredList

public abstract class AbstractStoredList<T> extends Object implements IStoredList<T>, Iterable<T>
An abstract implementation of the IStoredList, provides common
Since:
6.1
Author:
Guy Korland
  • Field Details

    • SCAN_LIMIT

      protected static final int SCAN_LIMIT
      See Also:
    • NUMBER_OF_OCCUPIED_POS_QUOTA

      protected static final int NUMBER_OF_OCCUPIED_POS_QUOTA
      See Also:
    • MINIMAL_NUMBER_TO_HANDLE_POSITIONS

      protected static final int MINIMAL_NUMBER_TO_HANDLE_POSITIONS
      See Also:
    • m_BasicOccupied

      protected ArrayList<com.j_spaces.kernel.AbstractStoredList.ObjectInfo<T>> m_BasicOccupied
    • m_AllOccupiedPos

      protected ArrayList<ArrayList<com.j_spaces.kernel.AbstractStoredList.ObjectInfo<T>>> m_AllOccupiedPos
    • m_Size

      protected int m_Size
    • m_Support_Random_Scans

      protected boolean m_Support_Random_Scans
    • m_LastChunk

      protected int m_LastChunk
    • m_LastPos

      protected int m_LastPos
    • m_Tail

      protected com.j_spaces.kernel.AbstractStoredList.ObjectInfo<T> m_Tail
    • m_Head

      protected com.j_spaces.kernel.AbstractStoredList.ObjectInfo<T> m_Head
  • Constructor Details

    • AbstractStoredList

      protected AbstractStoredList(boolean Support_Random_Scans)
  • Method Details

    • dump

      public void dump(org.slf4j.Logger logger, String msg)
      Description copied from interface: IStoredList
      Dump list content, used for Debug.
      Specified by:
      dump in interface IStoredList<T>
      Parameters:
      logger - logger to use
      msg - message to add in log
    • establishListScan

      public StoredListIterator<T> establishListScan(boolean random_scan)
      establish a scan position. if random scanning supported we select a random position
      Specified by:
      establishListScan in interface ICollection<T>
      Parameters:
      random_scan - true enable random scan; false start from head.
      Returns:
      a Holder for this scan. This Resource should be released if scan ended prematurely.
    • establishListScan

      public StoredListIterator<T> establishListScan(boolean random_scan, boolean alternatingThread)
      Description copied from interface: ICollection
      establish a scan position. if random scan is supported we select a random position; otherwise we return the first resource by scanning from head to tail.
      Specified by:
      establishListScan in interface ICollection<T>
      Parameters:
      random_scan - true enable random scan; false start from head.
      alternatingThread - true the result iter many be used by a not-same thread
      Returns:
      a Holder for this scan. This Resource should be released if scan ended prematurely.
    • iterate

      protected abstract boolean iterate(boolean random_scan, StoredListIterator<T> slh)
      Parameters:
      random_scan -
      slh -
    • next

      get the next element in scan order
      Specified by:
      next in interface ICollection<T>
      Parameters:
      slh - Holder representing a pivot position.
      Returns:
      the next pivot position in this scan; null if reached end of scan.
    • nextPos

      public abstract boolean nextPos(StoredListIterator<T> slh)
      Parameters:
      slh -
    • freeSLHolder

      public 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
      Specified by:
      freeSLHolder in interface IStoredList<T>
      Parameters:
      slh - Holder resource to return to pool; can be null.
    • removeByObject_impl

      protected boolean removeByObject_impl(Object obj)
    • contains_impl

      protected boolean contains_impl(T obj)
    • remove_impl

      protected void remove_impl(com.j_spaces.kernel.AbstractStoredList.ObjectInfo<T> oiToRemove)
      remove an element described by ObjectInfo
    • isInvalid

      protected abstract boolean isInvalid()
      Returns:
      true if the list is invalid
    • store_impl

      protected com.j_spaces.kernel.AbstractStoredList.ObjectInfo<T> store_impl(T subject)
      store an element
    • storeBeforeCeiling_impl

      protected com.j_spaces.kernel.AbstractStoredList.ObjectInfo<T> storeBeforeCeiling_impl(com.j_spaces.kernel.AbstractStoredList.ObjectInfo<T> theCeiling, T subject)
    • isMultiObjectCollection

      public boolean isMultiObjectCollection()
      Description copied from interface: ICollection
      is it an actual multi object container.
      Specified by:
      isMultiObjectCollection in interface ICollection<T>
      Returns:
      true if its an actual list; false otherwise
    • iterator

      public Iterator<T> iterator(boolean randomScan)
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • isIterator

      public boolean isIterator()
      Description copied from interface: IObjectsList
      is the list an iterator or basic list ?
      Specified by:
      isIterator in interface IObjectsList