bbuf2 = interface { empty, one, mid, full } extends bbuf { mid } becomes { one, mid } get2 = method({mid}b:self{mid,one,empty}) replies(int,int) end bbuf2 bbuf2i = class implements bbuf2 extends bbuf_basei after get{mid}, put{mid} use setstate get2 = method({mid}b:self{mid,one,empty}) replies(int,int) b.opt := (b.opt+1)//b.size; v1:int := b.arr[b.opt] b.opt := (b.opt+1)//b.size; v2:int := b.arr[b.opt] b.cnt := b.cnt-2; b!setstate(); reply(v1, v2) end get2 setstate = method(b:self) if b.cnt = b.size then b!{full} elseif b.cnt = 0 then b!{empty} elseif b.cnt = 1 then b!{one} else b!{mid} end end setstate end bbuf2i