proceedState, takeCondition, getIgnoreCondition(currentPattern), currentPattern.getQuantifier().hasProperty(Quantifier.QuantifierProperty.OPTIONAL));
proceedState, takeCondition, getIgnoreCondition(currentPattern), currentPattern.getQuantifier().hasProperty(Quantifier.QuantifierProperty.OPTIONAL));
proceedState, takeCondition, getIgnoreCondition(currentPattern), currentPattern.getQuantifier().hasProperty(Quantifier.QuantifierProperty.OPTIONAL));
final IterativeCondition<T> ignoreCondition = getIgnoreCondition(currentPattern);
/** * Creates a pair of states that enables relaxed strictness before a zeroOrMore looping state. * * @param loopingState the first state of zeroOrMore complex state * @param lastSink the state that the looping one points to * @return the newly created state */ @SuppressWarnings("unchecked") private State<T> createInitOptionalStateOfZeroOrMore(final State<T> loopingState, final State<T> lastSink) { final IterativeCondition<T> currentCondition = (IterativeCondition<T>) currentPattern.getCondition(); final State<T> firstState = createState(currentPattern.getName(), State.StateType.Normal); firstState.addProceed(lastSink, BooleanConditions.<T>trueFunction()); firstState.addTake(loopingState, currentCondition); final IterativeCondition<T> ignoreFunction = getIgnoreCondition(currentPattern); if (ignoreFunction != null) { final State<T> firstStateWithoutProceed = createState(currentPattern.getName(), State.StateType.Normal); firstState.addIgnore(firstStateWithoutProceed, ignoreFunction); firstStateWithoutProceed.addIgnore(ignoreFunction); firstStateWithoutProceed.addTake(loopingState, currentCondition); addStopStates(firstStateWithoutProceed); } return firstState; }
/** * Creates a simple single state. For an OPTIONAL state it also consists * of a similar state without the PROCEED edge, so that for each PROCEED transition branches * in computation state graph can be created only once. * * @param sinkState state that the state being converted should point to * @return the created state */ @SuppressWarnings("unchecked") private State<T> createSingletonState(final State<T> sinkState) { return createSingletonState( sinkState, sinkState, getTakeCondition(currentPattern), getIgnoreCondition(currentPattern), isPatternOptional(currentPattern)); }
/** * Creates a simple single state. For an OPTIONAL state it also consists * of a similar state without the PROCEED edge, so that for each PROCEED transition branches * in computation state graph can be created only once. * * @param sinkState state that the state being converted should point to * @return the created state */ @SuppressWarnings("unchecked") private State<T> createSingletonState(final State<T> sinkState) { return createSingletonState( sinkState, sinkState, getTakeCondition(currentPattern), getIgnoreCondition(currentPattern), isPatternOptional(currentPattern)); }
/** * Patterns with quantifiers AT_LEAST_ONE_* are created as a pair of states: a singleton state and * looping state. This method creates the first of the two. * * @param sinkState the state the newly created state should point to, it should be a looping state * @return the newly created state */ @SuppressWarnings("unchecked") private State<T> createInitMandatoryStateOfOneOrMore(final State<T> sinkState) { final IterativeCondition<T> currentCondition = (IterativeCondition<T>) currentPattern.getCondition(); final State<T> firstState = createState(currentPattern.getName(), State.StateType.Normal); firstState.addTake(sinkState, currentCondition); final IterativeCondition<T> ignoreCondition = getIgnoreCondition(currentPattern); if (ignoreCondition != null) { firstState.addIgnore(ignoreCondition); } return firstState; }
/** * Creates a simple single state. For an OPTIONAL state it also consists * of a similar state without the PROCEED edge, so that for each PROCEED transition branches * in computation state graph can be created only once. * * @param sinkState state that the state being converted should point to * @return the created state */ @SuppressWarnings("unchecked") private State<T> createSingletonState(final State<T> sinkState) { return createSingletonState( sinkState, getIgnoreCondition(currentPattern), currentPattern.getQuantifier().hasProperty(Quantifier.QuantifierProperty.OPTIONAL)); }
/** * Creates a simple single state. For an OPTIONAL state it also consists * of a similar state without the PROCEED edge, so that for each PROCEED transition branches * in computation state graph can be created only once. * * @param sinkState state that the state being converted should point to * @return the created state */ @SuppressWarnings("unchecked") private State<T> createSingletonState(final State<T> sinkState) { return createSingletonState( sinkState, sinkState, getTakeCondition(currentPattern), getIgnoreCondition(currentPattern), isPatternOptional(currentPattern)); }