A Judy1 array is the equivalent of a bit array or
bit map. A bit is addressed by an index (or key). The array may be sparse,
and the index may be any word-sized value. If an index is present, it
represents a set bit (a bit set represents an index present). If an index
is absent, it represents an unset bit (a bit unset represents an absent
index).
Construct an empty Judy1 array.
Set index's bit in the array. Returns true if
index's bit was previously unset (successful), or false
if the bit was already set (unsuccessful).
Unset index's bit in the array; that is, remove index
from the array. Returns true if index's bit was
previously set (successful), or false if the bit was already unset
(unsuccessful).
Returns true if index's bit is set, otherwise
false.
The zero-argument form of count returns
the total number of indices present in the array. The two-argument form of
count returns the number of indices
present between index1 and index2, inclusive. Returns
zero if there are no indices present between index1 and
index2.
Locate the nth index that is present in the array (where
n=1 returns the first index present). To refer to the last index
in a fully populated array (i.e. all indices present, which is rare) use
n=0. Returns nil if at least n indices aren't
present.
Free the entire array (and return the number of bytes freed).
Return the number of bytes of memory currently in use by the array. This is
a very fast routine and may be used after a call to set or unset
with little performance impact.
Search (inclusive) for the first index present that is equal to or greater
than index. Start with index=0 to find the first index in
the array. Returns nil if no indices greater than or equal to
index are found.
Search (exclusive) for the next index present that is greater than
index. Returns nil if no indices greater than
index are found.
Search (inclusive) for the last index present that is equal to or less than
index. Start with index=-1 to find the last index in the
array. Returns nil if no indices less than or equal to
index are found.
Search (exclusive) for the previous index present that is less than
index. Returns nil if no indices less than to
index are found.
Search (inclusive) for the first absent index that is equal to or greater
than index. Start with index=0 to find the first index
absent from the array. Returns nil if no empty indices greater
than or equal to index are found.
Search (exclusive) for the next absent index that is greater than
index. Returns nil if no empty indices greater than
index are found.
Search (inclusive) for the last absent index that is equal to or less than
index. Start with index=-1 to find the last index absent
from the array. Returns nil if no empty indices less than or equal
to index are found.
Search (exclusive) for the previous absent index that is less than
index. Returns nil if no empty indices less than
index are found.
Calls block once for each index present in the array, passing that index as
a parameter.
Calls block once for each index that is absent from the array, passing that
index as a parameter.
Return true if the array is full, false otherwise.