class Judy implements ArrayAccess (View source)

Class Judy.

Constants

BITSET

Define the Judy Array as a Bitset with keys as Integer and Values as a Boolean.

INT_TO_INT

Define the Judy Array with key/values as Integer, and Integer only.

INT_TO_MIXED

Define the Judy Array with keys as Integer and Values of any type.

STRING_TO_INT

Define the Judy Array with keys as a String and Values as Integer, and Integer only.

STRING_TO_MIXED

Define the Judy Array with keys as a String and Values of any type.

Methods

__construct(int $judy_type)

(PECL judy >= 0.1.1)
Construct a new Judy object. A Judy object can be accessed like a PHP Array.

__destruct()

(PECL judy >= 0.1.1)
Destruct a Judy object.

int
byCount(int $nth_index)

(PECL judy >= 0.1.1)
Locate the Nth index present in the Judy array.

int
count(int $index_start = 0, int $index_end = -1)

(PECL judy >= 0.1.1)
Count the number of elements in the Judy array.

mixed
first(mixed $index = 0)

(PECL judy >= 0.1.1)
Search (inclusive) for the first index present that is equal to or greater than the passed Index.

mixed
firstEmpty(mixed $index = 0)

(PECL judy >= 0.1.1)
Search (inclusive) for the first absent index that is equal to or greater than the passed Index.

free()

(PECL judy >= 0.1.1)
Free the entire Judy array.

int
getType()

(PECL judy >= 0.1.1)
Return an integer corresponding to the Judy type of the current object.

mixed
last(int|string $index = -1)

(PECL judy >= 0.1.1)
Search (inclusive) for the last index present that is equal to or less than the passed Index.

mixed
lastEmpty(int|string $index = -1)

(PECL judy >= 0.1.1)
Search (inclusive) for the last absent index that is equal to or less than the passed Index.

int
memoryUsage()

(PECL judy >= 0.1.1)
Return the memory used by the Judy array.

mixed
next(mixed $index)

(PECL judy >= 0.1.1)
Search (exclusive) for the next index present that is greater than the passed Index.

mixed
nextEmpty(int|string $index)

(PECL judy >= 0.1.1)
Search (exclusive) for the next absent index that is greater than the passed Index.

bool
offsetExists(TKey $offset)

(PECL judy >= 0.1.1)
Whether or not an offset exists.

mixed
offsetGet(TKey $offset)

(PECL judy >= 0.1.1)
Returns the value at specified offset.

void
offsetSet(TKey $offset, TValue $value)

(PECL judy >= 0.1.1)
Assigns a value to the specified offset.

void
offsetUnset(TKey $offset)

(PECL judy >= 0.1.1)
Unsets an offset.

mixed
prev(mixed $index)

(PECL judy >= 0.1.1)
Search (exclusive) for the previous index present that is less than the passed Index.

mixed
prevEmpty(mixed $index)

(PECL judy >= 0.1.1)
Search (exclusive) for the previous index absent that is less than the passed Index.

int
size(int $index_start = 0, int $index_end = -1)

(PECL judy >= 0.1.1)
Count the number of elements in the Judy array.
This method is an alias of const count.

Details

__construct(int $judy_type)

(PECL judy >= 0.1.1)
Construct a new Judy object. A Judy object can be accessed like a PHP Array.

Parameters

int $judy_type

The Judy type to be used.

__destruct()

(PECL judy >= 0.1.1)
Destruct a Judy object.

int byCount(int $nth_index)

(PECL judy >= 0.1.1)
Locate the Nth index present in the Judy array.

Parameters

int $nth_index

Nth index to return. If nth_index equal 1, then it will return the first index in the array.

Return Value

int

Return the index at the given Nth position.

int count(int $index_start = 0, int $index_end = -1)

(PECL judy >= 0.1.1)
Count the number of elements in the Judy array.

Parameters

int $index_start

[optional]

Start counting from the given index. Default is first index.

int $index_end

[optional]

Stop counting when reaching this index. Default is last index.

Return Value

int

Return the number of elements.

