Automatic generation produced by ISE Eiffel

Classes Clusters Cluster hierarchy Chart Relations Flat contracts Go to:
note description: "[ Pattern match algorithm to match a pattern containing wild cards. Done through the Knuth, Morris, Pratt algorithm. ]" legal: "See notice at end of class." status: "See notice at end of class." date: "$Date: 2021-04-06 02:22:01 -0800 (Tue, 06 Apr 2021) $" revision: "$Revision: 105267 $" class interface KMP_WILD create make (new_pattern, new_text: READABLE_STRING_GENERAL) -- Create a matcher to search pattern -- new_pattern in text new_text. -- (from MATCHER) require -- from MATCHER new_pattern_non_void: new_pattern /= Void not_new_pattern_empty: not new_pattern.is_empty new_text_non_void: new_text /= Void not_new_text_empty: not new_text.is_empty ensure -- from MATCHER pattern_is_new_pattern: pattern.same_string_general (new_pattern) text_is_new_text: text.same_string_general (new_text) make_empty -- Create a matcher to search for a pattern -- in a text. Initialize it later. require -- from MATCHER True feature -- Initialization make_empty -- Create a matcher to search for a pattern -- in a text. Initialize it later. require -- from MATCHER True feature -- Access found_pattern_length: INTEGER_32 -- length of the found pattern in text generating_type: TYPE [detachable KMP_WILD] -- 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 lengths: detachable ARRAYED_LIST [INTEGER_32] -- lengths of found patterns in text matching_indices: detachable ARRAYED_LIST [INTEGER_32] -- Indices of found pattern in text. -- (from KMP_MATCHER) 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: KMP_WILD): 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: KMP_WILD): BOOLEAN -- Is other attached to an object considered -- equal to current object? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result 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: KMP_WILD): 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 character_representation: CHARACTER_32 -- The character that represents any single -- character in `text`. 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 found: BOOLEAN -- Is `pattern` found in `text`? -- (from MATCHER) found_at: INTEGER_32 -- Index in `text` where `pattern` was found. has_wild_cards: BOOLEAN -- Has Current either of `string_representation` or -- `character_representation`? require pattern_set: pattern /= Void pattern: STRING_32 -- The pattern to search for. -- (from MATCHER) 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)) string_representation: CHARACTER_32 -- The character that represents any string -- in `text`. text: STRING_32 -- The text where `pattern` is to be found. -- (from MATCHER) feature -- Status setting disable_case_sensitive -- Set `is_not_case_sensitive` to True. -- (from KMP_MATCHER) enable_case_sensitive -- Set `is_not_case_sensitive` to False. -- (from KMP_MATCHER) set_character_representation (new_char_rep: CHARACTER_32) -- Set `character_representation` to -- new_char_rep. require new_char_rep_not_nul_char: new_char_rep /= '%U'.to_character_32 new_char_rep_different: new_char_rep /= string_representation ensure character_representation_is_new_char_rep: character_representation = new_char_rep set_pattern (new_pattern: READABLE_STRING_GENERAL) -- Set the `pattern` to new_pattern. require -- from MATCHER new_pattern_non_void: new_pattern /= Void ensure -- from MATCHER pattern_is_new_pattern: pattern.same_string_general (new_pattern) set_string_representation (new_str_rep: CHARACTER_32) -- Set `string_representation` to -- new_str_rep. require new_str_rep_not_nul_char: new_str_rep /= '%U'.to_character_32 new_str_rep_different: new_str_rep /= character_representation ensure string_representation_is_new_str_rep: string_representation = new_str_rep set_text (new_text: READABLE_STRING_GENERAL) -- Change the text to new_text -- Next search will start at the beginning -- of the text. -- (from MATCHER) require -- from MATCHER new_text_non_void: new_text /= Void ensure -- from MATCHER text_is_new_text: text.same_string_general (new_text) search_from_start: index = 1 start_at (i: INTEGER_32) -- Start search at position i. -- (from MATCHER) require -- from MATCHER i_large_enough: i >= 1 i_small_enough: i <= text.count ensure -- from MATCHER index_set: index = i feature -- Duplication copy (other: KMP_WILD) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: KMP_WILD) -- 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: KMP_WILD -- 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: KMP_WILD) -- 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: KMP_WILD -- 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: KMP_WILD -- 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 KMP_WILD -- 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 -- Creation make (new_pattern, new_text: READABLE_STRING_GENERAL) -- Create a matcher to search pattern -- new_pattern in text new_text. -- (from MATCHER) require -- from MATCHER new_pattern_non_void: new_pattern /= Void not_new_pattern_empty: not new_pattern.is_empty new_text_non_void: new_text /= Void not_new_text_empty: not new_text.is_empty ensure -- from MATCHER pattern_is_new_pattern: pattern.same_string_general (new_pattern) text_is_new_text: text.same_string_general (new_text) 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 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 feature -- Search find_matching_indices -- All indices in `text` which matches the -- very next occurrence of `pattern`. require -- from KMP_MATCHER True ensure -- from KMP_MATCHER found_or_not_found: attached matching_indices as le_indices and then not le_indices.is_empty = search_for_pattern ensure then created: lengths /= Void pattern_matches: BOOLEAN -- Does `text` exactly match `pattern`? search_for_pattern: BOOLEAN -- Search in the text to find the very next -- occurrence of `pattern`. require -- from MATCHER pattern_valid: pattern /= Void and then not pattern.is_empty text_valid: text /= Void and then not text.is_empty feature -- Status Report is_not_case_sensitive: BOOLEAN -- Is the search case insensitive? -- (from KMP_MATCHER) invariant attached_string_list: string_list /= Void string_list_contains_non_empty_item: string_list.for_all (agent (s: STRING_32): BOOLEAN ) different_character_and_string_representation: string_representation /= character_representation -- from MATCHER text_attached: text /= Void pattern_attached: pattern /= Void -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) note copyright: "Copyright (c) 1984-2021, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" licensing_options: "http://www.eiffel.com/licensing" copying: "[ This file is part of Eiffel Software's Eiffel Development Environment. Eiffel Software's Eiffel Development Environment is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License (available at the URL listed under "license" above). Eiffel Software's Eiffel Development Environment is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eiffel Software's Eiffel Development Environment; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA ]" 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 KMP_WILD
Classes Clusters Cluster hierarchy Chart Relations Flat contracts Go to:

-- Generated by Eiffel Studio --
For more details: eiffel.org