Class PhonexFSA

All Implemented Interfaces:
Cloneable

public class PhonexFSA extends SimpleFSA<IPAElement> implements Cloneable
Implementation of a phonex state machine. Includes methods for modifying the machine design.
  • Method Details

    • appendState

      public String appendState()
      Add a new state and return the name of the state.
      Returns:
      the name of the new state
    • stripFinalStates

      public String[] stripFinalStates()
      Makes all current final states non-final and returns them as a list.
      Returns:
      the previous final states
    • appendTransition

      public void appendTransition(PhonexTransition trans)
      Append the given transition to the machine.
    • appendTransition

      public void appendTransition(PhonexTransition trans, Quantifier quantifier)
    • appendMatcher

      public void appendMatcher(PhoneMatcher matcher)
      Convienence method for appending matchers. Same as appendMatcher(matcher, null)
      Parameters:
      matcher -
    • appendMatcher

      public void appendMatcher(PhoneMatcher matcher, PhoneMatcher... secondaryMatchers)

      Helper method for adding a new simple transition and making appropriate state changes.

      This method does the following:

      • removes all current final states
      • creates a new state
      • create a transition from all old final states to the new one
      • makes the new state final

      Parameters:
      matcher - to add
      secondaryMatchers - type matcher - can be null
    • appendBackReference

      public void appendBackReference(int groupIndex)
      Append a new back reference
      Parameters:
      groupIndex -
    • appendBackReference

      public void appendBackReference(int groupIndex, PhoneMatcher... secondaryMatchers)
      Append a new back reference to the machine. This method works in the same manner as appendMatcher(PhoneMatcher)
      Parameters:
      groupIndex -
      secondaryMatchers -
    • appendMatcher

      public void appendMatcher(PhoneMatcher matcher, Quantifier quantifier, PhoneMatcher... secondaryMatchers)
      Append the given matcher with the given quantifier.
    • appendBackReference

      public void appendBackReference(int groupIndex, Quantifier quantifier, PhoneMatcher... secondaryMatchers)
      Append a back reference with quantifier
    • makeBounded

      public void makeBounded(int xbound, int ybound, PhoneMatcher matcher, PhoneMatcher... secondaryMatchers)
      Apply a bounded quantifier to the given matcher
      Parameters:
      xbound -
      ybound -
      matcher -
      secondaryMatchers -
    • makeBounded

      public void makeBounded(int xbound, int ybound, PhonexTransition transition)
    • makeBounded

      public void makeBounded(int xbound, int ybound, int groupIndex, PhoneMatcher... secondaryMatchers)
    • appendOredGroups

      public void appendOredGroups(int parentGroupIndex, List<PhonexFSA> orFsas)
    • appendGroup

      public void appendGroup(PhonexFSA fsa)
      Append a machine to this machine
      Parameters:
      fsa -
    • applyQuantifier

      public void applyQuantifier(Quantifier quantifier)
      Apply the given quantifier to the entire fsa
      Parameters:
      quantifier -
    • makeZeroOrMore

      public void makeZeroOrMore()
      Apply the 'zero or more' quantifier to the entire fsa
    • makeOneOrMore

      public void makeOneOrMore()
      Apply the 'one or more' quantifier to the entire fsa
    • makeZeroOrOne

      public void makeZeroOrOne()
      Apply the 'zero or one' quantifier to the entire fsa
    • makeBounded

      public void makeBounded(int xbound, int ybound)
      Apply a 'bounded' quantifier.
      Parameters:
      xbound - if 0, then ybound is a maximum
      ybound - if invalid input: '<' 0, then xbound is expected to be an exact number. If 0, then xbound is a miniumum.
    • setGroupIndex

      public void setGroupIndex(int groupIndex)
      Set the matcher group for this fsa. Transitions from the initial state will initialize the specified group, all other transitions modify the group.
      Parameters:
      groupIndex -
    • decrementGroups

      public void decrementGroups()
      Decrement group indices on all transitions by one.
    • incrementGroups

      public void incrementGroups()
    • clone

      public Object clone()
      Overrides:
      clone in class Object