FilterMap<K, V> class
(Translated from Python, may be phrased a little weird.)
Addressed by lists. size
is size of list.
Get can contain Nones.
Set can contain Nones, but it's not recommended - I suspect it'll be a little messy.
getExact returns a single entry, or throws.
getFilter returns a list of matching entries.
Get performs getExact or getFilter, depending on whether the key contains Nones.
fm = FilterMap(3)
fm(0,0,0)
= 0
fm(0,0,1)
= 1
fm(0,1,0)
= 2
fm(0,1,1)
= 3
fm(1,0,0)
= 4
fm(1,0,1)
= 5
fm(1,1,0)
= 6
fm(1,1,1)
= 7
fm(1,1,1)
# = 7
fm(1,1,None)
# = 6, 7
I abandoned fast-lookup; now if the key contains Nones it iterates the map. Sigh.
...I probably shouldn't put commentary in my documentation.
Constructors
- FilterMap.new(int size)
Properties
Methods
-
clear(
) → void -
delFilter(
dynamic key) → List< V> -
entries(
) → Iterable< MapEntry< List< >K> , V> -
filterKeys(
dynamic key) → List< List< K> > -
Like getFilter, but returns a list of keys instead of values.
-
getExact(
List< K> key) → V? -
getFilter(
List< K?> key) → List<V> -
keys(
) → Iterable< List< K> > -
length(
) → int -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
dynamic key) → V? -
Deletes key. Exact match. See
delFilter
. -
toString(
) → String -
A string representation of this object.
inherited
-
values(
) → Iterable< V>
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
List< K?> key) → List<V> -
operator []=(
List< K> key, V value) → void