org.media.mn8.util
Class SimpleExpression

java.lang.Object
  |
  +--org.media.mn8.util.SimpleExpression

public class SimpleExpression
extends 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 $
Author:
Remus Pereni
See Also:
String

Constructor Summary
SimpleExpression()
           
 
Method Summary
static boolean contains(String target, String pattern)
           
protected static boolean isOperator(String target)
           
protected static int lookAhead(String token, String target, int targetIndex)
          Tries to find the token in the target string starting with the targetIndex position.
protected static String[] makeTokens(String pattern)
           
static boolean match(String target, String pattern)
          Specifies if a pattern matches the target string or not.
protected static int operatorOccurences(String target, String operator)
           
static Collection select(String target, 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
 

Constructor Detail

SimpleExpression

public SimpleExpression()
Method Detail

select

public static Collection select(String target,
                                String pattern)
Selects a collection of strings from the target using as mask the pattern and the two operators "#" and "*".

Parameters:
target - The string to be matched
pattern - The pattern
Returns:
A collection (Vector) of string arrays containing the selected strings as specified through the pattern or null of none find or specified.
See Also:
Collection, Vector

match

public static boolean match(String target,
                            String pattern)
Specifies if a pattern matches the target string or not.

Parameters:
target - The string to be matched
pattern - The pattern
Returns:
True if the pattern is present in the target, false otherway.

contains

public static boolean contains(String target,
                               String pattern)

lookAhead

protected static int lookAhead(String token,
                               String target,
                               int targetIndex)
Tries to find the token in the target string starting with the targetIndex position.

Parameters:
token - The token to be looked for.
target - The string where we look for the token.
targetIndex - the position in the target where we begin the search.
Returns:
The position of the first found token in the target or -1 in case was not found.

makeTokens

protected static String[] makeTokens(String pattern)

operatorOccurences

protected static int operatorOccurences(String target,
                                        String operator)

isOperator

protected static boolean isOperator(String target)


"Copyright © 2000-2002 Internet Multicasting Services, media.org & noLimits Technologies. All Rights Reserved."