core :: MapRead :: lookup_values
pe.greaters
from the most smaller elements that have a value.Elements without values are ignored.
Basically, values defined in nearest greater elements of pe
are inherited.
var pos = new POSet[String]
pos.add_chain(["E", "D", "C", "B", "A"])
pos.add_chain(["D", "X", "B"])
var map = new HashMap[String, String]
map["A"] = "a"
map["C"] = "c"
map["X"] = "x"
map["E"] = "e"
assert map.lookup_values(pos["B"]).has_exactly(["a"])
assert map.lookup_values(pos["C"]).has_exactly(["c"])
assert map.lookup_values(pos["D"]).has_exactly(["c", "x"])
# Combine the values in `pe.greaters` from the most smaller elements that have a value.
#
# Elements without values are ignored.
#
# Basically, values defined in nearest greater elements of `pe` are inherited.
#
# ~~~
# var pos = new POSet[String]
# pos.add_chain(["E", "D", "C", "B", "A"])
# pos.add_chain(["D", "X", "B"])
#
# var map = new HashMap[String, String]
# map["A"] = "a"
# map["C"] = "c"
# map["X"] = "x"
# map["E"] = "e"
#
# assert map.lookup_values(pos["B"]).has_exactly(["a"])
# assert map.lookup_values(pos["C"]).has_exactly(["c"])
# assert map.lookup_values(pos["D"]).has_exactly(["c", "x"])
# ~~~
fun lookup_values(pe: POSetElement[K]): Set[V]
do
var res = new Set[V]
for k in pe.poset.select_smallest(filter_keys(pe.greaters)) do res.add self[k]
return res
end
lib/poset/poset.nit:785,2--811,4