http://www.jpicedt.org

jpicedt.format.input.util
Class SequenceExpression

java.lang.Object
  extended by jpicedt.format.input.util.AbstractRegularExpression
      extended by jpicedt.format.input.util.SequenceExpression
Direct Known Subclasses:
BeginPictureExpression, BeginPsPictureExpression, CommentExpression, DefaultParser, EepicDrawlineCommand, EepicPathCommand, LaTeXBox, LaTeXCircle, LaTeXLine, LaTeXOval, LaTeXPutExpression, LineThicknessExpression, PicEllipseExpression, PicLineExpression, PicPolygonExpression, PicRectangleExpression, PsArcExpression, PsBezierExpression, PsBox, PsCircleExpression, PsEllipseExpression, PsFrameExpression, PsPolygonExpression, PsQDiskExpression, PsQLineExpression, PsRPutExpression, PSTArrowExpression, PSTBooleanExpression, PSTColorExpression, PSTDashExpression, PSTDotStyleExpression, PSTFillStyleExpression, PSTLengthParameter, PSTLineStyleExpression, PsUnitLengthExpression, UnitLengthExpression

public class SequenceExpression
extends AbstractRegularExpression

An expression that represents a sequence of expressions to be matched exactly in the same order they're being added to the sequence.

Since:
jpicedt 1.3
Version:
$Id: SequenceExpression.java,v 1.8 2013/03/31 06:58:34 vincentb1 Exp $
Author:
Sylvain Reynal

Constructor Summary
SequenceExpression()
          constructs a sequence that contains no sub-expression and doesn't throw IncompleteSequenceException
SequenceExpression(AbstractRegularExpression expr)
          constructs a sequence with the given expression as the first sub-expression and which doesn't throw IncompleteSequenceException.
SequenceExpression(AbstractRegularExpression expr1, AbstractRegularExpression expr2)
          constructs a sequence with the given expression as the first and second sub-expression and which doesn't throw Exception
SequenceExpression(AbstractRegularExpression expr1, AbstractRegularExpression expr2, AbstractRegularExpression expr3, boolean throwIncompleteSequenceException)
          constructs a sequence with three sub-expressions
SequenceExpression(AbstractRegularExpression expr1, AbstractRegularExpression expr2, boolean throwIncompleteSequenceException)
          constructs a sequence with the given expression as the first and second sub-expression
SequenceExpression(AbstractRegularExpression expr, boolean throwIncompleteSequenceException)
          constructs a sequence with the given expression as the first sub-expression.
SequenceExpression(boolean throwIncompleteSequenceException)
          constructs a sequence that contains no sub-expression.
 
Method Summary
 void add(AbstractRegularExpression expr)
          add the given expression to the sequence
 boolean interpret(Context c)
          Parses this expression, possibly using the given Context to fetch the String to interpret if this Expression is a leaf expression.
 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

SequenceExpression

public SequenceExpression()
constructs a sequence that contains no sub-expression and doesn't throw IncompleteSequenceException


SequenceExpression

public SequenceExpression(boolean throwIncompleteSequenceException)
constructs a sequence that contains no sub-expression.

Parameters:
throwIncompleteSequenceException - if TRUE, and if the first sub-expression has been found but any ensuing expression hasn't been found, throw a REParserException.IncompleteSequenceException.

SequenceExpression

public SequenceExpression(AbstractRegularExpression expr)
constructs a sequence with the given expression as the first sub-expression and which doesn't throw IncompleteSequenceException.


SequenceExpression

public SequenceExpression(AbstractRegularExpression expr,
                          boolean throwIncompleteSequenceException)
constructs a sequence with the given expression as the first sub-expression.

Parameters:
throwIncompleteSequenceException - if TRUE, and if the first sub-expression has been found but any ensuing sub-expression hasn't been found, throw a REParserException.IncompleteSequenceException.

SequenceExpression

public SequenceExpression(AbstractRegularExpression expr1,
                          AbstractRegularExpression expr2)
constructs a sequence with the given expression as the first and second sub-expression and which doesn't throw Exception


SequenceExpression

public SequenceExpression(AbstractRegularExpression expr1,
                          AbstractRegularExpression expr2,
                          boolean throwIncompleteSequenceException)
constructs a sequence with the given expression as the first and second sub-expression

Parameters:
throwIncompleteSequenceException - if TRUE, and if the first sub-expression has been found but any ensuing sub-expression hasn't been found, throw a REParserException.IncompleteSequenceException.

SequenceExpression

public SequenceExpression(AbstractRegularExpression expr1,
                          AbstractRegularExpression expr2,
                          AbstractRegularExpression expr3,
                          boolean throwIncompleteSequenceException)
constructs a sequence with three sub-expressions

Parameters:
throwIncompleteSequenceException - if TRUE, and if the first sub-expression has been found but any ensuing sub-expression hasn't been found, throw a REParserException.IncompleteSequenceException.
Method Detail

add

public void add(AbstractRegularExpression expr)
add the given expression to the sequence


interpret

public boolean interpret(Context c)
                  throws REParserException
Description copied from class: AbstractRegularExpression
Parses this expression, possibly using the given Context to fetch the String to interpret if this Expression is a leaf expression.

Specified by:
interpret in class AbstractRegularExpression
Returns:
TRUE if and only if every expression contained in this SequenceExpression were found, in the same order as they were added to the sequence. FALSE otherwise.
Throws:
REParserException.IncompleteSequence - if flag throwIncompleteSequenceException is TRUE and any expression but the first one wasn't found Whether TRUE or FALSE, calls action with key="&" and value=new Integer(index of last expression parsed with success)
REParserException - if an error occur during parsing

toString

public String toString()
Overrides:
toString in class Object

http://www.jpicedt.org

Submit a bug : syd@jpicedt.org