Detachable element in ensure, Eiffel

2019-08-13 19:18发布

How can I ensure that an element is in my HASH_TABLE, if it is detachable?

Current = HASH_TABLE[ARRAYED_SET[G], G]

add_edge (src: G; dst: G)
do
    if attached Current.at(src) as edges then
        edges.put(dst)
    end
ensure
    in: Current.at (src).has (dst)
end

1条回答
我只想做你的唯一
2楼-- · 2019-08-13 20:20

Have you try that:

add_edge (src: G; dst: G)
do
    if attached Current.at(src) as edges then
        edges.put(dst)
    end
ensure
    in: attached Current.at (src) as edges implies edges.has (dst)
end
查看更多
登录 后发表回答