![]() |
Fruit DSKit
Common data structures for Fruit framework
|
Public Member Functions | |
__construct () | |
set ($k, $v) | |
set mapping relation, no-op if not one-to-one and onto More... | |
remove ($k) | |
remove a mapping relation by key, no-op if not exist More... | |
get ($k) | |
get value by key More... | |
has ($k) | |
detect if key exists More... | |
getv ($v) | |
get key by value More... | |
hasv ($v) | |
detect if value exists More... | |
removev ($v) | |
remove a mapping relation by value, no-op if not exist More... | |
len () | |
size of the collection More... | |
toArray () | |
convert to array More... | |
iterator () | |
Mapping data represents a bijective function.
Bijection guarantees the stored data are mapped one-to-one and onto. In other words, every key maps to a distinct value, and vice versa.
Definition at line 12 of file Bijection.php.
__construct | ( | ) |
Definition at line 18 of file Bijection.php.
get | ( | $k | ) |
get value by key
Definition at line 52 of file Bijection.php.
getv | ( | $v | ) |
get key by value
Definition at line 66 of file Bijection.php.
has | ( | $k | ) |
detect if key exists
Definition at line 60 of file Bijection.php.
hasv | ( | $v | ) |
detect if value exists
Definition at line 74 of file Bijection.php.
iterator | ( | ) |
Returns an iterator to iterate this collection
Implements Collection.
Definition at line 101 of file Bijection.php.
len | ( | ) |
remove | ( | $k | ) |
remove a mapping relation by key, no-op if not exist
Definition at line 40 of file Bijection.php.
removev | ( | $v | ) |
remove a mapping relation by value, no-op if not exist
Definition at line 80 of file Bijection.php.
set | ( | $k, | |
$v | |||
) |
set mapping relation, no-op if not one-to-one and onto
Definition at line 25 of file Bijection.php.
toArray | ( | ) |