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

Quick Search    Search Deep

org.media.mn8.util
Class SimpleExpression  view SimpleExpression download SimpleExpression.java

java.lang.Object
  extended byorg.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:

It performs only two functions: 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 $

Field Summary
private static java.lang.String _MATCH_ALL
           
private static java.lang.String _SELECT_ALL
           
 
Constructor Summary
SimpleExpression()
           
 
Method Summary
static boolean contains(java.lang.String target, java.lang.String pattern)
           
private static java.lang.String convert(java.lang.String target)
           
private static boolean isOpenEnded(java.lang.String[] tokens, int index)
           
protected static boolean isOperator(java.lang.String target)
           
private static boolean isStartsOpened(java.lang.String[] tokens, int index)
           
private static boolean isStartsWithMatch(java.lang.String target, java.lang.String[] tokens)
           
private static boolean isValidPattern(java.lang.String pattern)
           
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.
protected static java.lang.String[] makeTokens(java.lang.String pattern)
           
static boolean match(java.lang.String target, java.lang.String pattern)
          Specifies if a pattern matches the target string or not.
protected static int operatorOccurences(java.lang.String target, java.lang.String operator)
           
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 "*".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_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
Constructor Detail

SimpleExpression

public SimpleExpression()
Method Detail

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)