Automatic generation produced by ISE Eiffel
note description: "Pattern matcher through the Knuth Morris Pratt algorithm. See details at the end" legal: "See notice at end of class." status: "See notice at end of class." date: "$Date: 2013-11-19 16:34:28 -0900 (Tue, 19 Nov 2013) $" revision: "$Revision: 93466 $" class interface KMP_MATCHER 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. feature -- Access found_pattern_length: INTEGER_32 -- Length of the found pattern in text. generating_type: TYPE [detachable KMP_MATCHER] -- 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. 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_MATCHER): 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_MATCHER): 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_MATCHER): 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 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 -- Position where `pattern` is found in -- `text`. -- (from MATCHER) require -- from MATCHER found: found 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)) 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. enable_case_sensitive -- Set `is_not_case_sensitive` to False. set_pattern (new_pattern: READABLE_STRING_GENERAL) -- Set `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_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_MATCHER) -- 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_MATCHER) -- 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_MATCHER -- 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_MATCHER) -- 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_MATCHER -- 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_MATCHER -- 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_MATCHER -- 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) make_empty -- Create a matcher to search for a pattern -- in a text. Initialize it later. 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`. ensure found_or_not_found: attached matching_indices as le_indices and then not le_indices.is_empty = search_for_pattern search_for_pattern: BOOLEAN -- Search in `text` to find 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? invariant -- 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-2012, 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_MATCHER -- Generated by Eiffel Studio --
For more details: eiffel.org