Package jpicedt.format.input.util
Class SequenceExpression
- java.lang.Object
-
- jpicedt.format.input.util.AbstractRegularExpression
-
- jpicedt.format.input.util.SequenceExpression
-
- All Implemented Interfaces:
ExpressionConstants
- 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.4.2.1 2007/09/02 11:56:14 reynal Exp $
- Author:
- Sylvain Reynal
-
-
Field Summary
-
Fields inherited from interface jpicedt.format.input.util.ExpressionConstants
ANY_CHAR, ANY_CHAR_EOL, ANY_SIGN, AT_LEAST, AT_MOST, DEBUG, DOUBLE, EOL, EXACTLY, INTEGER, NEGATIVE, NON_NULL, POSITIVE, STRICTLY_NEGATIVE, STRICTLY_POSITIVE, WHITE_SPACES, WHITE_SPACES_OR_EOL
-
-
Constructor Summary
Constructors Constructor Description SequenceExpression()constructs a sequence that contains no sub-expression and doesn't throw IncompleteSequenceExceptionSequenceExpression(boolean throwIncompleteSequenceException)constructs a sequence that contains no sub-expression.SequenceExpression(AbstractRegularExpression expr)constructs a sequence with the given expression as the first sub-expression and which doesn't throw IncompleteSequenceException.SequenceExpression(AbstractRegularExpression expr, boolean throwIncompleteSequenceException)constructs a sequence with the given expression as the first sub-expression.SequenceExpression(AbstractRegularExpression expr1, AbstractRegularExpression expr2)constructs a sequence with the given expression as the first and second sub-expression and which doesn't throw ExceptionSequenceExpression(AbstractRegularExpression expr1, AbstractRegularExpression expr2, boolean throwIncompleteSequenceException)constructs a sequence with the given expression as the first and second sub-expressionSequenceExpression(AbstractRegularExpression expr1, AbstractRegularExpression expr2, AbstractRegularExpression expr3, boolean throwIncompleteSequenceException)constructs a sequence with three sub-expressions
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(AbstractRegularExpression expr)add the given expression to the sequencebooleaninterpret(Context c)Parses this expression, possibly using the given Context to fetch the String to interpret if this Expression is a leaf expression.java.lang.StringtoString()-
Methods inherited from class jpicedt.format.input.util.AbstractRegularExpression
action
-
-
-
-
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:AbstractRegularExpressionParses this expression, possibly using the given Context to fetch the String to interpret if this Expression is a leaf expression.- Specified by:
interpretin classAbstractRegularExpression- 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 java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-