final FileOutputStream fos = new FileOutputStream(tmpfile); BitSet Bitmap = BitSet.bitmapOf(0, 2, 55, 64, 512); Bitmap.serialize(new DataOutputStream(fos)); RandomAccessFile memoryMappedFile = new RandomAccessFile(tmpfile, "r"); ByteBuffer bb = memoryMappedFile.getChannel().map( FileChannel.MapMode.READ_ONLY, 0, totalcount); ImmutableBitSet mapped = new ImmutableBitSet(bb.asLongBuffer());
| Modifier and Type | Field and Description |
|---|---|
| private LongBuffer |
| Access | Constructor and Description |
|---|---|
| public | ImmutableBitSet(final LongBuffer
the data source bs)Construct a ImmutableBitSet from the content of the LongBuffer which should have been initialized with BitSet.serialize (from the BitSet in this same package). |
| Modifier and Type | Method and Description |
|---|---|
| public BitSet | |
| public int | |
| public ImmutableBitSet | |
| public boolean | |
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Indicates whether some other object is "equal to" this one. |
| public boolean | |
| public int | getNumberOfWords()
Implements com. Get the total number of words contained in this data structure. |
| public long | getWord(int
the index index)Implements com. Get the word at the given index |
| public int | |
| public boolean | Returns: true if they have a non-empty intersection (result of AND)other bitset bs)Checks whether two bitsets intersect. |
| public IntIterator | |
| public Iterator | |
| public int | Returns: next set bit or -1current set bit i)Usage: for(int i=bs.nextSetBit(0); i>=0; i=bs.nextSetBit(i+1)) { operate on index i here } |
| public int | Returns: next unset bit or -1current unset bit i)Usage: for(int i=bs.nextUnsetBit(0); i>=0; i=bs.nextUnsetBit(i+1)) { operate on index i here } |
| public int | |
| public String | |
| public IntIterator |
| data | back to summary |
|---|---|
| private LongBuffer data | |
| ImmutableBitSet | back to summary |
|---|---|
| public ImmutableBitSet(final LongBuffer bs) Construct a ImmutableBitSet from the content of the LongBuffer which should have been initialized with BitSet.serialize (from the BitSet in this same package). The input is not modified.
| |
| asBitSet | back to summary |
|---|---|
| public BitSet asBitSet() Get a copy of this ImmutableBitSet as a mutable BitSet.
| |
| cardinality | back to summary |
|---|---|
| public int cardinality() Compute the number of bits set to 1
| |
| clone | back to summary |
|---|---|
| public ImmutableBitSet clone() Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| empty | back to summary |
|---|---|
| public boolean empty() Check whether a bitset contains a set bit.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| get | back to summary |
|---|---|
| public boolean get(final int i) get value of bit i
| |
| getNumberOfWords | back to summary |
|---|---|
| public int getNumberOfWords() Implements com. Doc from com. Get the total number of words contained in this data structure.
| |
| getWord | back to summary |
|---|---|
| public long getWord(int index) Implements com. Doc from com. Get the word at the given index
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| intersects | back to summary |
|---|---|
| public boolean intersects(BitSet bs) Checks whether two bitsets intersect.
| |
| intIterator | back to summary |
|---|---|
| public IntIterator intIterator() Iterate over the set bits
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over elements of type | |
| nextSetBit | back to summary |
|---|---|
| public int nextSetBit(final int i) Usage: for(int i=bs.nextSetBit(0); i>=0; i=bs.nextSetBit(i+1)) { operate on index i here }
| |
| nextUnsetBit | back to summary |
|---|---|
| public int nextUnsetBit(final int i) Usage: for(int i=bs.nextUnsetBit(0); i>=0; i=bs.nextUnsetBit(i+1)) { operate on index i here }
| |
| size | back to summary |
|---|---|
| public int size() Query the size
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |
| unsetIntIterator | back to summary |
|---|---|
| public IntIterator unsetIntIterator() Iterate over the unset bits
| |