* </ol>
*
* @return
*/
private Machine getTextualDateMachine() {
State startState = new NamedState("START");
State endState = new NamedState("END");
State ntEndState = new NonTerminalEndState("NON TERMINAL END");
endState.setEndStateFlag(true);
ntEndState.setEndStateFlag(true);
Machine m = new Machine(startState);
State monthFullTextState = new NamedState("MONTH_FULL_TEXT");
State monthShortTextState = new NamedState("MONTH_SHORT_TEXT");
State dayNumState = new NamedState("DAY_NUM");
State commaState = new NamedState("COMMA");
State periodState = new NamedState("PERIOD");
Condition monthFullTextCondition = new WordSetCondition(
iv_monthFullNameSet, false);
Condition monthShortTextCondition = new WordSetCondition(
iv_monthShortNameSet, false);
Condition dayNumCondition = new IntegerRangeCondition(MIN_DAY, MAX_DAY);
Condition periodCondition = new PunctuationValueCondition('.');
Condition yearNumCondition = new IntegerRangeCondition(MIN_YEAR,
MAX_YEAR);
Condition commaCondition = new PunctuationValueCondition(',');
// condition for not being a comma or year number
Condition notCommaNotYearNumCondition = new CombineCondition(
new NegateCondition(commaCondition), new NegateCondition(
yearNumCondition));
// condition for being a year num and not a day num
Condition yearNotDayNumCondition = new CombineCondition(
yearNumCondition, new NegateCondition(dayNumCondition));
startState.addTransition(monthFullTextCondition, monthFullTextState);
startState.addTransition(monthShortTextCondition, monthShortTextState);
startState.addTransition(new AnyCondition(), startState);
monthFullTextState.addTransition(dayNumCondition, dayNumState);
monthFullTextState.addTransition(yearNotDayNumCondition, endState);
monthFullTextState.addTransition(new AnyCondition(), startState);
monthShortTextState.addTransition(dayNumCondition, dayNumState);
monthShortTextState.addTransition(periodCondition, periodState);
monthShortTextState.addTransition(yearNotDayNumCondition, endState);
monthShortTextState.addTransition(new AnyCondition(), startState);
periodState.addTransition(dayNumCondition, dayNumState);
periodState.addTransition(yearNotDayNumCondition, endState);
periodState.addTransition(new AnyCondition(), startState);
dayNumState.addTransition(yearNumCondition, endState);
dayNumState.addTransition(commaCondition, commaState);
dayNumState.addTransition(notCommaNotYearNumCondition, ntEndState);
dayNumState.addTransition(new AnyCondition(), startState);