EiffelBase class
(HTML page generated by ISE Eiffel 4.2)
Eiffel Class
indexing
description: "Linkable cells with a reference to the left and right neighbors";
status: "See notice at end of class";
names: bi_linkable, cell;
representation: linked;
contents: generic;
date: "$Date: 2007-03-30 19:10:11 +0000 (Fri, 30 Mar 2007) $";
revision: "$Revision: 95354 $"
class BI_LINKABLE [G]
inherit
LINKABLE [G]
redefine
put_right, forget_right
end
feature -- Access
left: like Current;
-- Left neighbor
feature {CELL, CHAIN} -- Implementation
put_right (other: like Current) is
-- Put other to the right of current cell.
do
if right /= void then
right.simple_forget_left
end;
right := other;
if (other /= void) then
other.simple_put_left (Current)
end
end;
put_left (other: like Current) is
-- Put other to the left of current cell.
do
if left /= void then
left.simple_forget_right
end;
left := other;
if (other /= void) then
other.simple_put_right (Current)
end
ensure
chained: left = other
end;
forget_right is
-- Remove links with right neighbor.
do
if right /= void then
right.simple_forget_left;
right := void
end
ensure
right_not_chained: (old right /= void) implies ((old right).left = void)
end;
forget_left is
-- Remove links with left neighbor.
do
if left /= void then
left.simple_forget_right;
left := void
end
ensure
left_not_chained: left = void;
(old left /= void) implies ((old left).right = void)
end;
feature {BI_LINKABLE, TWO_WAY_LIST} -- Implementation
simple_put_right (other: like Current) is
-- set right to other
do
if right /= void then
right.simple_forget_left
end;
right := other
end;
simple_put_left (other: like Current) is
-- set left to other is
do
if left /= void then
left.simple_forget_right
end;
left := other
end;
simple_forget_right is
-- Remove right link (do nothing to right neighbor).
do
right := void
end;
simple_forget_left is
-- Remove left link (do nothing to left neighbor).
do
left := void
ensure
not_chained: left = void
end;
invariant
right_symmetry: (right /= void) implies (right.left = Current);
left_symmetry: (left /= void) implies (left.right = Current);
end -- class BI_LINKABLE
|