eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'StringPattern':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: StringPattern


Inheritance:

   Object
   |
   +--StringPattern
      |
      +--StringPattern::Includes
      |
      +--StringPattern::Matches
      |
      +--StringPattern::StartsWith

Package:
stx:libbasic2
Category:
Collections-Text-Support
Version:
rev: 1.14 date: 2017/01/24 00:05:39
user: cg
file: StringPattern.st directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
Jan Vrany <jan.vrany@fit.cvut.cz>

Description:


A StringPattern instances are used to match string. The
pattern is build from a user-supplied string. It is the
intention to let the user type the search pattern - it can
be used for various live searches in lists, dialogs etc.

This is an unfinished class. More detailed description about
syntax and algorithm will be added once the results will be
considered good and the API become stable. 
If not, blame it on JV :-)


[instance variables:]

[class variables:]


Related information:



Class protocol:

instance creation
o  includes: aString

o  matches: aString

o  readFrom: aStringOrStream onError: exceptionBlock
StringPattern readFrom: 'abcd'
StringPattern readFrom: ' abcd'
StringPattern readFrom: ' a??d'
StringPattern readFrom: ' a*d*'
StringPattern readFrom: 'abcd*'

o  startsWith: aString


Instance protocol:

conversion
o  asString
Returns a string representation of the pattern.

`StringPattern fromString: pattern asString` should return
the same pattern (same meaning equal)

** This method raises an error - it must be redefined in concrete classes **

initialization
o  on: anObject

matching
o  match: string

o  match: string case: case

o  match: string case: case relax: relax

o  match: string from: from to: to

o  match: string from: from to: to case: case

o  match: string from: from to: to case: case relax: relax
Answers true if receiver matches the given `string`
portion starting at `from`, ending at `to`.
If `case` is true, then perform natch case sensitive,
otherwise match case insensitive.

`relax` argument say how much the matching should
be relaxed - relax is a number in <1..3>, where
1 means no relaxing at all (aka exact match).
All patterns should support relax == 1. If the relax
level is not supported by a pattern, false must be
returned.

** This method raises an error - it must be redefined in concrete classes **

o  match: string from: from to: to relax: relax

o  match: string relax: relax

printing & storing
o  printOn: aStream
append a printed representation of the receiver to the argument, aStream

utilities
o  matchObject: anObject
Return true if pattern matches given object with relax level 1.

Some heuristics is performed to obtain the object's textual representation.

o  matchObject: object relax: relax
Return true if pattern matches given object.

Some heuristics is performed to obtain the object's textual representation.


Private classes:

    Includes
    Matches
    Parser
    StartsWith


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 19 Apr 2024 20:30:13 GMT