|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--eapms.ANSIFormat
Base class for ANSI formatting of text
Nested Class Summary | |
static class |
ANSIFormat.Attrs
ANSI Attribute Modifiers |
static class |
ANSIFormat.BGColors
ANSI Background Colors |
static class |
ANSIFormat.FGColors
ANSI Foreground Colors |
Field Summary | |
static java.lang.String |
CHAR_CLASS
The required character class for code matching. |
static int |
DEFAULT_FLAGS
Default flags for regex compile. |
static int |
DEFAULT_INDEX
Default capturing group index |
static java.lang.String |
DEFAULT_REGEX
The default regular expression: html-like tags. |
protected static int |
mFlags
|
protected static boolean |
mFlagsSet
|
protected static java.util.regex.Pattern |
mPattern
|
protected static java.lang.String |
mRegex
|
protected static int |
mRepndx
|
static java.lang.String |
PLACEHOLDER
Placeholder for user-entered regex's. |
static java.lang.String |
UNICODE_ESCAPE
The Unicode value for an Escape sequence. |
Constructor Summary | |
ANSIFormat()
|
Method Summary | |
void |
compilePattern()
|
void |
compilePattern(java.lang.String re)
|
void |
compilePattern(java.lang.String re,
int ndx)
|
abstract void |
compilePattern(java.lang.String regex,
int repndx,
int flags)
Compiles the regex supplied with the supplied flags. |
int |
getFlags()
|
java.util.regex.Pattern |
getPattern()
|
java.lang.String |
getRegex()
|
abstract java.lang.String |
stringReplace(java.lang.String str)
Simply takes the string str and returns a much
prettier version of it. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String PLACEHOLDER
public static final java.lang.String DEFAULT_REGEX
public static final java.lang.String CHAR_CLASS
public static final java.lang.String UNICODE_ESCAPE
public static final int DEFAULT_FLAGS
Regex Pattern Class
,
Constant Field Valuespublic static final int DEFAULT_INDEX
protected static int mFlags
protected static int mRepndx
protected static java.lang.String mRegex
protected static java.util.regex.Pattern mPattern
protected static boolean mFlagsSet
Constructor Detail |
public ANSIFormat()
Method Detail |
public java.lang.String getRegex()
public java.util.regex.Pattern getPattern()
public int getFlags()
public void compilePattern()
public void compilePattern(java.lang.String re)
public void compilePattern(java.lang.String re, int ndx)
public abstract void compilePattern(java.lang.String regex, int repndx, int flags) throws java.lang.IllegalArgumentException, java.util.regex.PatternSyntaxException
regex
must be in a certain form.
As there is a specific character class
that must be
used in the matching, a placeholder
is used in the
regex string. You must therefore pass a regex
string with
this placeholder, such as
\<("+ANSIFormat.PLACEHOLDER+"*?)\>([^<]*)
"%%%"
, so the above would be:\<(%%%*?)\>([^<]*)"
character class
to become
\<([brnglmcw~+-_*;?!]*?)\>([^<]*)"
repndx
integer as the second
argument - this value tells the
stringReplace
method which
capturing group to look in to find where the actual color codes are held
(otherwise it won't know which part is color codes and which is text).
java.util.regex.PatternSyntaxException
- Wrong syntax, retard.
java.lang.IllegalArgumentException
- The repndx value must be greater
than zero - can also be thrown from something in the regex class, but I
don't know why...go look it up, idiot.public abstract java.lang.String stringReplace(java.lang.String str)
str
and returns a much
prettier version of it.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |