Automatic generation produced by ISE Eiffel

Classes Clusters Cluster hierarchy Chart Relations Text Flat Contracts Flat contracts Go to:
indexing status: "See notice at end of class" date: "$Date: 2001/11/16 20:34:14 $" revision: "$Revision: 1.1.1.1 $" class interface SEQ_STRING create make (n: INTEGER) -- Allocate space for at least n characters. -- (from STRING) require -- from STRING non_negative_size: n >= 0 ensure -- from STRING empty_string: count = 0 area_allocated: capacity >= n feature -- Initialization adapt (s: STRING): like Current -- Object of a type conforming to the type of s, -- initialized with attributes from s -- (from STRING) from_c (c_string: POINTER) -- Reset contents of string from contents of c_string, -- a string created by some external C function. -- (from STRING) require -- from STRING c_string_exists: c_string /= default_pointer ensure -- from STRING no_zero_byte: not has ('%U') from_c_substring (c_string: POINTER; start_pos, end_pos: INTEGER) -- Reset contents of string from substring of c_string, -- a string created by some external C function. -- (from STRING) require -- from STRING c_string_exists: c_string /= default_pointer start_position_big_enough: start_pos >= 1 end_position_big_enough: start_pos <= end_pos + 1 ensure -- from STRING valid_count: count = end_pos - start_pos + 1 make_from_c (c_string: POINTER) -- Initialize from contents of c_string, -- a string created by some external C function -- (from STRING) require -- from STRING c_string_exists: c_string /= default_pointer make_from_string (s: STRING) -- Initialize from the characters of s. -- (Useful in proper descendants of class STRING, -- to initialize a string-like object from a manifest string.) -- (from STRING) require -- from STRING string_exists: s /= void ensure -- from STRING shared_implementation: shared_with (s) feature -- Access area: SPECIAL [CHARACTER] -- Special data zone -- (from TO_SPECIAL) current_item: CHARACTER -- Current item require -- from TRAVERSABLE not_off: not off require -- from ACTIVE readable: readable False_constant: STRING is "false" -- Constant string "false" -- (from STRING) fuzzy_index (other: STRING; start: INTEGER; fuzz: INTEGER): INTEGER -- Position of first occurrence of other at or after start -- with 0..fuzz mismatches between the string and other. -- 0 if there are no fuzzy matches -- (from STRING) require -- from STRING other_exists: other /= void other_not_empty: not other.is_empty start_large_enough: start >= 1 start_small_enough: start <= count acceptable_fuzzy: fuzz <= other.count has (c: CHARACTER): BOOLEAN -- Does string include c? ensure -- from CONTAINER not_found_in_empty: Result implies not is_empty hash_code: INTEGER -- Hash code value -- (from STRING) ensure -- from HASHABLE good_hash_value: Result >= 0 index: INTEGER -- Index of current_item, if valid -- Valid values are between 1 and count (if count > 0). index_of (c: CHARACTER; start: INTEGER): INTEGER -- Position of first occurrence of c at or after start; -- 0 if none. -- (from STRING) require -- from STRING start_large_enough: start >= 1 start_small_enough: start <= count + 1 ensure -- from STRING correct_place: Result > 0 implies item (Result) = c index_of_occurrence (c: CHARACTER; i: INTEGER): INTEGER -- Index of i-th occurrence of c. -- 0 if none. require -- from LINEAR positive_occurrences: i > 0 ensure -- from LINEAR non_negative_result: Result >= 0 ensure then index_value: (Result = 0) or item (Result) = c item (i: INTEGER): CHARACTER -- Character at position i -- Was declared in STRING as synonym of @. -- (from STRING) require -- from TABLE valid_key: valid_index (k) item_code (i: INTEGER): INTEGER -- Numeric code of character at position i -- (from STRING) require -- from STRING index_small_enough: i <= count index_large_enough: i > 0 last_index_of (c: CHARACTER; start_index_from_end: INTEGER): INTEGER -- Position of last occurence of c. -- 0 if none -- (from STRING) require -- from STRING start_index_small_enough: start_index_from_end <= count start_index_large_enough: start_index_from_end >= 1 ensure -- from STRING correct_place: Result > 0 implies item (Result) = c off: BOOLEAN -- Is there no current item? -- (from BILINEAR) search_after (c: CHARACTER) -- Move cursor to first position -- (at or after current cursor position) -- where current_item and c are identical. search_before (c: CHARACTER) -- Move cursor to greatest position at or before cursor -- where current_item and c are identical; -- go before if unsuccessful. search_string_after (s: STRING; fuzzy: INTEGER) -- Move cursor to first position -- (at or after cursor position) where `substring -- (index, index + s.count)' and s are identical. -- Go after if unsuccessful. -- The 'fuzzy' parameter is the maximum allowed number -- of mismatches within the pattern. A 0 means an exact match. search_string_before (s: STRING; fuzzy: INTEGER) -- Move cursor to first position -- (at or before cursor position) where `substring -- (index, index + s.count)' and s are identical. -- Go before if unsuccessful. -- The 'fuzzy' parameter is the maximum allowed number -- of mismatches within the pattern. A 0 means an exact match. shared_with (other: like Current): BOOLEAN -- Does string share the text of other? -- (from STRING) substring_index (other: STRING; start: INTEGER): INTEGER -- Position of first occurrence of other at or after start; -- 0 if none. -- (from STRING) require -- from STRING other_nonvoid: other /= void other_notempty: not other.is_empty start_large_enough: start >= 1 start_small_enough: start <= count ensure -- from STRING correct_place: Result > 0 implies substring (Result, Result + other.count - 1).is_equal (other) True_constant: STRING is "true" -- Constant string "true" -- (from STRING) infix "@" (i: INTEGER): CHARACTER -- Character at position i -- Was declared in STRING as synonym of item. -- (from STRING) require -- from TABLE valid_key: valid_index (k) feature -- Measurement additional_space: INTEGER -- Proposed number of additional items -- (from RESIZABLE) ensure -- from RESIZABLE at_least_one: Result >= 1 capacity: INTEGER -- Allocated space -- (from STRING) count: INTEGER -- Actual number of characters making up the string -- (from STRING) Growth_percentage: INTEGER is 50 -- Percentage by which structure will grow automatically -- (from RESIZABLE) index_set: INTEGER_INTERVAL -- Range of acceptable indexes -- (from STRING) ensure -- from INDEXABLE not_void: Result /= void ensure then -- from STRING Result.count = count Minimal_increase: INTEGER is 5 -- Minimal number of additional items -- (from RESIZABLE) occurrences (c: CHARACTER): INTEGER -- Number of times c appears in the string -- (from STRING) ensure -- from BAG non_negative_occurrences: Result >= 0 feature -- Comparison is_equal (other: like Current): BOOLEAN -- Is string made of same character sequence as other -- (possibly with a different capacity)? -- (from STRING) require -- from ANY other_not_void: other /= void ensure -- from ANY symmetric: Result implies other.is_equal (Current) consistent: standard_is_equal (other) implies Result ensure then -- from COMPARABLE trichotomy: Result = (not (Current < other) and not (other < Current)) max (other: like Current): like Current -- The greater of current object and other -- (from COMPARABLE) require -- from COMPARABLE other_exists: other /= void ensure -- from COMPARABLE current_if_not_smaller: Current >= other implies Result = Current other_if_smaller: Current < other implies Result = other min (other: like Current): like Current -- The smaller of current object and other -- (from COMPARABLE) require -- from COMPARABLE other_exists: other /= void ensure -- from COMPARABLE current_if_not_greater: Current <= other implies Result = Current other_if_greater: Current > other implies Result = other three_way_comparison (other: like Current): INTEGER -- If current object equal to other, 0; -- if smaller, -1; if greater, 1 -- (from COMPARABLE) require -- from COMPARABLE other_exists: other /= void ensure -- from COMPARABLE equal_zero: (Result = 0) = is_equal (other) smaller_negative: (Result = - 1) = (Current < other) greater_positive: (Result = 1) = (Current > other) infix "<" (other: like Current): BOOLEAN -- Is string lexicographically lower than other? -- (from STRING) require -- from PART_COMPARABLE other_exists: other /= void ensure then -- from COMPARABLE asymmetric: Result implies not (other < Current) infix "<=" (other: like Current): BOOLEAN -- Is current object less than or equal to other? -- (from COMPARABLE) require -- from PART_COMPARABLE other_exists: other /= void ensure then -- from COMPARABLE definition: Result = ((Current < other) or is_equal (other)) infix ">" (other: like Current): BOOLEAN -- Is current object greater than other? -- (from COMPARABLE) require -- from PART_COMPARABLE other_exists: other /= void ensure then -- from COMPARABLE definition: Result = (other < Current) infix ">=" (other: like Current): BOOLEAN -- Is current object greater than or equal to other? -- (from COMPARABLE) require -- from PART_COMPARABLE other_exists: other /= void ensure then -- from COMPARABLE definition: Result = (other <= Current) feature -- Status report after: BOOLEAN -- Is there no valid cursor position to the right of cursor? before: BOOLEAN -- Is there no valid cursor position to the left of cursor? Changeable_comparison_criterion: BOOLEAN is False -- (from STRING) exhausted: BOOLEAN -- Has structure been completely explored? -- (from LINEAR) ensure -- from LINEAR exhausted_when_off: off implies Result Extendible: BOOLEAN is True -- May new items be added? (Answer: yes.) -- (from STRING) full: BOOLEAN -- Is structure full? -- (from BOUNDED) is_boolean: BOOLEAN -- Does Current represent a BOOLEAN? -- (from STRING) is_double: BOOLEAN -- Does Current represent a DOUBLE? -- (from STRING) is_empty: BOOLEAN -- Is structure empty? -- (from FINITE) is_hashable: BOOLEAN -- May current object be hashed? -- (True if it is not its type's default.) -- (from HASHABLE) ensure -- from HASHABLE ok_if_not_default: Result implies (Current /= default) is_inserted (v: CHARACTER): BOOLEAN -- Has v been inserted by the most recent insertion? -- (By default, the value returned is equivalent to calling -- `has (v)'. However, descendants might be able to provide more -- efficient implementations.) -- (from COLLECTION) is_integer: BOOLEAN -- Does Current represent an INTEGER? -- (from STRING) is_real: BOOLEAN -- Does Current represent a REAL? -- (from STRING) object_comparison: BOOLEAN -- Must search operations use equal rather than = -- for comparing references? (Default: no, use =.) -- (from CONTAINER) prunable: BOOLEAN -- May items be removed? (Answer: yes.) -- (from STRING) readable: BOOLEAN -- Is there a current item that may be read? -- (from SEQUENCE) resizable: BOOLEAN -- May capacity be changed? (Answer: yes.) -- (from RESIZABLE) valid_index (i: INTEGER): BOOLEAN -- Is i within the bounds of the string? -- (from STRING) ensure then -- from INDEXABLE only_if_in_index_set: Result implies ((i >= index_set.lower) and (i <= index_set.upper)) writable: BOOLEAN -- Is there a current item that may be modified? -- (from SEQUENCE) 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 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 ensure -- from CONTAINER reference_comparison: not object_comparison feature -- Cursor movement back -- Move to previous position. require -- from BILINEAR not_before: not before finish -- Move to last position. forth -- Move to next position. require -- from LINEAR not_after: not after search (v: like current_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 equal (v, current_item) item_found: (not exhausted and not object_comparison) implies v = current_item start -- Move to first position. feature -- Element change append (s: STRING) -- Append a copy of s at end. -- (from STRING) require -- from STRING argument_not_void: s /= void ensure -- from STRING new_count: count = old count + old s.count append_boolean (b: BOOLEAN) -- Append the string representation of b at end. -- (from STRING) append_character (c: CHARACTER) -- Append c at end. -- Was declared in STRING as synonym of extend. -- (from STRING) ensure then -- from STRING item_inserted: item (count) = c new_count: count = old count + 1 append_double (d: DOUBLE) -- Append the string representation of d at end. -- (from STRING) append_integer (i: INTEGER) -- Append the string representation of i at end. -- (from STRING) append_real (r: REAL) -- Append the string representation of r at end. -- (from STRING) append_string (s: STRING) -- Append a copy of s, if not void, at end. -- (from STRING) copy (other: like Current) -- Reinitialize by copying the characters of other. -- (This is also used by clone.) -- (from STRING) require -- from ANY other_not_void: other /= void type_identity: same_type (other) ensure -- from ANY is_equal: is_equal (other) ensure then -- from STRING new_result_count: count = other.count extend (c: CHARACTER) -- Append c at end. -- Was declared in STRING as synonym of append_character. -- (from STRING) require -- from COLLECTION extendible: extendible ensure -- from COLLECTION item_inserted: is_inserted (v) ensure then -- from BAG one_more_occurrence: occurrences (v) = old (occurrences (v)) + 1 ensure then -- from STRING item_inserted: item (count) = c new_count: count = old count + 1 fill (other: CONTAINER [CHARACTER]) -- Fill with as many items of other as possible. -- The representations of other and current structure -- need not be the same. -- (from COLLECTION) require -- from COLLECTION other_not_void: other /= void extendible fill_blank -- Fill with capacity blank characters. -- (from STRING) ensure -- from STRING filled: full same_size: (count = capacity) and (capacity = old capacity) fill_character (c: CHARACTER) -- Fill with capacity characters all equal to c. -- (from STRING) ensure -- from STRING filled: full same_size: (count = capacity) and (capacity = old capacity) force (v: like current_item) -- Add v to end. -- (from SEQUENCE) require -- from SEQUENCE extendible: extendible ensure then -- from SEQUENCE new_count: count = old count + 1 item_inserted: has (v) head (n: INTEGER) -- Remove all characters except for the first n; -- do nothing if n >= count. -- (from STRING) require -- from STRING non_negative_argument: n >= 0 ensure -- from STRING new_count: count = n.min (old count) insert (s: STRING; i: INTEGER) -- Add s to the left of position i in current string. -- (from STRING) require -- from STRING string_exists: s /= void index_small_enough: i <= count index_large_enough: i > 0 ensure -- from STRING new_count: count = old count + s.count left_adjust -- Remove leading whitespace. -- (from STRING) ensure -- from STRING new_count: (count /= 0) implies ((item (1) /= ' ') and (item (1) /= '%T') and (item (1) /= '%R') and (item (1) /= '%N')) string_precede (c: CHARACTER) -- Add c at front. -- (from STRING) ensure -- from STRING new_count: count = old count + 1 precede (c: CHARACTER) -- Add c at front. ensure new_index: index = old index + 1 prepend (s: STRING) -- Prepend a copy of s at front. require argument_not_void: s /= void ensure new_index: index = old index + s.count string_prepend (s: STRING) -- Prepend a copy of s at front. -- (from STRING) require -- from STRING argument_not_void: s /= void ensure -- from STRING new_count: count = old count + s.count prepend_boolean (b: BOOLEAN) -- Prepend the string representation of b at front. -- (from STRING) prepend_character (c: CHARACTER) -- Prepend the string representation of c at front. -- (from STRING) prepend_double (d: DOUBLE) -- Prepend the string representation of d at front. -- (from STRING) prepend_integer (i: INTEGER) -- Prepend the string representation of i at front. -- (from STRING) prepend_real (r: REAL) -- Prepend the string representation of r at front. -- (from STRING) prepend_string (s: STRING) -- Prepend a copy of s, if not void, at front. -- (from STRING) put (c: CHARACTER; i: INTEGER) -- Replace character at position i by c. -- (from STRING) require -- from TABLE valid_key: valid_index (k) ensure then -- from INDEXABLE insertion_done: item (