|
healpix.core.base.set
Class LongSet
java.lang.Object
healpix.core.base.set.LongCollection
healpix.core.base.set.LongSet
- All Implemented Interfaces:
- Serializable, Iterable<Long>
public class LongSet - extends LongCollection
- implements Serializable
In Java Collections this class corresponds to TreeSet of longs. Is sorted,
and contains only unique values. But memory requirements are greatly
optimized (1000x times)
This class represents bit array based sets of long values. When a
bit in the underlying array is set, the value having the same
number as the bit is contained in the array. This implies that
bit sets cannot contain negative values.
To improve memory performance, bit array is based in slot by 1e6,
so when one number is allocated at 1e10, only one slot of size 1e6 is consumed.
This class have very good IO speed and good memory consumption. But
memory consumption is still linear, so for readonly sets LongRangeSet is better option
- See Also:
- Serialized Form
LongSet
public LongSet()
LongSet
public LongSet(int slotSize)
LongSet
public LongSet(LongCollection set)
LongSet
public LongSet(long[] set)
LongSet
public LongSet(LongIterator longIterator)
add
public void add(long v)
- Description copied from class:
LongCollection
- Add value to set
- Specified by:
add in class LongCollection
- Parameters:
v - value to add
clear
public void clear()
- Description copied from class:
LongCollection
- remove all iterms from set
- Specified by:
clear in class LongCollection
contains
public boolean contains(long v)
- Specified by:
contains in class LongCollection
- Parameters:
v - value
- Returns:
- true if set contains given value
longIterator
public LongIterator longIterator()
- Specified by:
longIterator in class LongCollection
- Returns:
- iterator LongIterator over values in this set with primitive long
size
public int size()
- Description copied from class:
LongCollection
- Count elements in set.
- Specified by:
size in class LongCollection
- Returns:
- number of elements in this set
remove
public void remove(long v)
- Description copied from class:
LongCollection
- remove given element from set
- Specified by:
remove in class LongCollection
- Parameters:
v - to remove
isEmpty
public boolean isEmpty()
- Description copied from class:
LongCollection
- Return true if set is empty.
- Specified by:
isEmpty in class LongCollection
- Returns:
- true if size is empty
toLongRangeSet
public LongRangeSet toLongRangeSet()
- Returns:
- values in this set organized in readonly LongRangeSet
|
|