org.jutil.jregex
Class Pattern
java.lang.Object
|
+--jregex.Pattern
|
+--org.jutil.jregex.Pattern
- All Implemented Interfaces:
- jregex.REFlags, java.io.Serializable
- Direct Known Subclasses:
- Pattern
- public class Pattern
- extends jregex.Pattern
A class that adapts the jregex.Pattern interface to the
java.util.regex.Pattern interface.
| Class Specifications |
|
public invariant pattern() != null; |
| Fields inherited from class jregex.Pattern |
counters, lookaheads, memregs, namedGroupMap, root, root0, stringRepr |
| Fields inherited from interface jregex.REFlags |
IGNORE_CASE, IGNORE_SPACES, UNICODE, XML_SCHEMA |
|
Constructor Summary |
Pattern(java.lang.String regex)
Initialize a new Pattern with default flags and the
given regular expression |
Pattern(java.lang.String regex,
int flags)
Initialize a new Pattern with the given regular expression and flags. |
|
Method Summary |
java.lang.Object |
clone()
Return a clone of this Pattern. |
boolean |
equals(java.lang.Object other)
See superclass |
int |
flags()
Return the flags of this Pattern. |
java.lang.String |
pattern()
Return the pattern used to build this Pattern. |
| Methods inherited from class jregex.Pattern |
compile, groupCount, groupId, matcher, matcher, matcher, matcher, matcher, matcher, matches, parseFlags, parseFlags, replacer, replacer, startsWith, tokenizer, tokenizer, tokenizer, toString, toString_d |
| Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DEFAULT
public static final int DEFAULT
DOTALL
public static final int DOTALL
MULTILINE
public static final int MULTILINE
Pattern
public Pattern(java.lang.String regex)
throws jregex.PatternSyntaxException
- Initialize a new Pattern with default flags and the
given regular expression
- Parameters:
regex - The regular expression string.
- Specifications:
-
public behavior
requires regex != null;
ensures pattern().equals(regex);
ensures flags() == DEFAULT;
signals (PatternSyntaxException) (* The given String is not a valid regular expression *);
Pattern
public Pattern(java.lang.String regex,
int flags)
throws jregex.PatternSyntaxException
- Initialize a new Pattern with the given regular expression and flags.
- Parameters:
regex - The regular expression string.flags - The flags for the new Pattern.
- Specifications:
-
public behavior
requires regex != null;
requires (* The given flags must be valid. *);
ensures pattern().equals(regex);
ensures flags() == flags;
signals (PatternSyntaxException) (* The given String is not a valid regular expression *);
pattern
public java.lang.String pattern()
- Return the pattern used to build this Pattern.
- Specifications:
-
public behavior
ensures \result .equals(toString());
equals
public boolean equals(java.lang.Object other)
- See superclass
- Specifications:
- also
-
public behavior
ensures \result == (other instanceof Pattern)&&(pattern().equals(((Pattern)other).pattern()))&&(flags() == ((Pattern)other).flags());
clone
public java.lang.Object clone()
- Return a clone of this Pattern.
- Specifications:
- also
-
public behavior
ensures \result .equals(this);
flags
public int flags()
- Return the flags of this Pattern.