org.unitils.dbmaintainer.script.parsingstate.impl
Class BaseParsingState

java.lang.Object
  extended by org.unitils.dbmaintainer.script.parsingstate.impl.BaseParsingState
All Implemented Interfaces:
ParsingState
Direct Known Subclasses:
InBlockCommentParsingState, InDoubleQuotesParsingState, InLineCommentParsingState, InSingleQuotesParsingState, NormalParsingState

public abstract class BaseParsingState
extends Object
implements ParsingState

Base class for a parsing state. This will handle a character by simply adding it to the statement builder.

Author:
Tim Ducheyne, Filip Neven

Constructor Summary
BaseParsingState()
           
 
Method Summary
protected abstract  ParsingState getNextParsingState(char previousChar, char currentChar, char nextChar, StatementBuilder statementBuilder)
          Determines the next state.
 ParsingState handleNextChar(char previousChar, char currentChar, char nextChar, StatementBuilder statementBuilder)
          Handles the next character by adding it to the statement builder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseParsingState

public BaseParsingState()
Method Detail

handleNextChar

public ParsingState handleNextChar(char previousChar,
                                   char currentChar,
                                   char nextChar,
                                   StatementBuilder statementBuilder)
Handles the next character by adding it to the statement builder.

Specified by:
handleNextChar in interface ParsingState
Parameters:
previousChar - The previous char, 0 if none
currentChar - The current char
nextChar - The next char, 0 if none
statementBuilder - The statement builder, not null
Returns:
The next parsing state, null if the end of the statement is reached

getNextParsingState

protected abstract ParsingState getNextParsingState(char previousChar,
                                                    char currentChar,
                                                    char nextChar,
                                                    StatementBuilder statementBuilder)
Determines the next state.

Parameters:
previousChar - The previous char, 0 if none
currentChar - The current char
nextChar - The next char, 0 if none
statementBuilder - The statement builder, not null
Returns:
The next parsing state, null if the end of the statement is reached


Copyright © 2011. All Rights Reserved.