|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthealpix.core.base.set.LongRangeSet
public class LongRangeSet
This class represents range based sets of long values. First and last boundaries are stored in sorted long[] array so it consumes very little place This is essentially equivilent to run length encoding of a bitmap-based set and thus works very well for sets with long runs of integers, but is quite poor for sets with very short runs.
Is readonly, so is thread safe.
To construct new LongRangeSet use LongRangeSetBuilder
if
our values are sorted. Or use LongSet
if our values are unsorted.
Inspired by Justin F. Chapweske and Soren Bak
Constructor Summary | |
---|---|
LongRangeSet()
empty constructor for serialization |
|
LongRangeSet(long[] values,
int size)
Construct new LongRangeSet from given values Dont use directly, use LongRangeSetBuilder instead
This constructor makes integrity check and copyes values into new array. |
Method Summary | |
---|---|
LongRangeSet |
complement()
Create new LongRangeSet with complement (inversion) of values in this set. |
boolean |
contains(long i)
|
boolean |
containsAll(LongIterator iter)
|
boolean |
containsAll(long first,
long last)
|
boolean |
containsAll(LongRangeIterator iter)
|
boolean |
containsAny(LongIterator iter)
|
boolean |
containsAny(long first,
long last)
|
boolean |
containsAny(LongRangeIterator iter)
|
boolean |
equals(Object obj)
|
long |
first()
|
int |
hashCode()
|
LongRangeSet |
intersect(LongRangeSet rs)
Construct new LongRangeSet with intersection of values from original set and parameter set. |
boolean |
isEmpty()
|
Iterator<Long> |
iterator()
|
long |
last()
|
LongIterator |
longIterator()
|
int |
rangeCount()
|
LongRangeIterator |
rangeIterator()
|
void |
readExternal(ObjectInput in)
|
long |
size()
|
LongRangeSet |
substract(LongRangeSet rs)
Construct new LongRangeSet with values which are in original set, but not in parameter. |
long[] |
toArray()
Convert all items in range set to array. |
LongSet |
toLongSet()
Converts to LongSet which can be modified |
String |
toString()
|
LongRangeSet |
union(LongRangeSet rs)
Create new LongRangeSet which contains union of values from original set and parameter This operation is FAST. |
void |
writeExternal(ObjectOutput out)
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LongRangeSet()
public LongRangeSet(long[] values, int size)
Dont use directly, use LongRangeSetBuilder
instead
This constructor makes integrity check and copyes values into new array. When LongRangeSet is constructed inside LongRangeSet this operation can be skipped and set can be constructed way faster.
Method Detail |
---|
public LongIterator longIterator()
public LongRangeIterator rangeIterator()
public Iterator<Long> iterator()
iterator
in interface Iterable<Long>
public long first()
NoSuchElementException
- if set isEmpty()public long last()
NoSuchElementException
- if set isEmpty()public boolean contains(long i)
i
- The integer to check to see if it is in this set..
public boolean containsAll(long first, long last)
public boolean containsAny(long first, long last)
public boolean containsAll(LongIterator iter)
public boolean containsAny(LongIterator iter)
public boolean containsAll(LongRangeIterator iter)
public boolean containsAny(LongRangeIterator iter)
public LongSet toLongSet()
public long size()
public int rangeCount()
public long[] toArray()
public String toString()
toString
in class Object
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public LongRangeSet complement()
This operation is FAST. Requires only one traversal of ranges. It does not decompress RangeSet to pixels.
This operation does not modify original collection.
public LongRangeSet union(LongRangeSet rs)
This operation is FAST. Requires only one traversal of ranges. It does not decompress RangeSet to pixels.
This operation does not modify original collection.
rs
- LongRangeSet to make union with
public LongRangeSet intersect(LongRangeSet rs)
This operation is FAST. Requires only one traversal of ranges. It does not decompress RangeSet to pixels.
This operation does not modify original collection.
rs
- The set with which to intersect with this set.
public LongRangeSet substract(LongRangeSet rs)
[1-5].substract[4-6] == [1-3]
This operation is FAST. Requires only one traversal of ranges. It does not decompress RangeSet to pixels.
This operation does not modify original collection.
substract this set from original
public boolean isEmpty()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
|
"Built from revision exported" | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |