|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.zeevbelkin.commons.ComparablePattern
public class ComparablePattern
This class wraps Pattern to make it comparable and serializable. Also special "compare only" instances can be created for the optimization purposes. These instances can not be used to obtain a matcher.
Constructor Summary | |
---|---|
ComparablePattern(java.util.regex.Pattern p)
creates a ComparablePattern instance that wrap a Pattern |
|
ComparablePattern(java.lang.String s,
boolean compareonly)
|
Method Summary | |
---|---|
int |
compareTo(ComparablePattern o)
compares the objects by comparing their string representations |
static ComparablePattern |
compile(java.lang.String s)
creates a new ComparablePattern instance that encapsulates a Pattern instance. |
boolean |
equals(java.lang.Object o)
tests the objects equality by equality of their string representations |
int |
hashCode()
|
java.util.regex.Matcher |
matcher(java.lang.CharSequence input)
calls the wrapped object Pattern.matcher method |
java.lang.String |
toString()
returns a string from which the encapsulated pattern was compiled, or, in case if the class instance is a "compare only" object the encapsulated string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ComparablePattern(java.lang.String s, boolean compareonly)
s
- a string to be compiled to the pattern, or to be encapsulated
in a case of a "compare only" objectcompareonly
- should be true to create a "compare only" instancepublic ComparablePattern(java.util.regex.Pattern p)
Pattern
p
- a pattern to wrapMethod Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public static ComparablePattern compile(java.lang.String s)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- public java.util.regex.Matcher matcher(java.lang.CharSequence input)
public int compareTo(ComparablePattern o)
compareTo
in interface java.lang.Comparable<ComparablePattern>
o
-
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |