e
in the poset.This allows to view the elements in their relation with others elements.
var poset = new POSet[String]
poset.add_chain(["A", "B", "D"])
poset.add_chain(["A", "C", "D"])
var a = poset["A"]
assert a.direct_greaters.has_exactly(["B", "C"])
assert a.greaters.has_exactly(["A", "B", "C", "D"])
assert a.direct_smallers.is_empty
REQUIRE: has(e)
# Return a view of `e` in the poset.
# This allows to view the elements in their relation with others elements.
#
# var poset = new POSet[String]
# poset.add_chain(["A", "B", "D"])
# poset.add_chain(["A", "C", "D"])
# var a = poset["A"]
# assert a.direct_greaters.has_exactly(["B", "C"])
# assert a.greaters.has_exactly(["A", "B", "C", "D"])
# assert a.direct_smallers.is_empty
#
# REQUIRE: has(e)
fun [](e: E): POSetElement[E]
do
assert elements.keys.has(e)
return self.elements[e]
end
lib/poset/poset.nit:105,2--121,4