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

Quick Search    Search Deep

jpicedt.graphic.io.parser
Class WordExpression  view WordExpression download WordExpression.java

java.lang.Object
  extended byjpicedt.graphic.io.parser.AbstractRegularExpression
      extended byjpicedt.graphic.io.parser.WordExpression
All Implemented Interfaces:
ExpressionConstants

public class WordExpression
extends AbstractRegularExpression

A string, - either composed of letters only, or letters and digits (see java.lang.Character.isLetter() for details) only, - or ended by the specified end-delimiter (in which case it may contain other chars than letters)


Field Summary
private  boolean allowDigit
           
private  boolean noLineFeed
           
private  java.lang.String postfix
           
private  java.lang.String prefix
           
private  boolean swallowPostFix
           
private  java.lang.String value
           
 
Fields inherited from interface jpicedt.graphic.io.parser.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
WordExpression()
          Parse an expression containing letters only, and stops when a non-letter char is found.
WordExpression(java.lang.String postfix, boolean swallowPostFix)
          Constructor with allowsDigit=false (i.e.
WordExpression(java.lang.String postfix, boolean swallowPostFix, boolean allowDigit)
          Allow line-feed's, i.e.
WordExpression(java.lang.String postfix, boolean swallowPostFix, boolean allowDigit, boolean noLineFeed)
           
 
Method Summary
 java.lang.String getValue()
          Return the (last) parsed content of this expression
 boolean interpret(Context context)
          Parses this expression, possibly using Context to fetch the String to interpret if this Expression is a leaf expression.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class jpicedt.graphic.io.parser.AbstractRegularExpression
action
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

prefix

private java.lang.String prefix

postfix

private java.lang.String postfix

swallowPostFix

private boolean swallowPostFix

allowDigit

private boolean allowDigit

noLineFeed

private boolean noLineFeed

value

private java.lang.String value
Constructor Detail

WordExpression

public WordExpression(java.lang.String postfix,
                      boolean swallowPostFix,
                      boolean allowDigit,
                      boolean noLineFeed)

WordExpression

public WordExpression(java.lang.String postfix,
                      boolean swallowPostFix,
                      boolean allowDigit)
Allow line-feed's, i.e. expression may span more than one line.


WordExpression

public WordExpression(java.lang.String postfix,
                      boolean swallowPostFix)
Constructor with allowsDigit=false (i.e. only alphabetic character are swallowed if postfix = null), and which allows linefeeds.


WordExpression

public WordExpression()
Parse an expression containing letters only, and stops when a non-letter char is found. Allows line-feed's, which can be removed later on using Context.removeLineFeeds (static method).

Method Detail

interpret

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

Specified by:
interpret in class AbstractRegularExpression

getValue

public java.lang.String getValue()
Return the (last) parsed content of this expression


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).