Class AbstractSafeLongArray<V>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static Object NO_VALUE
      A value guaranteed to never be in the array.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract com.oracle.coherence.common.util.AutoLock.Sentry<LongArray<V>> acquireReadLock()
      Acquire the read lock.
      protected abstract com.oracle.coherence.common.util.AutoLock.Sentry<LongArray<V>> acquireWriteLock()
      Acquire the write lock.
      long add​(V oValue)
      Add the passed element value to the LongArray and return the index at which the element value was stored.
      V ceiling​(long lIndex)
      Return the "first" value with an index which is greater than or equal to the specified index.
      long ceilingIndex​(long lIndex)
      Return the "first" index which is greater than or equal to the specified index.
      void clear()
      Remove all nodes from the LongArray.
      abstract AbstractSafeLongArray<V> clone()
      Make a clone of the LongArray.
      boolean contains​(V oValue)
      Determine if the LongArray contains the specified element.
      boolean exists​(long lIndex)
      Determine if the specified index is in use.
      V floor​(long lIndex)
      Return the "first" value with an index which is less than or equal to the specified index.
      long floorIndex​(long lIndex)
      Return the "first" index which is less than or equal to the specified index.
      V get​(long lIndex)
      Return the value stored at the specified index.
      long getFirstIndex()
      Determine the first index that exists in the LongArray.
      long getLastIndex()
      Determine the last index that exists in the LongArray.
      int getSize()
      Determine the size of the LongArray.
      long indexOf​(V oValue)
      Return the index in this LongArray of the first occurrence of the specified element, or NOT_FOUND if this LongArray does not contain the specified element.
      long indexOf​(V oValue, long lIndex)
      Return the index in this LongArray of the first occurrence of the specified element such that (index greater or equal to lIndex), or NOT_FOUND if this LongArray does not contain the specified element.
      protected AbstractSafeLongArray.SafeIterator instantiateSafeIterator​(boolean fForward, long lIndexFrom)
      Instantiate a SafeIterator around the specified delegate iterator.
      boolean isEmpty()
      Test for empty LongArray.
      LongArray.Iterator<V> iterator()
      Obtain a LongArray.Iterator of the contents of the LongArray in order of increasing indices.
      LongArray.Iterator<V> iterator​(long lIndex)
      Obtain a LongArray.Iterator of the contents of the LongArray in order of increasing indices, starting at a particular index such that the first call to next will set the location of the iterator at the first existent index that is greater than or equal to the specified index, or will throw a NoSuchElementException if there is no such existent index.
      long lastIndexOf​(V oValue)
      Return the index in this LongArray of the last occurrence of the specified element, or NOT_FOUND if this LongArray does not contain the specified element.
      long lastIndexOf​(V oValue, long lIndex)
      Return the index in this LongArray of the last occurrence of the specified element such that (index less then or equal to lIndex), or NOT_FOUND if this LongArray does not contain the specified element.
      V remove​(long lIndex)
      Remove the specified index from the LongArray, returning its associated value.
      void remove​(long lIndexFrom, long lIndexTo)
      Remove all nodes in the specified range.
      LongArray.Iterator<V> reverseIterator()
      Obtain a LongArray.Iterator of the contents of the LongArray in reverse order (decreasing indices).
      LongArray.Iterator<V> reverseIterator​(long lIndex)
      Obtain a LongArray.Iterator of the contents of the LongArray in reverse order (decreasing indices), starting at a particular index such that the first call to next will set the location of the iterator at the first existent index that is less than or equal to the specified index, or will throw a NoSuchElementException if there is no such existent index.
      V set​(long lIndex, V oValue)
      Add the passed item to the LongArray at the specified index.
      String toString()
      Provide a string representation of the LongArray.
    • Field Detail

      • NO_VALUE

        protected static final Object NO_VALUE
        A value guaranteed to never be in the array.
    • Constructor Detail

      • AbstractSafeLongArray

        public AbstractSafeLongArray()
    • Method Detail

      • get

        public V get​(long lIndex)
        Description copied from interface: LongArray
        Return the value stored at the specified index.
        Specified by:
        get in interface LongArray<V>
        Parameters:
        lIndex - a long index value
        Returns:
        the object stored at the specified index, or null
      • floorIndex

        public long floorIndex​(long lIndex)
        Description copied from interface: LongArray
        Return the "first" index which is less than or equal to the specified index.
        Specified by:
        floorIndex in interface LongArray<V>
        Parameters:
        lIndex - the index
        Returns:
        the index or NOT_FOUND
      • floor

        public V floor​(long lIndex)
        Description copied from interface: LongArray
        Return the "first" value with an index which is less than or equal to the specified index.
        Specified by:
        floor in interface LongArray<V>
        Parameters:
        lIndex - the index
        Returns:
        the value or null
      • ceilingIndex

        public long ceilingIndex​(long lIndex)
        Description copied from interface: LongArray
        Return the "first" index which is greater than or equal to the specified index.
        Specified by:
        ceilingIndex in interface LongArray<V>
        Parameters:
        lIndex - the index
        Returns:
        the index or NOT_FOUND
      • ceiling

        public V ceiling​(long lIndex)
        Description copied from interface: LongArray
        Return the "first" value with an index which is greater than or equal to the specified index.
        Specified by:
        ceiling in interface LongArray<V>
        Parameters:
        lIndex - the index
        Returns:
        the value or null
      • set

        public V set​(long lIndex,
                     V oValue)
        Description copied from interface: LongArray
        Add the passed item to the LongArray at the specified index.

        If the index is already used, the passed value will replace the current value stored with the key, and the replaced value will be returned.

        It is expected that LongArray implementations will "grow" as necessary to support the specified index.

        Specified by:
        set in interface LongArray<V>
        Parameters:
        lIndex - a long index value
        oValue - the object to store at the specified index
        Returns:
        the object that was stored at the specified index, or null
      • add

        public long add​(V oValue)
        Description copied from interface: LongArray
        Add the passed element value to the LongArray and return the index at which the element value was stored.
        Specified by:
        add in interface LongArray<V>
        Parameters:
        oValue - the object to add to the LongArray
        Returns:
        the long index value at which the element value was stored
      • exists

        public boolean exists​(long lIndex)
        Description copied from interface: LongArray
        Determine if the specified index is in use.
        Specified by:
        exists in interface LongArray<V>
        Parameters:
        lIndex - a long index value
        Returns:
        true if a value (including null) is stored at the specified index, otherwise false
      • remove

        public V remove​(long lIndex)
        Description copied from interface: LongArray
        Remove the specified index from the LongArray, returning its associated value.
        Specified by:
        remove in interface LongArray<V>
        Parameters:
        lIndex - the index into the LongArray
        Returns:
        the associated value (which can be null) or null if the specified index is not in the LongArray
      • remove

        public void remove​(long lIndexFrom,
                           long lIndexTo)
        Description copied from interface: LongArray
        Remove all nodes in the specified range.
        Specified by:
        remove in interface LongArray<V>
        Parameters:
        lIndexFrom - the floor index
        lIndexTo - the ceiling index (exclusive)
      • contains

        public boolean contains​(V oValue)
        Description copied from interface: LongArray
        Determine if the LongArray contains the specified element.

        More formally, returns true if and only if this LongArray contains at least one element e such that (o==null ? e==null : o.equals(e)).

        Specified by:
        contains in interface LongArray<V>
        Parameters:
        oValue - element whose presence in this list is to be tested
        Returns:
        true if this list contains the specified element
      • clear

        public void clear()
        Description copied from interface: LongArray
        Remove all nodes from the LongArray.
        Specified by:
        clear in interface LongArray<V>
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: LongArray
        Test for empty LongArray.
        Specified by:
        isEmpty in interface LongArray<V>
        Returns:
        true if LongArray has no nodes
      • getSize

        public int getSize()
        Description copied from interface: LongArray
        Determine the size of the LongArray.
        Specified by:
        getSize in interface LongArray<V>
        Returns:
        the number of nodes in the LongArray
      • getFirstIndex

        public long getFirstIndex()
        Description copied from interface: LongArray
        Determine the first index that exists in the LongArray.
        Specified by:
        getFirstIndex in interface LongArray<V>
        Returns:
        the lowest long value that exists in this LongArray, or NOT_FOUND if the LongArray is empty
      • getLastIndex

        public long getLastIndex()
        Description copied from interface: LongArray
        Determine the last index that exists in the LongArray.
        Specified by:
        getLastIndex in interface LongArray<V>
        Returns:
        the highest long value that exists in this LongArray, or NOT_FOUND if the LongArray is empty
      • indexOf

        public long indexOf​(V oValue)
        Description copied from interface: LongArray
        Return the index in this LongArray of the first occurrence of the specified element, or NOT_FOUND if this LongArray does not contain the specified element.
        Specified by:
        indexOf in interface LongArray<V>
        Parameters:
        oValue - the object to find index for
        Returns:
        the index of the specified object in the LongArray
      • indexOf

        public long indexOf​(V oValue,
                            long lIndex)
        Description copied from interface: LongArray
        Return the index in this LongArray of the first occurrence of the specified element such that (index greater or equal to lIndex), or NOT_FOUND if this LongArray does not contain the specified element.
        Specified by:
        indexOf in interface LongArray<V>
        Parameters:
        oValue - the object to find the index for
        lIndex - the index to compare to
        Returns:
        the index of the specified object in the LongArray that is greater or equal to the specified index
      • lastIndexOf

        public long lastIndexOf​(V oValue)
        Description copied from interface: LongArray
        Return the index in this LongArray of the last occurrence of the specified element, or NOT_FOUND if this LongArray does not contain the specified element.
        Specified by:
        lastIndexOf in interface LongArray<V>
        Parameters:
        oValue - the object to find the index for
        Returns:
        the index of the last occurrence of the specified object in the LongArray
      • lastIndexOf

        public long lastIndexOf​(V oValue,
                                long lIndex)
        Description copied from interface: LongArray
        Return the index in this LongArray of the last occurrence of the specified element such that (index less then or equal to lIndex), or NOT_FOUND if this LongArray does not contain the specified element.
        Specified by:
        lastIndexOf in interface LongArray<V>
        Parameters:
        oValue - the object to find the index for
        lIndex - the index to compare to
        Returns:
        the index of the specified object in this LongArray that is less or equal to the specified index
      • iterator

        public LongArray.Iterator<V> iterator()
        Description copied from interface: LongArray
        Obtain a LongArray.Iterator of the contents of the LongArray in order of increasing indices.
        Specified by:
        iterator in interface Iterable<V>
        Specified by:
        iterator in interface LongArray<V>
        Returns:
        an instance of LongArray.Iterator
      • iterator

        public LongArray.Iterator<V> iterator​(long lIndex)
        Description copied from interface: LongArray
        Obtain a LongArray.Iterator of the contents of the LongArray in order of increasing indices, starting at a particular index such that the first call to next will set the location of the iterator at the first existent index that is greater than or equal to the specified index, or will throw a NoSuchElementException if there is no such existent index.
        Specified by:
        iterator in interface LongArray<V>
        Parameters:
        lIndex - the LongArray index to iterate from
        Returns:
        an instance of LongArray.Iterator
      • reverseIterator

        public LongArray.Iterator<V> reverseIterator()
        Description copied from interface: LongArray
        Obtain a LongArray.Iterator of the contents of the LongArray in reverse order (decreasing indices).
        Specified by:
        reverseIterator in interface LongArray<V>
        Returns:
        an instance of LongArray.Iterator
      • reverseIterator

        public LongArray.Iterator<V> reverseIterator​(long lIndex)
        Description copied from interface: LongArray
        Obtain a LongArray.Iterator of the contents of the LongArray in reverse order (decreasing indices), starting at a particular index such that the first call to next will set the location of the iterator at the first existent index that is less than or equal to the specified index, or will throw a NoSuchElementException if there is no such existent index.
        Specified by:
        reverseIterator in interface LongArray<V>
        Parameters:
        lIndex - the LongArray index to iterate from
        Returns:
        an instance of LongArray.Iterator
      • toString

        public String toString()
        Description copied from interface: LongArray
        Provide a string representation of the LongArray.
        Specified by:
        toString in interface LongArray<V>
        Overrides:
        toString in class Object
        Returns:
        a human-readable String value describing the LongArray instance
      • clone

        public abstract AbstractSafeLongArray<V> clone()
        Description copied from interface: LongArray
        Make a clone of the LongArray. The element values are not deep-cloned.
        Specified by:
        clone in interface LongArray<V>
        Overrides:
        clone in class Object
        Returns:
        a clone of this LongArray object
      • acquireReadLock

        protected abstract com.oracle.coherence.common.util.AutoLock.Sentry<LongArray<V>> acquireReadLock()
        Acquire the read lock.
        Returns:
        the lock sentry
      • acquireWriteLock

        protected abstract com.oracle.coherence.common.util.AutoLock.Sentry<LongArray<V>> acquireWriteLock()
        Acquire the write lock.
        Returns:
        the lock sentry
      • instantiateSafeIterator

        protected AbstractSafeLongArray.SafeIterator instantiateSafeIterator​(boolean fForward,
                                                                             long lIndexFrom)
        Instantiate a SafeIterator around the specified delegate iterator.
        Parameters:
        fForward - true if a forward iterator is to be returned
        lIndexFrom - the start index
        Returns:
        the safe iterator