Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

pspdash
Class Perl5Util  view Perl5Util download Perl5Util.java

java.lang.Object
  extended bypspdash.Perl5Util

public class Perl5Util
extends java.lang.Object

Limit dependence upon a particular regular expression library. Eventually when process dashboard moves to Java 1.4, we can just use the built-in java.util.regex package. But this won't be a realistic option until Java 1.4 is available on all platforms, including Mac OS X


Nested Class Summary
 class Perl5Util.RegexpException
           
 
Field Summary
private static java.util.Map cachedPatterns
           
private static java.util.Map cachedReplacers
           
private  Matcher matcher
           
private static int MAX_CACHED_PATTERNS
           
 
Constructor Summary
Perl5Util()
           
 
Method Summary
private static java.lang.String getFlags(java.lang.String expression)
          Extract the flags from a perl 5 regular expression
private static Pattern getPattern(java.lang.String expression)
          Get or create a new Pattern object for the given perl 5 regular expression
private static java.lang.String getRegexp(java.lang.String expression)
          Extract the pattern from a perl 5 regular expression
private static java.lang.String getReplacement(java.lang.String expression)
          Extract the replacement from a perl 5 subst expression
private static Replacer getReplacer(java.lang.String expression)
          Get or create a new Replacer object for the given perl 5 substitution expression
private static char getSlashChar(java.lang.String expression)
          Determine which character was used in lieu of the slashes
 java.lang.String group(int group)
          Returns the contents of one of the parenthesized subgroups of the last match found.
private static Pattern makePattern(java.lang.String expression)
          Create a new Pattern object for the given perl 5 regular expression
private static Replacer makeReplacer(java.lang.String expression)
          Create a new Replacer object for the given perl 5 substitution expression
 boolean match(java.lang.String expression, char[] input)
          Return true if the given input matches a substring within the given expression.
 boolean match(java.lang.String expression, java.lang.String input)
          Return true if the given input matches a substring within the given expression.
 java.lang.String postMatch()
          Returns the part of the input following that last match found
 java.lang.String preMatch()
          Returns the part of the input preceding that last match found
static java.lang.String regexpQuote(java.lang.String s)
          Quote any special characters in the string to disable their special meaning.
private static void showError(java.lang.String error)
           
 java.lang.String substitute(java.lang.String expression, java.lang.String input)
          Perform the global substitution specified by expression on the given input, and return the result.
 java.lang.String substitute(java.lang.String oldExpr, java.lang.String newExpr, java.lang.String input)
          Perform the global substitution specified by expression on the given input, and return the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CACHED_PATTERNS

private static int MAX_CACHED_PATTERNS

cachedPatterns

private static java.util.Map cachedPatterns

matcher

private Matcher matcher

cachedReplacers

private static java.util.Map cachedReplacers
Constructor Detail

Perl5Util

public Perl5Util()
Method Detail

getSlashChar

private static char getSlashChar(java.lang.String expression)
Determine which character was used in lieu of the slashes


getRegexp

private static java.lang.String getRegexp(java.lang.String expression)
Extract the pattern from a perl 5 regular expression


getReplacement

private static java.lang.String getReplacement(java.lang.String expression)
Extract the replacement from a perl 5 subst expression


getFlags

private static java.lang.String getFlags(java.lang.String expression)
Extract the flags from a perl 5 regular expression


makePattern

private static Pattern makePattern(java.lang.String expression)
Create a new Pattern object for the given perl 5 regular expression


getPattern

private static Pattern getPattern(java.lang.String expression)
Get or create a new Pattern object for the given perl 5 regular expression


match

public boolean match(java.lang.String expression,
                     char[] input)
              throws Perl5Util.RegexpException
Return true if the given input matches a substring within the given expression.


match

public boolean match(java.lang.String expression,
                     java.lang.String input)
              throws Perl5Util.RegexpException
Return true if the given input matches a substring within the given expression.


makeReplacer

private static Replacer makeReplacer(java.lang.String expression)
Create a new Replacer object for the given perl 5 substitution expression


getReplacer

private static Replacer getReplacer(java.lang.String expression)
Get or create a new Replacer object for the given perl 5 substitution expression


substitute

public java.lang.String substitute(java.lang.String expression,
                                   java.lang.String input)
                            throws Perl5Util.RegexpException
Perform the global substitution specified by expression on the given input, and return the result.


substitute

public java.lang.String substitute(java.lang.String oldExpr,
                                   java.lang.String newExpr,
                                   java.lang.String input)
                            throws Perl5Util.RegexpException
Perform the global substitution specified by expression on the given input, and return the result.


preMatch

public java.lang.String preMatch()
Returns the part of the input preceding that last match found


postMatch

public java.lang.String postMatch()
Returns the part of the input following that last match found


group

public java.lang.String group(int group)
Returns the contents of one of the parenthesized subgroups of the last match found.


regexpQuote

public static java.lang.String regexpQuote(java.lang.String s)
Quote any special characters in the string to disable their special meaning. The resulting string can be used either as:
  • a matching expression which will match the literal string s
  • a substitution replacement that will insert the literal string s


showError

private static void showError(java.lang.String error)