Class SimpleNFA

  • All Implemented Interfaces:
    IPatternFA

    public class SimpleNFA
    extends java.lang.Object
    implements IPatternFA
    Given path pattern root.sg.*.s, the SimpleNFA is:

    initial -(root)-> state[0] -(sg)-> state[1] -(*)-> state[2] -(s)-> state[3]
    state[3] is final state

    Given path pattern root.**.s, the SimpleNFA is:

    initial -(root)-> state[0] -(*)-> state[1] -(s)-> state[2]
    with extra: state[1] -(*)-> state[1] and state[2] -(*)-> state[1]
    state[3] is final state

    Given path pattern root.sg.d with prefix match, the SimpleNFA is:

    initial -(root)-> state[0] -(sg)-> state[1] -(d)-> state[2] -(*)-> state[3]
    with extra: state[3] -(*)-> state[3]
    both state[2] and state[3] are final states

    • Constructor Detail

      • SimpleNFA

        public SimpleNFA​(PartialPath pathPattern,
                         boolean isPrefixMatch)
    • Method Detail

      • getPreciseMatchTransition

        public java.util.Map<java.lang.String,​IFATransition> getPreciseMatchTransition​(IFAState state)
        Specified by:
        getPreciseMatchTransition in interface IPatternFA
        Parameters:
        state - the source state of the returned transitions
        Returns:
        transitions, that the given state has and only match one specified event rather than batch events
      • getPreciseMatchTransitionIterator

        public java.util.Iterator<IFATransition> getPreciseMatchTransitionIterator​(IFAState state)
        Specified by:
        getPreciseMatchTransitionIterator in interface IPatternFA
        Parameters:
        state - the source state of the returned transitions
        Returns:
        transitions, that the given state has and only match one specified event rather than batch events
      • getFuzzyMatchTransitionIterator

        public java.util.Iterator<IFATransition> getFuzzyMatchTransitionIterator​(IFAState state)
        Specified by:
        getFuzzyMatchTransitionIterator in interface IPatternFA
        Parameters:
        state - state the source state of the returned transitions
        Returns:
        transitions, that the given state has and can match batch events
      • getFuzzyMatchTransitionSize

        public int getFuzzyMatchTransitionSize​(IFAState state)
        Specified by:
        getFuzzyMatchTransitionSize in interface IPatternFA
        Parameters:
        state - state the source state of the returned transitions
        Returns:
        num of transitions, that the given state has and can match batch events
      • getNextState

        public IFAState getNextState​(IFAState sourceState,
                                     IFATransition transition)
        Specified by:
        getNextState in interface IPatternFA
        Parameters:
        sourceState - source state
        transition - transition that the source state has
        Returns:
        next state
      • getStateSize

        public int getStateSize()
        Specified by:
        getStateSize in interface IPatternFA
        Returns:
        the size of states this FA has
      • getState

        public IFAState getState​(int index)
        Specified by:
        getState in interface IPatternFA
        Parameters:
        index - the index of the target state, used for uniquely identifying states in FA
        Returns:
        the state identified by given index
      • mayTransitionOverlap

        public boolean mayTransitionOverlap()
        Description copied from interface: IPatternFA
        Determines if there is overlap between the state transfer events of this FA. If it returns true, then there may be overlap. If it returns false, there must be no overlap.
        Specified by:
        mayTransitionOverlap in interface IPatternFA
        Returns:
        may transition overlap