indexing
description: "Linkable cells with a reference to their left and right neighbors"
library: "Gobo Eiffel Structure Library"
author: "Eric Bezault <ericb@gobo.demon.co.uk>"
copyright: "Copyright (c) 1997, Eric Bezault"
class interface
DS_BILINKABLE [G]
create
make (v: G)
-- Insert v in cell.
-- Was declared in DS_CELL as synonym of make and put.
-- (from DS_CELL)
ensure -- from DS_CELL
inserted: item = v
feature -- Access
item: G
-- Content of cell
-- (from DS_CELL)
left: like Current
-- Left neighbor
right: like Current
-- Right neighbor
-- (from DS_LINKABLE)
feature -- Element change
forget_left
-- Remove left neighbor.
ensure
forgotten: left = void
forget_right
-- Remove right neighbor.
-- (from DS_LINKABLE)
ensure -- from DS_LINKABLE
forgotten: right = void
make (v: G)
-- Insert v in cell.
-- Was declared in DS_CELL as synonym of make and put.
-- (from DS_CELL)
ensure -- from DS_CELL
inserted: item = v
put (v: G)
-- Insert v in cell.
-- Was declared in DS_CELL as synonym of make and put.
-- (from DS_CELL)
ensure -- from DS_CELL
inserted: item = v
put_left (other: like Current)
-- Put other to left of cell.
-- Make sure that link is bidirectional.
require
other_not_void: other /= void
ensure
linked: left = other;
bilinked: other.right = Current
put_right (other: like Current)
-- Put other to right of cell.
-- Make sure that link is bidirectional.
require -- from DS_LINKABLE
other_not_void: other /= void
ensure -- from DS_LINKABLE
linked: right = other
ensure then
bilinked: other.left = Current
invariant
-- from GENERAL
reflexive_equality: standard_is_equal (Current);
reflexive_conformance: conforms_to (Current);
end -- class DS_BILINKABLE