Package cds.healpix
Class FlatHashList
- java.lang.Object
-
- cds.healpix.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 voidarraycopy(int srcPos, long[] dest, int destPos, int length)Similar toSystem.arraycopy(Object, int, Object, int, int)except that the source is the internal list.intcapacity()Returns the maximum number of elements that can be stored in this list.voidclear()longget(int i)Returns the element at the given indexiin the list.FlatHashIteratoriterator()FlatHashListput(long hash)FlatHashListput(ListOfHash hashes)intsize()Returns the current number of elements in the flat list.voidsortByHashAsc()java.lang.StringtoString()
-
-
-
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()
-
put
public FlatHashList put(long hash)
-
put
public FlatHashList put(ListOfHash hashes)
-
sortByHashAsc
public void sortByHashAsc()
-
size
public int size()
Description copied from interface:ListOfHashReturns the current number of elements in the flat list.- Specified by:
sizein interfaceListOfHash- Returns:
- the current number of elements in the flat list.
-
get
public long get(int i)
Description copied from interface:ListOfHashReturns the element at the given indexiin the list.- Specified by:
getin interfaceListOfHash- Parameters:
i- index in the list of the element to be returned.- Returns:
- the element at the given index
iin the list.
-
arraycopy
public void arraycopy(int srcPos, long[] dest, int destPos, int length)Description copied from interface:ListOfHashSimilar toSystem.arraycopy(Object, int, Object, int, int)except that the source is the internal list.- Specified by:
arraycopyin interfaceListOfHash- Parameters:
srcPos- seeSystem.arraycopy(Object, int, Object, int, int)dest- seeSystem.arraycopy(Object, int, Object, int, int)destPos- seeSystem.arraycopy(Object, int, Object, int, int)length- seeSystem.arraycopy(Object, int, Object, int, int)
-
iterator
public FlatHashIterator iterator()
- Specified by:
iteratorin interfaceFlatHashIterable
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-