java.lang.Object
org.media.mn8.util.SimpleExpression
- public class SimpleExpression
- extends java.lang.Object
The SimpleExpression class implements a simple expression parser.
The only operators of a simple expression are:
- * - match everything, like the "." in regular
expressions
- # - selects everything
It performs only two functions:
- select -selects all the apparence of the strings marked
with the select ("#") operator
- match - verifies if a string matches the pattern specified
using normal characters and the two operators.
It is intended as a simple replacement for regular expression in the case
of simple expressions.
- Version:
- $Revision: 1.28 $ $Date: 2002/03/22 18:38:24 $
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
_MATCH_ALL
private static final java.lang.String _MATCH_ALL
- See Also:
- Constant Field Values
_SELECT_ALL
private static final java.lang.String _SELECT_ALL
- See Also:
- Constant Field Values
SimpleExpression
public SimpleExpression()
select
public static java.util.Collection select(java.lang.String target,
java.lang.String pattern)
- Selects a collection of strings from the target using as mask the pattern
and the two operators "#" and "*".
match
public static boolean match(java.lang.String target,
java.lang.String pattern)
- Specifies if a pattern matches the target string or not.
isOpenEnded
private static boolean isOpenEnded(java.lang.String[] tokens,
int index)
isStartsWithMatch
private static boolean isStartsWithMatch(java.lang.String target,
java.lang.String[] tokens)
isStartsOpened
private static boolean isStartsOpened(java.lang.String[] tokens,
int index)
convert
private static java.lang.String convert(java.lang.String target)
contains
public static boolean contains(java.lang.String target,
java.lang.String pattern)
lookAhead
protected static int lookAhead(java.lang.String token,
java.lang.String target,
int targetIndex)
- Tries to find the token in the target string starting with the
targetIndex position.
makeTokens
protected static java.lang.String[] makeTokens(java.lang.String pattern)
operatorOccurences
protected static int operatorOccurences(java.lang.String target,
java.lang.String operator)
isOperator
protected static boolean isOperator(java.lang.String target)
isValidPattern
private static boolean isValidPattern(java.lang.String pattern)