NASA - Jet Propulsion Laboratory
    + View the NASA Portal
Search JPL
Jet Propulsion Laboratory Home Earth Solar System Stars & Galaxies Technology
Introduction Background Software Links


healpix.core.base.set
Class LongSet

java.lang.Object
  extended by healpix.core.base.set.LongCollection
      extended by 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

Constructor Summary
LongSet()
           
LongSet(int slotSize)
           
LongSet(long[] set)
           
LongSet(LongCollection set)
           
LongSet(LongIterator longIterator)
           
 
Method Summary
 void add(long v)
          Add value to set
 void clear()
          remove all iterms from set
 boolean contains(long v)
           
 boolean isEmpty()
          Return true if set is empty.
 LongIterator longIterator()
           
 void remove(long v)
          remove given element from set
 int size()
          Count elements in set.
 LongRangeSet toLongRangeSet()
           
 
Methods inherited from class healpix.core.base.set.LongCollection
addAll, addAll, addAll, addAll, addRange, iterator, toArray, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongSet

public LongSet()

LongSet

public LongSet(int slotSize)

LongSet

public LongSet(LongCollection set)

LongSet

public LongSet(long[] set)

LongSet

public LongSet(LongIterator longIterator)
Method Detail

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

"Built from revision exported"

Privacy / Copyright
FIRST GOV Contact: NASA Home Page Site Manager:
Webmaster:

CL 03-2650