|
Extension SDK 10.1.2 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.javatools.editor.language.BooleanBitmap
The BooleanBitmap
is a bitmap, or array, of boolean
values. This helps to reduce the size of the array to a single bit
per entry rather than 1 byte per entry at the expense of extra
overhead to access the information.
Note that the bitmap does not expand automatically when you access
an entry beyond the end of the bitmap - you must explicitly expand
the bitmap using setSize()
. Also note that if you
do not provide a boolean fill value to use for initialization,
all (new) entries will be left uninitialized when the bitmap is
created or expanded.
Constructor Summary | |
BooleanBitmap(int initialSize)
Constructs a new BooleanBitmap with the given
size, with no automatic initialization performed. |
|
BooleanBitmap(int initialSize,
boolean defaultFill)
Constructs a new BooleanBitmap with the given
size, with automatic initialization to the given fill value. |
Method Summary | |
boolean |
get(int index)
Fetches the boolean value in the bitmap at the given index, which is 0-based. |
int |
getSize()
Fetches the size of the BooleanBitmap in terms of
the number of entries it holds. |
void |
set(int index,
boolean newValue)
Sets the boolean value in the bitmap at the given index, which is 0-based. |
void |
setSize(int requestedSize)
Sets the size of the BooleanBitmap to the given
specified user size. |
java.lang.String |
toString()
Fetch the boolean values of this bitmap as a sequence of 0's and 1's, starting with the 0 offset on the very left. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public BooleanBitmap(int initialSize)
BooleanBitmap
with the given
size, with no automatic initialization performed. If you
need the Bitmap to ensure that all entries are initialized
to some fill value before use, you must use the alternate
constructor call and specify the fill value.
initialSize
- the size of the bitmap in boolean entriespublic BooleanBitmap(int initialSize, boolean defaultFill)
BooleanBitmap
with the given
size, with automatic initialization to the given fill value.
initialSize
- the size of the bitmap in boolean entriesdefaultFill
- the user's default fill to useMethod Detail |
public int getSize()
BooleanBitmap
in terms of
the number of entries it holds. The size of the bitmap is
determined by the initial size of the bitmap (if it is newly
created) or by the last call to setSize().
public void setSize(int requestedSize)
BooleanBitmap
to the given
specified user size. The bitmap will be expanded (with
additional data values initialized to the given fill), or shrunk
depending on requestedSize.
requestedSize
- the new size of the bitmappublic boolean get(int index) throws java.lang.IndexOutOfBoundsException
getSize()
entries, so this index should be from 0
to
getSize()-1
. If the index is beyond the size of
the bitmap, an IndexOutOfBoundsException will be thrown.
index
- the index of the boolean value to get
throws
- an IndexOutOfBoundsException if the index is
not within the proper range of the bitmap
java.lang.IndexOutOfBoundsException
public void set(int index, boolean newValue)
getSize()
entries, so this index should be from 0
to
getSize()-1
. If the index is beyond the size of
the bitmap, an IndexOutOfBoundsException will be thrown.
index
- the index of the boolean value to setnewValue
- the new value to set at the given index
throws
- an IndexOutOfBoundsException if the index is
not within the proper range of the bitmappublic java.lang.String toString()
|
Extension SDK | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1997, 2004, Oracle. All rights reserved.