mixed first(mixed $index = 0)

(PECL judy >= 0.1.1)
Search (inclusive) for the first index present that is equal to or greater than the passed Index.

Parameters

mixed $index

[optional]

The index can be an integer or a string corresponding to the index where to start the search.

Return Value

mixed

Return the corresponding index in the array.

mixed firstEmpty(mixed $index = 0)

(PECL judy >= 0.1.1)
Search (inclusive) for the first absent index that is equal to or greater than the passed Index.

Parameters

mixed $index

[optional]

The index can be an integer or a string corresponding to the index where to start the search.

Return Value

mixed

Return the corresponding index in the array.

free()

(PECL judy >= 0.1.1)
Free the entire Judy array.

int getType()

(PECL judy >= 0.1.1)
Return an integer corresponding to the Judy type of the current object.

Return Value

int

Return an integer corresponding to a Judy type.

mixed last(int|string $index = -1)

(PECL judy >= 0.1.1)
Search (inclusive) for the last index present that is equal to or less than the passed Index.

Parameters

int|string $index

[optional]

The index can be an integer or a string corresponding to the index where to start the search.

Return Value

mixed

Return the corresponding index in the array.

mixed lastEmpty(int|string $index = -1)

(PECL judy >= 0.1.1)
Search (inclusive) for the last absent index that is equal to or less than the passed Index.

Parameters

int|string $index

[optional]

The index can be an integer or a string corresponding to the index where to start the search.

Return Value

mixed

Return the corresponding index in the array.

int memoryUsage()

(PECL judy >= 0.1.1)
Return the memory used by the Judy array.

Return Value

int

Return the memory used in bytes.

mixed next(mixed $index)

(PECL judy >= 0.1.1)
Search (exclusive) for the next index present that is greater than the passed Index.

Parameters

mixed $index

The index can be an integer or a string corresponding to the index where to start the search.

Return Value

mixed

Return the corresponding index in the array.

mixed nextEmpty(int|string $index)

(PECL judy >= 0.1.1)
Search (exclusive) for the next absent index that is greater than the passed Index.

Parameters

int|string $index

The index can be an integer or a string corresponding to the index where to start the search.

Return Value

mixed

Return the corresponding index in the array.

bool offsetExists(TKey $offset)

(PECL judy >= 0.1.1)
Whether or not an offset exists.

Parameters

TKey $offset

An offset to check for.

Return Value

bool

true on success or false on failure.

The return value will be casted to boolean if non-boolean was returned.

mixed offsetGet(TKey $offset)

(PECL judy >= 0.1.1)
Returns the value at specified offset.

Parameters

TKey $offset

The offset to retrieve.

Return Value

mixed

Can return all value types.

void offsetSet(TKey $offset, TValue $value)

(PECL judy >= 0.1.1)
Assigns a value to the specified offset.

Parameters

TKey $offset

The offset to assign the value to.

TValue $value

The value to set.

Return Value

void

void offsetUnset(TKey $offset)

(PECL judy >= 0.1.1)
Unsets an offset.

Parameters

TKey $offset

The offset to unset.

Return Value

void

mixed prev(mixed $index)

(PECL judy >= 0.1.1)
Search (exclusive) for the previous index present that is less than the passed Index.

Parameters

mixed $index

The index can be an integer or a string corresponding to the index where to start the search.

Return Value

mixed

Return the corresponding index in the array.

mixed prevEmpty(mixed $index)

(PECL judy >= 0.1.1)
Search (exclusive) for the previous index absent that is less than the passed Index.

Parameters

mixed $index

The index can be an integer or a string corresponding to the index where to start the search.

Return Value

mixed

Return the corresponding index in the array.

int size(int $index_start = 0, int $index_end = -1)

(PECL judy >= 0.1.1)
Count the number of elements in the Judy array.
This method is an alias of const count.

Parameters

int $index_start

[optional]

Start counting from the given index. Default is first index.

int $index_end

[optional]

Stop counting when reaching this index. Default is last index.

Return Value

int

Return the number of elements.