http://www.jpicedt.org

jpicedt.format.input.util
Class AlternateExpression

java.lang.Object
  extended by jpicedt.format.input.util.AbstractRegularExpression
      extended by jpicedt.format.input.util.AlternateExpression
Direct Known Subclasses:
EepicLineThicknessExpression, EndPsPictureExpression, PicBezierExpression, PicColorExpression, PicGroupExpression, RootExpression, UserDefinedColorExpression

public class AlternateExpression
extends AbstractRegularExpression

A regular expression that mimics the "x|y" RegExp syntax.

Since:
jpicedt 1.3
Version:
$Id: AlternateExpression.java,v 1.9 2013/07/26 06:10:36 vincentb1 Exp $
Author:
Sylvain Reynal

Constructor Summary
AlternateExpression()
          Creates a new AlternateExpression with no element
AlternateExpression(AbstractRegularExpression expr)
          Creates a new AlternateExpression with the given expr as first element
AlternateExpression(AbstractRegularExpression expr1, AbstractRegularExpression expr2)
          Creates a new AlternateExpression with the given expr as first and second element
AlternateExpression(AbstractRegularExpression expr1, AbstractRegularExpression expr2, AbstractRegularExpression expr3)
          Creates a new AlternateExpression with the given expr as first, second and third element
 
Method Summary
 void add(AbstractRegularExpression expr)
          Add a new child to this AlternateExpression.
 ArrayList getExpressionList()
          Return a list containing every expression in this AlternateExpression
 boolean interpret(Context c)
          Calls "action" with value=Integer(index of first expression parsed with success, starting from 0).
 String toString()
           
 
Methods inherited from class jpicedt.format.input.util.AbstractRegularExpression
action
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AlternateExpression

public AlternateExpression(AbstractRegularExpression expr)
Creates a new AlternateExpression with the given expr as first element


AlternateExpression

public AlternateExpression(AbstractRegularExpression expr1,
                           AbstractRegularExpression expr2)
Creates a new AlternateExpression with the given expr as first and second element


AlternateExpression

public AlternateExpression(AbstractRegularExpression expr1,
                           AbstractRegularExpression expr2,
                           AbstractRegularExpression expr3)
Creates a new AlternateExpression with the given expr as first, second and third element


AlternateExpression

public AlternateExpression()
Creates a new AlternateExpression with no element

Method Detail

add

public void add(AbstractRegularExpression expr)
Add a new child to this AlternateExpression.


interpret

public boolean interpret(Context c)
                  throws REParserException
Calls "action" with value=Integer(index of first expression parsed with success, starting from 0).

Specified by:
interpret in class AbstractRegularExpression
Returns:
true as soon as one of the expressions contained in this AlternateExpression has been found ; false if no match.

Throws:
REParserException - if an error occur during parsing

getExpressionList

public ArrayList getExpressionList()
Return a list containing every expression in this AlternateExpression


toString

public String toString()
Overrides:
toString in class Object

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org