LargoRecipes

Class IngredientAmountParser.MeasureAdjectiveParser

Object
  |
  +--IngredientAmountParser.ElementParser
        |
        +--IngredientAmountParser.MeasureAdjectiveParser
Enclosing class:
IngredientAmountParser

private class IngredientAmountParser.MeasureAdjectiveParser
extends IngredientAmountParser.ElementParser

Class that parses the measure adjective element.

Since:
LargoRecipes 0.8
Author:
Douglas Squirrel

Field Summary
protected  String value
          The current value of the element being parsed.
 
Constructor Summary
private IngredientAmountParser.MeasureAdjectiveParser()
          Construct a new MeasureAdjectiveParser.
 
Method Summary
 String getValue()
          Get the value stored in this parser.
 void parse(Stack tokenStack)
          Pop the next token off the given Stack and parse it.
protected  String stripToken(String token)
          Utility method that strips a trailing asterisk, comma, semicolon, or full stop from a token, if it is present.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected String value
The current value of the element being parsed.

Since:
LargoRecipes 0.8
Constructor Detail

IngredientAmountParser.MeasureAdjectiveParser

private IngredientAmountParser.MeasureAdjectiveParser()
Construct a new MeasureAdjectiveParser.

Since:
LargoRecipes 0.8
Method Detail

parse

public void parse(Stack tokenStack)
           throws UnrecoverableException
Description copied from class: IngredientAmountParser.ElementParser
Pop the next token off the given Stack and parse it. If that token is not part of this parser's element, change the parser to the appropriate parser for that token and call parse on the new parser. May manipulate the stack, for instance to "push back" tokens.

Specified by:
parse in class IngredientAmountParser.ElementParser
Parameters:
tokenStack - The Stack of tokens to process.
Throws:
UnrecoverableException - if an error condition prevents completion of this task, and no recovery is possible. Client code should abort processing and report the error.

getValue

public String getValue()
Get the value stored in this parser.

Returns:
The value of the element this parser parses.
Since:
LargoRecipes 0.8

stripToken

protected String stripToken(String token)
Utility method that strips a trailing asterisk, comma, semicolon, or full stop from a token, if it is present. An asterisk followed by a comma, semicolon, or full stop at the end of the token is also removed. For example, both "butter," and "butter*:" become "butter".

Parameters:
token - The token to strip.
Returns:
The token minus the trailing comma or full stop, if one exists, or just the token itself if there is no trailing punctuation.
Since:
LargoRecipes 0.8

LargoRecipes

Copyright 2001-2 Douglas Squirrel