INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES

indexing

description: "Misspelled substring matcher"
cluster: matcher
class MISSPELLED
inherit

MATCHER
rename
make as matcher_make,
make_sensitive as matcher_make_sensitive,
make_insensitive as matcher_make_insensitive
export
{NONE}
matcher_make,
matcher_make_insensitive,
matcher_make_sensitive
end

MATCHER
redefine
make,
make_insensitive,
make_sensitive
select
make,
make_insensitive,
make_sensitive
end
creation

make,
make_insensitive,
make_insensitive_misspelled,
make_misspelled,
make_sensitive,
make_sensitive_misspelled
feature -- Initialization

make (p: STRING)
-- Make a misspelled matcher from search pattern `p'.
-- Case sensitivity (which is enabled at object creation)
-- is not modified. The maximum number of misspelled characters
-- depends on the patterns length and is taken from `default_blur'.
ensure
compiled: compiled

make_sensitive (p: STRING)
-- Make a misspelled matcher from search pattern `p' that is case
-- sensitive. The blurredness is taken from `default_blur'.
ensure
compiled: compiled

make_insensitive (p: STRING)
-- Make a misspelled matcher from search pattern `p' that is case
-- insensitive. The blurredness is taken from `default_blur'.
ensure
compiled: compiled

make_misspelled (p: STRING; mm: INTEGER)
-- Make a misspelled matcher from search pattern `p' with at most
-- `mm' misspelled characters. Case sensitivity (which is enabled
-- at object creation) is not modified.
require
pattern_defined: p /= void
blur_defined: mm >= 0 and mm <= p.count
ensure
compiled: compiled

make_sensitive_misspelled (p: STRING; mm: INTEGER)
-- Make a misspelled matcher from search pattern `p' with at most
-- `mm' misspelled characters. The matcher is case sensitive.
require
pattern_defined: p /= void
blur_defined: mm >= 0 and mm <= p.count
ensure
compiled: compiled

make_insensitive_misspelled (p: STRING; mm: INTEGER)
-- Make a misspelled matcher from search pattern `p' with at most
-- `mm' misspelled characters. The matcher is case insensitive.
require
pattern_defined: p /= void
blur_defined: mm >= 0 and mm <= p.count
ensure
compiled: compiled
feature -- Modification

set_blur (mm: INTEGER)
-- Set the maximum number of allowed mismatches.
require
blur_defined: mm >= 0 and mm <= pattern.count
ensure
blur_set: blur = mm

set_sensitive
-- Make searcher case-sensitive.

set_insensitive
-- Make searcher case-insensitive.

set_multi_line
-- Set matcher in multi-line mode. Mode is kept until matcher is
-- explicitely set to single-line mode.

set_single_line
-- Set matcher in single-line mode. Mode is kept until matcher is
-- explicitely set to multi-line mode.
feature -- Status report

multi_line: BOOLEAN

single_line: BOOLEAN
-- Is matcher in single-line mode? This is the default on object
-- creation.

blur: INTEGER

default_blur: INTEGER
-- Default blurredness of the matcher.

mismatches: INTEGER
feature -- Searching

search_forward (s: STRING; s_from, s_to: INTEGER)
-- Search for `pattern' in string `s'. Start searching at index
-- position `s_from' and search until the pattern matches (while
-- ignoring any characters behind `s_to'). If pattern matches, set
-- `found' to true, `mismatches' to the number of mismatches that
-- occured and `start_position' and `end_position' to the
-- corresponding index positions (relative to the beginning
-- of the string). If the pattern doesn't match, set `found' to
-- false, but do not modify `start_position', `end_position' or
-- `mismatches'.
require
empty_range: s_from - 1 = s_to

search_backward (s: STRING; s_from, s_to: INTEGER)
-- Search for `pattern' in string `s'. Start searching at index
-- position `s_to' and search backward until the pattern matches
-- (ignoring any characters before `s_from'). If pattern matches,
-- set `found' to true, `mismatches' to the number of mismatches
-- that occured and `start_position' and `end_position' to the
-- corresponding index positions (relative to the beginning
-- of the string). If the pattern doesn't match, set `found' to
-- false, but do not modify `start_position', `end_position' or
-- `mismatches'.
require
empty_range: s_from - 1 = s_to
feature -- Matching actions

match (s: STRING)
-- Match `pattern' against string `s'. The whole string must
-- match. Set attributes `found' and - if match succeeded -
-- `start_position', `end_position' and `mismatches'.

match_prefix (s: STRING)
-- Match `pattern' against prefix of string `s'.
-- Matching is forward in `s'. Set attributes `found' and -
-- if match succeeded - `start_position' and `end_position' and
-- `mismatches'.

match_suffix (s: STRING)
-- Match `pattern' against suffix of string `s'.
-- Matching is backward in `s'. Set attributes `found' and -
-- if match succeeded - `start_position' and `end_position' and
-- `mismatches'.

match_left_part (s: STRING)
-- Match `pattern' against any substring of string `s'.
-- Matching is from left to right. Set attributes `found' and -
-- if match succeeded - `start_position' and `end_position' and
-- `mismatches'.

match_right_part (s: STRING)
-- Match `pattern' against any substring of string `s'.
-- Matching is from right to left. Set attributes `found' and -
-- if match succeeded - `start_position' and `end_position' and
-- `mismatches'.
feature -- Matching questions

matches (s: STRING): BOOLEAN
-- Does string `s' matches with pattern? The whole string must
-- match. None of the position attributes nor `found' is modified.

matches_prefix (s: STRING): BOOLEAN
-- Does any prefix of string `s' matches with pattern?
-- Neither a position attribute nor `found' is modified.

matches_suffix (s: STRING): BOOLEAN
-- Does any suffix of string `s' matches with pattern?
-- Neither a position attribute nor `found' is modified.

matches_left_part (s: STRING): BOOLEAN
-- Does any substring of `s' matches with pattern?
-- Neither a position attribute nor `found' is modified.

matches_right_part (s: STRING): BOOLEAN
-- Does any substring of `s' matches with pattern?
-- Neither a position attribute nor `found' is modified.
end -- class MISSPELLED

INDEX CLUSTER FEATURES SHORT FRAMES NO FRAMES