Package ca.phon.phonex
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 TypeMethodDescriptionvoid
appendBackReference
(int groupIndex) Append a new back referencevoid
appendBackReference
(int groupIndex, PhoneMatcher... secondaryMatchers) Append a new back reference to the machine.void
appendBackReference
(int groupIndex, Quantifier quantifier, PhoneMatcher... secondaryMatchers) Append a back reference with quantifiervoid
appendGroup
(PhonexFSA fsa) Append a machine to this machinevoid
appendMatcher
(PhoneMatcher matcher) Convienence method for appending matchers.void
appendMatcher
(PhoneMatcher matcher, PhoneMatcher... secondaryMatchers) Helper method for adding a new simple transition and making appropriate state changes.void
appendMatcher
(PhoneMatcher matcher, Quantifier quantifier, PhoneMatcher... secondaryMatchers) Append the given matcher with the given quantifier.void
appendOredGroups
(int parentGroupIndex, List<PhonexFSA> orFsas) Add a new state and return the name of the state.void
appendTransition
(PhonexTransition trans) Append the given transition to the machine.void
appendTransition
(PhonexTransition trans, Quantifier quantifier) void
applyQuantifier
(Quantifier quantifier) Apply the given quantifier to the entire fsaclone()
void
Decrement group indices on all transitions by one.void
void
makeBounded
(int xbound, int ybound) Apply a 'bounded' quantifier.void
makeBounded
(int xbound, int ybound, int groupIndex, PhoneMatcher... secondaryMatchers) void
makeBounded
(int xbound, int ybound, PhoneMatcher matcher, PhoneMatcher... secondaryMatchers) Apply a bounded quantifier to the given matchervoid
makeBounded
(int xbound, int ybound, PhonexTransition transition) void
Apply the 'one or more' quantifier to the entire fsavoid
Apply the 'zero or more' quantifier to the entire fsavoid
Apply the 'zero or one' quantifier to the entire fsavoid
setGroupIndex
(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
Append a machine to this machine- Parameters:
fsa
-
-
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
-