Package cds.healpix

Class FlatHashList

  • All Implemented Interfaces:
    FlatHashIterable, ListOfHash

    public final class FlatHashList
    extends java.lang.Object
    implements ListOfHash
    This class is used when the number of Hash returned y a function is not necessarily known in advance but has an upper bound. It is basically a read-only array list on long primitives.
    Author:
    F.-X. Pineau
    • Constructor Summary

      Constructors 
      Constructor Description
      FlatHashList​(int depth, int capacity)
      The capacity of the flat list, i.e.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void arraycopy​(int srcPos, long[] dest, int destPos, int length)
      Similar to System.arraycopy(Object, int, Object, int, int) except that the source is the internal list.
      int capacity()
      Returns the maximum number of elements that can be stored in this list.
      void clear()  
      long get​(int i)
      Returns the element at the given index i in the list.
      FlatHashIterator iterator()  
      FlatHashList put​(long hash)  
      FlatHashList put​(ListOfHash hashes)  
      int size()
      Returns the current number of elements in the flat list.
      void sortByHashAsc()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • FlatHashList

        public FlatHashList​(int depth,
                            int capacity)
        The capacity of the flat list, i.e. its maximum size, i.e the length of the internal array used to store the list elements.
        Parameters:
        depth - depth of the hash in the list.
        capacity - maximum size the list.
    • Method Detail

      • capacity

        public int capacity()
        Returns the maximum number of elements that can be stored in this list.
        Returns:
        the maximum number of elements that can be stored in this list.
      • clear

        public void clear()
      • sortByHashAsc

        public void sortByHashAsc()
      • size

        public int size()
        Description copied from interface: ListOfHash
        Returns the current number of elements in the flat list.
        Specified by:
        size in interface ListOfHash
        Returns:
        the current number of elements in the flat list.
      • get

        public long get​(int i)
        Description copied from interface: ListOfHash
        Returns the element at the given index i in the list.
        Specified by:
        get in interface ListOfHash
        Parameters:
        i - index in the list of the element to be returned.
        Returns:
        the element at the given index i in the list.
      • arraycopy

        public void arraycopy​(int srcPos,
                              long[] dest,
                              int destPos,
                              int length)
        Description copied from interface: ListOfHash
        Similar to System.arraycopy(Object, int, Object, int, int) except that the source is the internal list.
        Specified by:
        arraycopy in interface ListOfHash
        Parameters:
        srcPos - see System.arraycopy(Object, int, Object, int, int)
        dest - see System.arraycopy(Object, int, Object, int, int)
        destPos - see System.arraycopy(Object, int, Object, int, int)
        length - see System.arraycopy(Object, int, Object, int, int)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object