Automatic generation produced by ISE Eiffel
note description: "Constructs whose specimens are specimens of constructs chosen among a specified list." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date: 2014-01-06 15:00:30 -0900 (Mon, 06 Jan 2014) $" revision: "$Revision: 93908 $" deferred class interface CHOICE feature -- Initialization make -- Set up construct. -- (from CONSTRUCT) feature -- Access at alias "@" (i: INTEGER_32): like child_item assign put_i_th -- Item at i-th position -- Was declared in {CHAIN} as synonym of `i_th`. -- (from CHAIN) require -- from TABLE valid_key: valid_index (i) child_cursor: CONSTRUCT_CURSOR -- Current cursor position -- (from CONSTRUCT) require -- from CURSOR_STRUCTURE True require -- from TREE True ensure -- from CURSOR_STRUCTURE cursor_not_void: Result /= Void construct_name: STRING_8 -- Name of the construct in the grammar -- (from CONSTRUCT) Document: INPUT -- The document to be parsed -- (from CONSTRUCT) first: like child_item -- Item at first position -- (from LINKED_LIST) require -- from CHAIN not_empty: not no_components first_child: like parent -- Leftmost child -- (from TWO_WAY_TREE) generating_type: TYPE [detachable CHOICE] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty twl_has (v: like child_item): BOOLEAN -- Does chain include v? -- (Reference or object equality, -- based on `object_comparison`.) -- (from CHAIN) require -- from CONTAINER True ensure -- from CONTAINER not_found_in_empty: Result implies not no_components i_th alias "[]" (i: INTEGER_32): like child_item assign put_i_th -- Item at i-th position -- Was declared in {CHAIN} as synonym of `at`. -- (from CHAIN) require -- from TABLE valid_key: valid_index (i) require -- from READABLE_INDEXABLE valid_index: valid_index (i) child_index: INTEGER_32 -- Index of current position -- (from LINKED_LIST) require -- from LINEAR True require -- from TREE True ensure -- from TREE valid_index: Result >= 0 and Result <= arity + 1 index_of (v: like child_item; i: INTEGER_32): INTEGER_32 -- Index of i-th occurrence of item identical to v. -- (Reference or object equality, -- based on `object_comparison`.) -- 0 if none. -- (from CHAIN) require -- from LINEAR positive_occurrences: i > 0 ensure -- from LINEAR non_negative_result: Result >= 0 item: detachable CONSTRUCT -- Content of cell. -- (from CELL) child_item: detachable CONSTRUCT -- Current item -- (from LINKED_LIST) require -- from ACTIVE readable: child_readable require -- from TRAVERSABLE not_off: not child_off require -- from TREE readable: child_readable item_for_iteration: detachable CONSTRUCT -- Item at current position -- (from LINEAR) require -- from LINEAR not_off: not child_off last: like child_item -- Item at last position -- (from LINKED_LIST) require -- from CHAIN not_empty: not no_components last_child: like parent -- Right most child -- (from TWO_WAY_TREE) left_sibling: detachable CHOICE -- Left neighbor -- (from BI_LINKABLE) twl_new_cursor: TWO_WAY_LIST_ITERATION_CURSOR [detachable CONSTRUCT] -- (from TWO_WAY_LIST) require -- from ITERABLE True ensure -- from ITERABLE result_attached: Result /= Void parent: detachable CONSTRUCT -- Parent node -- (from CONSTRUCT) production: LINKED_LIST [CONSTRUCT] -- Right-hand side of the production for the construct -- (from CONSTRUCT) retained: detachable CONSTRUCT -- Child which matches the input document; -- Void if none. right_sibling: detachable CHOICE -- Right neighbor -- (from LINKABLE) sublist: detachable CHOICE -- Result produced by last `split` -- (from TWO_WAY_LIST) feature -- Measurement child_capacity: INTEGER_32 -- Maximal number of children -- (from TREE) count: INTEGER_32 -- Number of items -- (from TREE) arity: INTEGER_32 -- Number of items -- (from LINKED_LIST) Lower: INTEGER_32 = 1 -- Minimum index. -- (from CHAIN) occurrences (v: like child_item): INTEGER_32 -- Number of times v appears. -- (Reference or object equality, -- based on `object_comparison`.) -- (from CHAIN) require -- from BAG True require -- from LINEAR True ensure -- from BAG non_negative_occurrences: Result >= 0 feature -- Comparison frozen deep_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal alias "≡≡≡" (other: CHOICE): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: CHOICE): BOOLEAN -- Does other contain the same elements? -- (Reference or object equality, -- based on `object_comparison`.) -- (from TREE) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result ensure then -- from LIST indices_unchanged: child_index = old child_index and other.child_index = old other.child_index true_implies_same_size: Result implies arity = other.arity node_is_equal (other: CHOICE): BOOLEAN -- Is other equal to Current? -- (from TREE) require -- from TREE other_not_void: other /= Void frozen standard_equal (a: detachable ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal alias "≜" (other: CHOICE): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) feature -- Status report child_after: BOOLEAN -- Is there no valid cursor position to the right of cursor? -- (from LINKED_LIST) child_before: BOOLEAN -- Is there no valid cursor position to the left of cursor? -- (from LINKED_LIST) changeable_comparison_criterion: BOOLEAN -- May `object_comparison` be changed? -- (Answer: yes by default.) -- (from CONTAINER) child_isfirst: BOOLEAN -- Is cursor under first child? -- (from TREE) require -- from CHAIN True ensure -- from CHAIN valid_position: Result implies not no_components ensure -- from TREE not_is_leaf: Result implies not no_components child_islast: BOOLEAN -- Is cursor under last child? -- (from TWO_WAY_TREE) require -- from CHAIN True require -- from TREE True ensure -- from CHAIN valid_position: Result implies not no_components ensure -- from TREE not_is_leaf: Result implies not no_components child_readable: BOOLEAN -- Is there a current `child_item` to be read? -- (from TREE) require -- from ACTIVE True child_writable: BOOLEAN -- Is there a current `child_item` that may be modified? -- (from TREE) require -- from ACTIVE True committed: BOOLEAN -- Have enough productions been recognized to interpret -- failure of parsing as a syntax error in this construct? -- (Otherwise the parsing process will backtrack, trying -- other possible interpretations of the part already read.) -- (from CONSTRUCT) conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void exhausted: BOOLEAN -- Has structure been completely explored? -- (from LINEAR) ensure -- from LINEAR exhausted_when_off: child_off implies Result Extendible: BOOLEAN = True -- May new items be added? -- (from DYNAMIC_TREE) child_extendible: BOOLEAN -- May new items be added? (Answer: yes.) -- (from DYNAMIC_CHAIN) require -- from COLLECTION True Twl_full: BOOLEAN = False -- Is structured filled to capacity? (Answer: no.) -- (from LINKED_LIST) has (v: detachable CONSTRUCT): BOOLEAN -- Does subtree include v? -- (Reference or object equality, -- based on `object_comparison`.) -- (from TREE) ensure -- from CONTAINER not_found_in_empty: Result implies not no_components is_empty: BOOLEAN -- Is structure empty of items? -- (from TREE) is_inserted (v: detachable CONSTRUCT): BOOLEAN -- Has v been inserted at the end by the most recent `put` or -- `extend`? -- (from LINKED_LIST) no_components: BOOLEAN -- Are there no children? -- (from TREE) is_optional: BOOLEAN -- Is construct optional? -- (from CONSTRUCT) is_root: BOOLEAN -- Is there no parent? -- (from TREE) is_sibling (other: attached like parent): BOOLEAN -- Are current node and other siblings? -- (from TREE) require -- from TREE other_exists: other /= Void ensure -- from TREE not_root: Result implies not is_root other_not_root: Result implies not other.is_root same_parent: Result = not is_root and other.parent = parent left_recursion: BOOLEAN -- Is the construct's definition left-recursive? object_comparison: BOOLEAN -- Must search operations use `equal` rather than = -- for comparing references? (Default: no, use =.) -- (from CONTAINER) child_off: BOOLEAN -- Is there no current item? -- (from LINKED_LIST) require -- from TRAVERSABLE True require -- from TREE True parsed: BOOLEAN -- Has construct been successfully parsed? -- (True for optional components not present) -- (from CONSTRUCT) Print_mode: CELL [BOOLEAN] -- Must the left-recursion test also print the production? -- (Default: no.) -- (from CONSTRUCT) prunable: BOOLEAN -- May items be removed? (Answer: yes.) -- (from DYNAMIC_TABLE) require -- from COLLECTION True Readable: BOOLEAN = True -- (from TREE) readable_child: BOOLEAN -- Is there a current child to be read? -- (from TREE) replaceable: BOOLEAN -- Can current item be replaced? -- (from ACTIVE) same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) valid_cursor (p: CURSOR): BOOLEAN -- Can the cursor be moved to position p? -- (from LINKED_LIST) valid_cursor_index (i: INTEGER_32): BOOLEAN -- Is i correctly bounded for cursor movement? -- (from TREE) require -- from CHAIN True ensure -- from CHAIN valid_cursor_index_definition: Result = ((i >= 0) and (i <= arity + 1)) ensure -- from TREE valid_cursor_index_definition: Result = (i >= 0) and (i <= child_capacity + 1) valid_index (i: INTEGER_32): BOOLEAN -- Is i within allowable bounds? -- (from CHAIN) require -- from READABLE_INDEXABLE True require -- from TABLE True ensure -- from READABLE_INDEXABLE only_if_in_index_set: Result implies (Lower <= i and i <= arity) ensure then -- from CHAIN valid_index_definition: Result = ((i >= 1) and (i <= arity)) Writable: BOOLEAN = True -- Is there a current item that may be modified? -- (from TREE) writable_child: BOOLEAN -- Is there a current child that may be modified? -- (from TREE) feature -- Status setting compare_objects -- Ensure that future search operations will use `equal` -- rather than = for comparing references. -- (from CONTAINER) require -- from CONTAINER changeable_comparison_criterion: changeable_comparison_criterion ensure -- from CONTAINER object_comparison compare_references -- Ensure that future search operations will use = -- rather than `equal` for comparing references. -- (from CONTAINER) require -- from CONTAINER changeable_comparison_criterion: changeable_comparison_criterion ensure -- from CONTAINER reference_comparison: not object_comparison set_optional -- Define this construct as optional. -- (from CONSTRUCT) ensure -- from CONSTRUCT optional_construct: is_optional feature -- Cursor movement child_back -- Move cursor to previous position, if any. -- (from TWO_WAY_LIST) require -- from BILINEAR not_before: not child_before require -- from TREE True child_finish -- Move cursor to last position. -- (Go before if empty) -- (from TWO_WAY_LIST) require -- from LINEAR True require -- from TREE True ensure then -- from CHAIN at_last: not no_components implies child_islast ensure then -- from LINKED_LIST empty_convention: no_components implies child_before ensure then -- from TWO_WAY_LIST not_after: not child_after child_forth -- Move cursor to next position, if any. -- (from TWO_WAY_LIST) require -- from LINEAR not_after: not child_after require -- from TREE True ensure then -- from LIST moved_forth: child_index = old child_index + 1 child_go_i_th (i: INTEGER_32) -- Move cursor to i-th position. -- (from LINKED_LIST) require -- from CHAIN valid_cursor_index: valid_cursor_index (i) require -- from TREE True ensure -- from CHAIN position_expected: child_index = i ensure then -- from TREE position: child_index = i child_go_to (p: CURSOR) -- Move cursor to position p. -- (from LINKED_LIST) require -- from CURSOR_STRUCTURE cursor_position_valid: valid_cursor (p) require -- from TREE True move (i: INTEGER_32) -- Move cursor i positions. The cursor -- may end up off if the offset is to big. -- (from TWO_WAY_LIST) require -- from CHAIN True ensure -- from CHAIN too_far_right: (old child_index + i > arity) implies exhausted too_far_left: (old child_index + i < 1) implies exhausted expected_index: (not exhausted) implies (child_index = old child_index + i) ensure then -- from LINKED_LIST moved_if_inbounds: ((old child_index + i) >= 0 and (old child_index + i) <= (arity + 1)) implies child_index = (old child_index + i) before_set: (old child_index + i) <= 0 implies child_before after_set: (old child_index + i) >= (arity + 1) implies child_after search_child (v: like child_item) -- Move to first position (at or after current -- position) where `item` and v are equal. -- If structure does not include v ensure that -- `exhausted` will be true. -- (Reference or object equality, -- based on `object_comparison`.) -- (from BILINEAR) ensure -- from LINEAR object_found: (not exhausted and object_comparison) implies v ~ child_item item_found: (not exhausted and not object_comparison) implies v = child_item child_start -- Move cursor to first position. -- (from LINKED_LIST) require -- from TRAVERSABLE True require -- from TREE True ensure then -- from CHAIN at_first: not no_components implies child_isfirst ensure then -- from LINKED_LIST empty_convention: no_components implies child_after feature -- Element change append (s: SEQUENCE [detachable CONSTRUCT]) -- Append a copy of s. -- (from CHAIN) require -- from SEQUENCE argument_not_void: s /= Void ensure -- from SEQUENCE new_count: arity >= old arity extend (v: like item) -- Add v as new child. -- (from DYNAMIC_TREE) child_extend (v: like child_item) -- Add v to end. -- Do not move cursor. -- (from TWO_WAY_LIST) require -- from COLLECTION extendible: child_extendible require -- from DYNAMIC_TREE True ensure -- from COLLECTION item_inserted: is_inserted (v) twl_fill (other: CONTAINER [detachable CONSTRUCT]) -- Fill with as many items of other as possible. -- The representations of other and current structure -- need not be the same. -- (from CHAIN) require -- from COLLECTION other_not_void: other /= Void extendible: child_extendible force (v: like child_item) -- Add v to end. -- (from SEQUENCE) require -- from SEQUENCE extendible: child_extendible ensure then -- from SEQUENCE new_count: arity = old arity + 1 item_inserted: has (v) merge_tree_after (other: like new_cell) -- Merge children of other into current structure -- after cursor position. Do not move cursor. -- Make other a leaf. -- (from TWO_WAY_TREE) require -- from DYNAMIC_TREE not_child_off: not child_off other_exists: other /= Void ensure -- from DYNAMIC_TREE other_is_leaf: other.is_leaf merge_tree_before (other: like new_cell) -- Merge children of other into current structure -- before cursor position. Do not move cursor. -- Make other a leaf. -- (from TWO_WAY_TREE) require -- from DYNAMIC_TREE not_child_off: not child_off other_exists: other /= Void ensure -- from DYNAMIC_TREE other_is_leaf: other.is_leaf prune (n: like new_cell) -- Prune n from children. -- (from TWO_WAY_TREE) require -- from TREE is_child: n.parent = Current ensure -- from TREE n_is_root: n.is_root twt_put (v: like item) -- Make v the cell's `item`. -- Was declared in {CELL} as synonym of `replace`. -- (from CELL) require -- from TREE is_writable: Writable ensure -- from TREE item_inserted: item = v ensure -- from CELL item_inserted: item = v child_put (v: like child_item) -- Replace current item by v. -- (Synonym for `replace`) -- (from CHAIN) require -- from TREE child_writable: child_writable require -- from CHAIN writeable: child_writable replaceable: replaceable ensure -- from TREE item_inserted: child_item = v ensure -- from CHAIN same_count: arity = old arity is_inserted: is_inserted (v) sequence_put (v: like child_item) -- Add v to end. -- (from SEQUENCE) require -- from COLLECTION extendible: child_extendible ensure -- from COLLECTION item_inserted: is_inserted (v) ensure then -- from SEQUENCE new_count: arity = old arity + 1 put_child (n: like new_cell) -- Add n to the list of children. -- Do not move child cursor. -- (from TWO_WAY_TREE) require -- from TREE non_void_argument: n /= Void put_child_left (n: like new_cell) -- Add n to the left of cursor position. -- Do not move cursor. -- (from TWO_WAY_TREE) require -- from DYNAMIC_TREE not_child_before: not child_before non_void_argument: n /= Void put_child_right (n: like new_cell) -- Add n to the right of cursor position. -- Do not move cursor. -- (from TWO_WAY_TREE) require -- from DYNAMIC_TREE not_child_after: not child_after non_void_argument: n /= Void put_front (v: like child_item) -- Add v to beginning. -- Do not move cursor. -- (from TWO_WAY_LIST) require -- from DYNAMIC_CHAIN extendible: child_extendible ensure -- from DYNAMIC_CHAIN new_count: arity = old arity + 1 item_inserted: first = v put_i_th (v: like child_item; i: INTEGER_32) -- Put v at i-th position. -- (from CHAIN) require -- from TABLE valid_key: valid_index (i) require -- from TABLE valid_key: valid_index (i) ensure -- from TABLE inserted: i_th (i) = v child_put_left (v: like child_item) -- Add v to the left of cursor position. -- Do not move cursor. -- (from TWO_WAY_LIST) require -- from DYNAMIC_CHAIN extendible: child_extendible not_before: not child_before require -- from DYNAMIC_TREE not_child_before: not child_before ensure -- from DYNAMIC_CHAIN new_count: arity = old arity + 1 new_index: child_index = old child_index + 1 ensure then -- from LINKED_LIST previous_exists: previous /= Void item_inserted: attached previous as q and then q.item = v child_put_right (v: like child_item) -- Add v to the right of cursor position. -- Do not move cursor. -- (from TWO_WAY_LIST) require -- from DYNAMIC_CHAIN extendible: child_extendible not_after: not child_after require -- from DYNAMIC_TREE not_child_after: not child_after ensure -- from DYNAMIC_CHAIN new_count: arity = old arity + 1 same_index: child_index = old child_index ensure then -- from LINKED_LIST next_exists: next /= Void item_inserted: not old child_before implies (attached next as n and then n.item = v) item_inserted_before: old child_before implies (attached child as c and then c.item = v) replace (v: like item) -- Make v the cell's `item`. -- Was declared in {CELL} as synonym of `put`. -- (from CELL) require -- from TREE is_writable: Writable ensure -- from TREE item_inserted: item = v ensure -- from CELL item_inserted: item = v child_replace (v: like child_item) -- Replace current item by v. -- (from LINKED_LIST) require -- from ACTIVE writable: child_writable replaceable: replaceable require -- from TREE child_writable: child_writable ensure -- from ACTIVE item_replaced: child_item = v ensure -- from TREE item_inserted: child_item = v replace_child (n: like new_cell) -- Replace current child by n. -- (from TWO_WAY_TREE) require -- from TREE writable_child: writable_child ensure -- from TREE child_replaced: child = n sprout -- Make current node a root. -- (from TREE) feature -- Removal twl_prune (v: like child_item) -- Remove first occurrence of v, if any, -- after cursor position. -- If found, move cursor to right neighbor; -- if not, make structure `exhausted`. -- (from DYNAMIC_CHAIN) require -- from COLLECTION prunable: prunable prune_all (v: like child_item) -- Remove all occurrences of v. -- (Reference or object equality, -- based on `object_comparison`.) -- Leave structure `exhausted`. -- (from DYNAMIC_CHAIN) require -- from COLLECTION prunable: prunable ensure -- from COLLECTION no_more_occurrences: not has (v) ensure then -- from DYNAMIC_CHAIN is_exhausted: exhausted remove_child -- Remove current item. -- Move cursor to right neighbor -- (or after if no right neighbor). -- (from TWO_WAY_LIST) require -- from ACTIVE prunable: prunable writable: child_writable require -- from DYNAMIC_TREE child_not_off: not child_off ensure then -- from DYNAMIC_LIST after_when_empty: no_components implies child_after ensure -- from DYNAMIC_TREE new_arity: arity = old arity - 1 new_child_index: child_index = old child_index remove_i_th (i: INTEGER_32) -- Remove item at index i. -- Move cursor to next neighbor (or after if no next neighbor) if it is at i-th position. -- Do not change cursor otherwise. -- (from DYNAMIC_CHAIN) require -- from DYNAMIC_TABLE prunable: prunable valid_key: valid_index (i) ensure then -- from DYNAMIC_CHAIN new_count: arity = old arity - 1 same_index_if_below: child_index <= i implies child_index = old child_index new_index_if_above: child_index > i implies child_index = old child_index - 1 same_leading_items: ∀ c: old twin ¦ @ c.target_index < i implies c = i_th (.target_index) same_trailing_items: ∀ c: old twin ¦ .target_index > i implies c = i_th (.target_index - 1) remove_left_child -- Remove item to the left of cursor position. -- Do not move cursor. -- (from TWO_WAY_LIST) require -- from DYNAMIC_CHAIN left_exists: child_index > 1 require -- from DYNAMIC_TREE is_not_first: not child_isfirst ensure -- from DYNAMIC_CHAIN new_count: arity = old arity - 1 new_index: child_index = old child_index - 1 ensure -- from DYNAMIC_TREE new_arity: arity = old arity - 1 new_child_index: child_index = old child_index - 1 remove_right_child -- Remove item to the right of cursor position. -- Do not move cursor. -- (from TWO_WAY_LIST) require -- from DYNAMIC_CHAIN right_exists: child_index < arity require -- from DYNAMIC_TREE is_not_last: not child_islast ensure -- from DYNAMIC_CHAIN new_count: arity = old arity - 1 same_index: child_index = old child_index ensure -- from DYNAMIC_TREE new_arity: arity = old arity - 1 new_child_index: child_index = old child_index remove_sublist -- (from TWO_WAY_LIST) split (n: INTEGER_32) -- Do nothing. -- (from TWO_WAY_TREE) require -- from TWO_WAY_LIST not_off: not child_off valid_sublist: n >= 0 wipe_out -- Remove all items. -- (from TWO_WAY_LIST) require -- from COLLECTION prunable: prunable require -- from TREE True ensure -- from COLLECTION wiped_out: no_components ensure then -- from DYNAMIC_LIST is_before: child_before ensure -- from TREE is_leaf: no_components feature -- Transformation commit -- If this construct is one among several possible ones, -- discard the others. -- By default this does nothing. -- (from CONSTRUCT) parse -- Attempt to analyze incoming lexical -- tokens according to current construct. -- Set `parsed` to true if successful; -- return to original position in input otherwise. -- (from CONSTRUCT) post_action -- Semantic action executed after construct is parsed -- (nothing by default; may be redefined in descendants). -- (from CONSTRUCT) pre_action -- Semantic action executed before construct is parsed -- (nothing by default; may be redefined in descendants). -- (from CONSTRUCT) process -- Parse a specimen of the construct, then apply -- semantic actions if parsing successful. -- (from CONSTRUCT) semantics -- Apply semantic actions in order: -- `pre_action`, `in_action`, `post_action`. -- (from CONSTRUCT) swap (i: INTEGER_32) -- Exchange item at i-th position with item -- at cursor position. -- (from CHAIN) require -- from CHAIN not_off: not child_off valid_index: valid_index (i) ensure -- from CHAIN swapped_to_item: child_item = old i_th (i) swapped_from_item: i_th (i) = old child_item feature -- Conversion binary_representation: BINARY_TREE [detachable CONSTRUCT] -- Convert to binary tree representation: -- first child becomes left child, -- right sibling becomes right child. -- (from TREE) ensure -- from TREE result_is_root: Result.is_root result_has_no_right_child: not Result.has_right fill_from_binary (b: BINARY_TREE [detachable CONSTRUCT]) -- Fill from a binary tree representation. -- Left child becomes first child. -- Right child becomes right sibling. -- Any right child of b is ignored. -- (from DYNAMIC_TREE) linear_representation: LINEAR [detachable CONSTRUCT] -- Representation as a linear structure -- (from TREE) require -- from CONTAINER True feature -- Duplication copy (other: CHOICE) -- Copy contents from other. -- (from TREE) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: CHOICE) -- Effect equivalent to that of: -- `copy` (other . `deep_twin`) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: CHOICE -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: CHOICE) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: CHOICE -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: CHOICE -- New object equal to Current -- `twin` calls `copy`; to change copying/twinning semantics, redefine `copy`. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: detachable CHOICE -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.`default` for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Implementation child: like first_child -- Element at cursor position -- (from LINKED_LIST) forget_left -- Remove links with left neighbor. -- (from BI_LINKABLE) require -- from TREE True ensure -- from BI_LINKABLE left_not_chained: left_sibling = Void or else (attached {like left_sibling} old left_sibling as p implies p.right_sibling = Void) forget_right -- Remove links with right neighbor. -- (from BI_LINKABLE) require -- from LINKABLE True require -- from TREE True ensure -- from LINKABLE not_chained: right_sibling = Void ensure then -- from BI_LINKABLE right_not_chained: (attached {like right_sibling} old right_sibling as r) implies r.left_sibling = Void feature -- Element Change twl_merge_left (other: CONSTRUCT) -- Merge other into current structure before cursor -- position. Do not move cursor. Empty other. -- (from CONSTRUCT) require -- from DYNAMIC_CHAIN extendible: child_extendible not_before: not child_before other_exists: other /= Void not_current: other /= Current ensure -- from DYNAMIC_CHAIN new_count: arity = old arity + old other.arity new_index: child_index = old child_index + old other.arity other_is_empty: other.is_leaf twl_merge_right (other: CONSTRUCT) -- Merge other into current structure after cursor -- position. Do not move cursor. Empty other. -- (from CONSTRUCT) require -- from DYNAMIC_CHAIN extendible: child_extendible not_after: not child_after other_exists: other /= Void not_current: other /= Current ensure -- from DYNAMIC_CHAIN new_count: arity = old arity + old other.arity same_index: child_index = old child_index other_is_empty: other.is_leaf feature -- Iteration do_all (action: PROCEDURE [detachable CONSTRUCT]) -- Apply action to every item. -- Semantics not guaranteed if action changes the structure; -- in such a case, apply iterator to clone of structure instead. -- (from LINEAR) require -- from TRAVERSABLE action_exists: action /= Void do_if (action: PROCEDURE [detachable CONSTRUCT]; test: FUNCTION [detachable CONSTRUCT, BOOLEAN]) -- Apply action to every item that satisfies test. -- Semantics not guaranteed if action or test changes the structure; -- in such a case, apply iterator to clone of structure instead. -- (from LINEAR) require -- from TRAVERSABLE action_exists: action /= Void test_exists: test /= Void for_all (test: FUNCTION [detachable CONSTRUCT, BOOLEAN]): BOOLEAN -- Is test true for all items? -- Semantics not guaranteed if test changes the structure; -- in such a case, apply iterator to clone of structure instead. -- (from LINEAR) require -- from TRAVERSABLE test_exists: test /= Void ensure then -- from LINEAR empty: no_components implies Result new_cursor: TWO_WAY_TREE_ITERATION_CURSOR [detachable CONSTRUCT] -- Fresh cursor associated with current structure -- (from TWO_WAY_TREE) there_exists (test: FUNCTION [detachable CONSTRUCT, BOOLEAN]): BOOLEAN -- Is test true for at least one item? -- Semantics not guaranteed if test changes the structure; -- in such a case, apply iterator to clone of structure instead. -- (from LINEAR) require -- from TRAVERSABLE test_exists: test /= Void feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: detachable ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class print_name -- Print the construct name on standard output. -- (from CONSTRUCT) frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void invariant -- from TWO_WAY_TREE off_constraint: (child = Void) implies child_off -- from DYNAMIC_TREE extendible_definition: Extendible child_after_definition: child_after = (child_index = arity + 1) -- from TREE tree_consistency: is_stable and child_readable implies (attached child as c and then c.parent = Current) leaf_definition: no_components = (arity = 0) child_off_definition: child_off = child_before or child_after child_before_definition: child_before = (child_index = 0) child_isfirst_definition: child_isfirst = (not no_components and child_index = 1) child_islast_definition: child_islast = (not no_components and child_index = child_capacity) child_after_definition: child_after = (child_index >= child_capacity + 1) -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from BI_LINKABLE right_symmetry: attached right_sibling as r implies (r.left_sibling = Current) left_symmetry: attached left_sibling as l implies (l.right_sibling = Current) -- from TWO_WAY_LIST non_empty_list_has_two_endpoints: not no_components implies (first_child /= Void and last_child /= Void) empty_list_has_no_endpoints: no_components implies last_child = Void first_element_constraint: attached first_child as f implies f.left_sibling = Void last_element_constraint: attached last_child as l implies l.right_sibling = Void -- from LINKED_LIST prunable: prunable empty_constraint: no_components implies ((first_child = Void) and (child = Void)) not_void_unless_empty: (child = Void) implies no_components before_constraint: child_before implies (child = first_child) after_constraint: child_after implies (child = last_child) -- from LIST before_definition: child_before = (child_index = 0) after_definition: child_after = (child_index = arity + 1) -- from CHAIN non_negative_index: child_index >= 0 index_small_enough: child_index <= arity + 1 off_definition: child_off = ((child_index = 0) or (child_index = arity + 1)) isfirst_definition: child_isfirst = ((not no_components) and (child_index = 1)) islast_definition: child_islast = ((not no_components) and (child_index = arity)) item_corresponds_to_index: (not child_off) implies (child_item = i_th (child_index)) -- from ACTIVE writable_constraint: child_writable implies child_readable empty_constraint: no_components implies (not child_readable) and (not child_writable) -- from READABLE_INDEXABLE consistent_boundaries: Lower <= arity or else Lower = arity + 1 -- from BILINEAR not_both: not (child_after and child_before) before_constraint: child_before implies child_off -- from LINEAR after_constraint: child_after implies child_off -- from TRAVERSABLE empty_constraint: no_components implies child_off -- from FINITE empty_definition: no_components = (arity = 0) note copyright: "Copyright (c) 1984-2014, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class CHOICE -- Generated by Eiffel Studio --
For more details: eiffel.org