Class PhonexFSA
- All Implemented Interfaces:
Cloneable
Implementation of a phonex state machine.
Includes methods for modifying the machine
design.
-
Nested Class Summary
Nested classes/interfaces inherited from class ca.phon.fsa.SimpleFSA
SimpleFSA.DecisionTracker<T> -
Method Summary
Modifier and TypeMethodDescriptionvoidappendBackReference(int groupIndex) Append a new back referencevoidappendBackReference(int groupIndex, PhoneMatcher... secondaryMatchers) Append a new back reference to the machine.voidappendBackReference(int groupIndex, Quantifier quantifier, PhoneMatcher... secondaryMatchers) Append a back reference with quantifiervoidappendGroup(PhonexFSA fsa) Append a machine to this machinevoidappendMatcher(PhoneMatcher matcher) Convienence method for appending matchers.voidappendMatcher(PhoneMatcher matcher, PhoneMatcher... secondaryMatchers) Helper method for adding a new simple transition and making appropriate state changes.voidappendMatcher(PhoneMatcher matcher, Quantifier quantifier, PhoneMatcher... secondaryMatchers) Append the given matcher with the given quantifier.voidappendOredGroups(int parentGroupIndex, List<PhonexFSA> orFsas) Add a new state and return the name of the state.voidappendTransition(PhonexTransition trans) Append the given transition to the machine.voidappendTransition(PhonexTransition trans, Quantifier quantifier) voidapplyQuantifier(Quantifier quantifier) Apply the given quantifier to the entire fsaclone()voidDecrement group indices on all transitions by one.voidvoidmakeBounded(int xbound, int ybound) Apply a 'bounded' quantifier.voidmakeBounded(int xbound, int ybound, int groupIndex, PhoneMatcher... secondaryMatchers) voidmakeBounded(int xbound, int ybound, PhoneMatcher matcher, PhoneMatcher... secondaryMatchers) Apply a bounded quantifier to the given matchervoidmakeBounded(int xbound, int ybound, PhonexTransition transition) voidApply the 'one or more' quantifier to the entire fsavoidApply the 'zero or more' quantifier to the entire fsavoidApply the 'zero or one' quantifier to the entire fsavoidsetGroupIndex(int groupIndex) Set the matcher group for this fsa.String[]Makes all current final states non-final and returns them as a list.Methods inherited from class ca.phon.fsa.SimpleFSA
addFinalState, addState, addTransition, backtrack, delta, getDotText, getFinalStates, getGroupIndex, getGroupName, getGroupNames, getInitialState, getNumberOfGroups, getStates, getTransitions, getTransitionsForState, getTransitionsToState, isFinalState, printDef, removeFinalState, removeState, removeTransition, runWithTape, runWithTape, runWithTape, setGroupName, setInitialState, setNumberOfGroups, stripGroups
-
Method Details
-
appendState
Add a new state and return the name of the state.- Returns:
- the name of the new state
-
stripFinalStates
Makes all current final states non-final and returns them as a list.- Returns:
- the previous final states
-
appendTransition
Append the given transition to the machine. -
appendTransition
-
appendMatcher
Convienence method for appending matchers. Same asappendMatcher(matcher, null)- Parameters:
matcher-
-
appendMatcher
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 addsecondaryMatchers- type matcher - can benull
-
appendBackReference
public void appendBackReference(int groupIndex) Append a new back reference- Parameters:
groupIndex-
-
appendBackReference
Append a new back reference to the machine. This method works in the same manner asappendMatcher(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
-
makeBounded
-
appendOredGroups
-
appendGroup
-
applyQuantifier
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 maximumybound- 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
-