确保可拆卸的元素,埃菲尔

时间:2014-01-05 15:12:47

标签: hashtable detach eiffel

如果元素可以拆卸,我如何确保元素在我的HASH_TABLE中?

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 个答案:

答案 0 :(得分:1)

你试过吗:

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