public class SPTBuilder extends Object
Modifier and Type | Field and Description |
---|---|
protected List<String> |
annotationTypes
Stores the types of annotations actually used in the grammar.
|
static String |
GENERATED_CLASS_PACKAGE |
protected List<SPTBase.State> |
newStates
Stores the states for the optimised transducer.
|
protected cern.colt.map.OpenIntIntHashMap |
oldToNewStates
Holds the mapping between input states (old states, represented through their
ID) and new state (represented as their index in the
newStates array). |
protected Map<String,List<Predicate>> |
predicatesByType
Stores the list of predicates for each annotation type.
|
protected gate.jape.Rule[] |
rules
Stores the rules in the the transducer.
|
Constructor and Description |
---|
SPTBuilder() |
Modifier and Type | Method and Description |
---|---|
Transducer.SPTData |
buildSPT(gate.jape.SinglePhaseTransducer oldSpt,
gate.util.GateClassLoader classLoader) |
protected int |
convertPredicate(String annotationType,
gate.jape.constraint.ConstraintPredicate oldPredicate) |
protected void |
createNewStates(FSMPDA fsm)
Generates new states for all the old states in the provided FSM.
|
protected void |
createNewTransitions(FSMPDA fsm)
Parses the provided FSMPDA and converts the old transitions to new ones.
|
protected void |
optimisePredicates() |
protected void |
writeAdvanceInstanceMethod(int tabs,
StringBuilder out) |
protected void |
writeClassFooter(StringBuilder out) |
protected void |
writeClassHeader(String className,
StringBuilder out) |
protected void |
writeConstrainedTransitionBlock(int stateId,
int transId,
int tabs,
StringBuilder out) |
protected void |
writeConstructor(String className,
gate.jape.SinglePhaseTransducer spt,
int tabs,
StringBuilder out) |
protected void |
writeStateMethod(int stateId,
int tabs,
StringBuilder out) |
public static final String GENERATED_CLASS_PACKAGE
protected List<SPTBase.State> newStates
protected gate.jape.Rule[] rules
protected List<String> annotationTypes
protected Map<String,List<Predicate>> predicatesByType
protected cern.colt.map.OpenIntIntHashMap oldToNewStates
newStates
array).public Transducer.SPTData buildSPT(gate.jape.SinglePhaseTransducer oldSpt, gate.util.GateClassLoader classLoader) throws gate.creole.ResourceInstantiationException
gate.creole.ResourceInstantiationException
protected void writeClassHeader(String className, StringBuilder out)
protected void writeConstructor(String className, gate.jape.SinglePhaseTransducer spt, int tabs, StringBuilder out)
protected void writeAdvanceInstanceMethod(int tabs, StringBuilder out)
protected void writeStateMethod(int stateId, int tabs, StringBuilder out)
protected void writeConstrainedTransitionBlock(int stateId, int transId, int tabs, StringBuilder out)
protected void writeClassFooter(StringBuilder out)
protected void createNewStates(FSMPDA fsm)
newStates
list, and populates the mapping
between old state IDs and new state IDs in oldToNewStates
.the
- FSMPDA
from which the old states are obtained.protected void createNewTransitions(FSMPDA fsm) throws gate.creole.ResourceInstantiationException
newStates
list and the oldToNewStates
mapping should
already be populated before this method is called.fsm
- gate.creole.ResourceInstantiationException
protected int convertPredicate(String annotationType, gate.jape.constraint.ConstraintPredicate oldPredicate) throws gate.creole.ResourceInstantiationException
gate.creole.ResourceInstantiationException
protected void optimisePredicates()