class GBN_TUPLE_REQUIRE [G] -- matches the routines of GBN_TUPLE, checking -- all the require clauses for each routine, and -- setting last_error equal to the label of the earliest -- violated, if any. Default (all require clauses -- satisfied): last_error = "". feature last_error: STRING first_place (vt: GBN_TUPLE[G]) is do if vt . is_empty then !! last_error.copy("nonempty") else !! last_error.copy("") end end last_place (vt: GBN_TUPLE [G]) is do if vt . is_empty then !! last_error.copy("nonempty") else !! last_error.copy("") end end rank (vt: GBN_TUPLE[G]; p: GBN_PLACE) is do if not vt . has_place (p) then !!last_error.copy ("has_p") else !!last_error.copy ("") end end nth_after (vt: GBN_TUPLE[G]; n: INTEGER; p: GBN_PLACE) is do if not vt . has_place (p) then !!last_error.copy ("has_p") elseif n < 0 then !!last_error.copy ("n_nonnegative") elseif n > vt . count-1 then !!last_error.copy ("n_inrange") else !!last_error.copy ("") end end nth_before (vt: GBN_TUPLE[G]; n: INTEGER; p: GBN_PLACE) is do if not vt . has_place (p) then !!last_error.copy ("has_p") elseif n < 0 then !!last_error.copy ("n_nonnegative") elseif n > vt . count-1 then !!last_error.copy ("n_inrange") else !!last_error.copy ("") end end nth_place (vt: GBN_TUPLE[G]; n: INTEGER) is do if n < 0 then !!last_error.copy ("n_positive") elseif n > vt . count then !!last_error.copy ("inrange") else !!last_error.copy ("") end end pred (vt: GBN_TUPLE[G]; p: GBN_PLACE) is do if not vt . has_place (p) then !!last_error.copy ("has_p") else !!last_error.copy ("") end end succ (vt: GBN_TUPLE[G]; p: GBN_PLACE) is do if not vt . has_place (p) then !!last_error.copy ("has_p") else !!last_error.copy ("") end end cyclic_pred (vt: GBN_TUPLE[G]; p: GBN_PLACE) is do if not vt . has_place (p) then !!last_error.copy ("has_p") else !!last_error.copy ("") end end cyclic_succ (vt: GBN_TUPLE[G]; p: GBN_PLACE) is do if not vt . has_place (p) then !!last_error.copy ("has_p") else !!last_error.copy ("") end end place_lesseq (vt: GBN_TUPLE[G]; p, q: GBN_PLACE) is do if not vt . has_place (p) then !!last_error.copy ("has_p") elseif not vt . has_place (q) then !!last_error.copy ("has_q") else !!last_error.copy ("") end end item (vt: GBN_TUPLE[G]; p: GBN_PLACE) is do if not vt . has_place (p) then !!last_error.copy ("has_p") else !!last_error.copy ("") end end top (vt: GBN_TUPLE [G]) is do if vt . is_empty then !! last_error.copy("nonempty") else !! last_error.copy("") end end first_item (vt: GBN_TUPLE [G]) is do if vt . is_empty then !! last_error.copy("nonempty") else !! last_error.copy("") end end last_item (vt: GBN_TUPLE [G]) is do if vt . is_empty then !! last_error.copy("nonempty") else !! last_error.copy("") end end cyclic_iterator (vt: GBN_TUPLE[G]; start_at, stop_after: GBN_PLACE) is do if not vt . has_place ( start_at ) then !! last_error.copy("has_start_place") elseif not vt . has_place ( stop_after ) then !! last_error.copy("has_stop_place") else !! last_error.copy("") end end reverse_cyclic_iterator (vt: GBN_TUPLE[G]; start_at, stop_after: GBN_PLACE) is do if not vt . has_place ( start_at ) then !! last_error.copy("has_start_place") elseif not vt . has_place ( stop_after ) then !! last_error.copy("has_stop_place") else !! last_error.copy("") end end wipe_out (vt: GBN_TUPLE [G]) is do if vt . is_protected then !! last_error.copy("unprotected") else !! last_error.copy("") end end add_first (vt: GBN_TUPLE[G]; x: G) is do if vt . is_protected then !! last_error.copy("unprotected") else !! last_error.copy("") end end push (vt: GBN_TUPLE[G]; x: G) is do if vt . is_protected then !! last_error.copy("unprotected") else !! last_error.copy("") end end add_last (vt: GBN_TUPLE[G]; x: G) is do if vt . is_protected then !! last_error.copy("unprotected") else !! last_error.copy("") end end add_before (vt: GBN_TUPLE[G]; x: G; p: GBN_PLACE) is do if vt . is_protected then !! last_error.copy("unprotected") elseif p /= Void and then not vt . has_place ( p ) then !! last_error.copy("p_valid") else !! last_error.copy("") end end add_after (vt: GBN_TUPLE[G]; x: G; p: GBN_PLACE) is do if vt . is_protected then !! last_error.copy("unprotected") elseif p /= Void and then not vt . has_place ( p ) then !! last_error.copy("p_valid") else !! last_error.copy("") end end pop (vt: GBN_TUPLE [G]) is do if vt . is_protected then !! last_error.copy("unprotected") elseif vt . is_empty then !! last_error.copy("nonempty") else !! last_error.copy("") end end remove_first (vt: GBN_TUPLE [G]) is do if vt . is_protected then !! last_error.copy("unprotected") elseif vt . is_empty then !! last_error.copy("nonempty") else !! last_error.copy("") end end remove_last (vt: GBN_TUPLE [G]) is do if vt . is_protected then !! last_error.copy("unprotected") elseif vt . is_empty then !! last_error.copy("nonempty") else !! last_error.copy("") end end remove (vt: GBN_TUPLE[G]; p: GBN_PLACE) is do if vt . is_protected then !! last_error.copy("unprotected") elseif not vt . has_place (p) then !! last_error.copy("has_p") else !! last_error.copy("") end end absorb_prefix (vt: GBN_TUPLE[G]; other: GBN_TUPLE[G]) is do if vt . is_protected then !! last_error.copy("unprotected") elseif other = Void then !! last_error.copy("nonvoid") elseif other = vt then !! last_error.copy("different") else !! last_error.copy("") end end absorb_suffix (vt: GBN_TUPLE[G]; other: GBN_TUPLE[G]) is do if vt . is_protected then !! last_error.copy("unprotected") elseif other = Void then !! last_error.copy("nonvoid") elseif other = vt then !! last_error.copy("different") else !! last_error.copy("") end end absorb_before (vt: GBN_TUPLE[G]; other: GBN_TUPLE[G]; p: GBN_PLACE) is do if vt . is_protected then !! last_error.copy("unprotected") elseif other = Void then !! last_error.copy("nonvoid") elseif other = vt then !! last_error.copy("different") elseif p /= Void and then not vt . has_place (p) then !! last_error.copy("p_valid") else !! last_error.copy("") end end absorb_after (vt: GBN_TUPLE[G]; other: GBN_TUPLE[G]; p: GBN_PLACE) is do if vt . is_protected then !! last_error.copy("unprotected") elseif other = Void then !! last_error.copy("nonvoid") elseif other = vt then !! last_error.copy("different") elseif p /= Void and then not vt . has_place (p) then !! last_error.copy("p_valid") else !! last_error.copy("") end end cyclic_remove (vt: GBN_TUPLE[G]; p, q: GBN_PLACE; subtuple: GBN_BOX[GBN_TUPLE[G]]) is do if vt . is_protected then !! last_error.copy("unprotected") elseif not vt . has_place (p) then !! last_error.copy("has_p") elseif not vt . has_place (q) then !! last_error.copy("has_q") else !! last_error.copy("") end end end --- class GBN_TUPLE_REQUIRE