Class HorizontalPositionsList


  • public final class HorizontalPositionsList
    extends Object
    Creation-Date: 26.08.2007, 15:06:45
    Author:
    Thomas Morgner
    • Constructor Detail

      • HorizontalPositionsList

        public HorizontalPositionsList()
      • HorizontalPositionsList

        public HorizontalPositionsList​(int increment,
                                       boolean enableQuickLookup)
    • Method Detail

      • clear

        public void clear()
      • isEnableQuickLookup

        public boolean isEnableQuickLookup()
      • setEnableQuickLookup

        public void setEnableQuickLookup​(boolean enableQuickLookup)
      • size

        public int size()
      • ensureCapacity

        public void ensureCapacity​(int c)
        Ensures, that the list backend can store at least c elements. This method does nothing, if the new capacity is less than the current capacity.
        Parameters:
        c - the new capacity of the list.
      • getAge

        public long getAge​(long key)
      • add

        public boolean add​(long key,
                           long age)
      • remove

        public boolean remove​(long key)
      • getNext

        public long getNext​(long key)
      • getPrevious

        public long getPrevious​(long key)
        Returns the entry that is either equal or less than this key.
        Parameters:
        key -
        Returns:
      • containsKey

        public boolean containsKey​(long key)
      • getKeys

        public long[] getKeys()
        Copys the list contents into a new array.
        Returns:
        the list contents as array.
      • getKeys

        public long[] getKeys​(long[] retval)
      • findKeyPosition

        public int findKeyPosition​(long coordinate,
                                   boolean greater)
        Tries to locate the key that matches the given key-parameter as closely as possible. If greater is set to true, then - if the coordinate is not contained in the list - the next coordinate is given, else the previous one is returned.
        Parameters:
        coordinate -
        greater -
        Returns:
      • getKeyAt

        public long getKeyAt​(int indexPosition)
      • findKey

        public long findKey​(long key,
                            boolean upperBounds)
      • removeAll

        public boolean removeAll​(long age)
        Expects a sorted (ascending) list of cut-entries that should be removed. You will run into troubles if the list is not sorted.
        Parameters:
        age - the age. All keys with a age smaller than that will be eliminated.
        Returns:
        true, if at least one key was removed, false otherwise.