Class Operator

  extended byjunit.extensions.jfcunit.tools.Operator

public final class Operator
extends java.lang.Object

Abstract class for defining call back classes to test whether a Component that is being searched for has been found.

kevin Wilson

Nested Class Summary
static class Operator.Operation
          Operations for comparing strings.
Field Summary
private static java.lang.String s_cachePattern
          Pattern which was cached.
private static org.apache.regexp.RE s_cacheRE
          Cached regular expression.
private static java.lang.Object s_lock
          This is the lock for synchronizing checks of the cache.
Constructor Summary
private Operator()
          Constructor should be private.
Method Summary
static boolean evaluate(java.lang.String leftside, java.lang.String rightside, int operation, boolean ignoreCase)
          Evaluate the current operation.
private static org.apache.regexp.RE getPattern(java.lang.String pattern)
          Get the regular expression implementing the pattern.
private static boolean matchPattern(java.lang.String componentAttribute, java.lang.String patternString)
          This method is used to filter components' attributes based on a pattern specified by the user.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


private static java.lang.Object s_lock
This is the lock for synchronizing checks of the cache.


private static java.lang.String s_cachePattern
Pattern which was cached.


private static org.apache.regexp.RE s_cacheRE
Cached regular expression.

Constructor Detail


private Operator()
Constructor should be private.

Method Detail


public static boolean evaluate(java.lang.String leftside,
                               java.lang.String rightside,
                               int operation,
                               boolean ignoreCase)
Evaluate the current operation.

leftside - String to be compared.
rightside - String or Regular expression.
operation - See the Operation subclass for values.
ignoreCase - Ignore the case of the values.
result of operation


private static org.apache.regexp.RE getPattern(java.lang.String pattern)
Get the regular expression implementing the pattern.

pattern - String representation of RE.
RE Class representation of RE.


private static boolean matchPattern(java.lang.String componentAttribute,
                                    java.lang.String patternString)
This method is used to filter components' attributes based on a pattern specified by the user. For example, to search for all windows with title matching 'testWindow*'. Note: If the patternString is null, we need to avoid the PatternCompiler.compile() throwing a NullPointerException and in this case, return true if the componentAttribute is also null. The pattern syntax can be found at the Jakarta RegExp API Documentation in RE.

componentAttribute - The attribute text of the component to match against
patternString - The pattern to match with
boolean whether the pattern is contained within the components' attribute text

Licensed under: GNU Lesser General Public License, Ver 2.1, February 1999