net.sf.jga.fn.string
Class Match

java.lang.Object
  extended by net.sf.jga.fn.UnaryFunctor<T,java.lang.Boolean>
      extended by net.sf.jga.fn.UnaryPredicate<java.lang.String>
          extended by net.sf.jga.fn.string.Match
All Implemented Interfaces:
java.io.Serializable, Visitable

public class Match
extends UnaryPredicate<java.lang.String>

Unary Functor that tests a string argument against a given regular expression.

Copyright © 2003 David A. Hall

Author:
David A. Hall
See Also:
Serialized Form

Nested Class Summary
static interface Match.Visitor
          Interface for classes that may interpret a Match predicate.
 
Constructor Summary
Match()
          Builds a Match with an empty string pattern
Match(java.util.regex.Pattern pattern)
          Builds a Match with a given Pattern
Match(java.lang.String regex)
          Builds a Match with a given regular expression
 
Method Summary
 void accept(Visitor v)
          Calls the Visitor's visit(Match) method, if it implements the nested Visitor interface.
 java.lang.Boolean fn(java.lang.String arg)
          Tests a string against the regular expression given at construction
 java.lang.String getRegex()
          Returns the format object used to present values in formatted form.
 java.lang.String toString()
           
 
Methods inherited from class net.sf.jga.fn.UnaryPredicate
p
 
Methods inherited from class net.sf.jga.fn.UnaryFunctor
bind, compose, compose, generate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Match

public Match()
Builds a Match with an empty string pattern


Match

public Match(java.lang.String regex)
Builds a Match with a given regular expression


Match

public Match(java.util.regex.Pattern pattern)
Builds a Match with a given Pattern

Method Detail

getRegex

public java.lang.String getRegex()
Returns the format object used to present values in formatted form.

Returns:
the format used to present values

fn

public java.lang.Boolean fn(java.lang.String arg)
Tests a string against the regular expression given at construction

Specified by:
fn in class UnaryFunctor<java.lang.String,java.lang.Boolean>
Parameters:
arg - the value to tested
Returns:
true if the string matches the regular expression given at construction

accept

public void accept(Visitor v)
Calls the Visitor's visit(Match) method, if it implements the nested Visitor interface.

Specified by:
accept in interface Visitable
Overrides:
accept in class UnaryFunctor<java.lang.String,java.lang.Boolean>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2005 David A. Hall. All Rights Reserved.