本文整理汇总了Java中dk.brics.automaton.Transition.getDest方法的典型用法代码示例。如果您正苦于以下问题:Java Transition.getDest方法的具体用法?Java Transition.getDest怎么用?Java Transition.getDest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dk.brics.automaton.Transition
的用法示例。
在下文中一共展示了Transition.getDest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitTransitions
import dk.brics.automaton.Transition; //导入方法依赖的package包/类
public void visitTransitions(NavigableMap<State, ActivationStatusAwareState> statesTranslationMap, NavigableSet<State> visitedStates, State currentState) {
if (visitedStates.contains(currentState))
return;
ActivationStatusAwareState
currentStAwaState = statesTranslationMap.get(currentState),
destStAwaState = null;
State destinationState = null;
this.decideActivationStatus(currentState, currentStAwaState);
for (Transition trans : currentState.getTransitions()) {
destinationState = trans.getDest();
if (!statesTranslationMap.containsKey(destinationState)) {
destStAwaState = makeNewState();
statesTranslationMap.put(destinationState, destStAwaState);
} else {
destStAwaState = statesTranslationMap.get(destinationState);
}
for (char evt = trans.getMin(); evt <= trans.getMax(); evt++) {
currentStAwaState.addTransition(new RelevanceAwareTransition(evt, destStAwaState,
translationMap.get(evt).toString()));
this.alphabet.add(evt);
}
visitedStates.add(currentState);
// Recursive call: after this call, the reachable states have all been visited and assigned an activation status
visitTransitions(statesTranslationMap, visitedStates, destinationState);
}
this.decideRelevanceOfTransitions(currentStAwaState);
return;
}
示例2: unfoldTransitions
import dk.brics.automaton.Transition; //导入方法依赖的package包/类
public void unfoldTransitions(
NavigableMap<State, WeightedState> statesTranslationMap, NavigableSet<State> visitedStates, State currentState) {
if (visitedStates.contains(currentState))
return;
WeightedState currentWState = statesTranslationMap.get(currentState), destinationWState = null;
State destinationState = null;
if (currentState.isAccept())
currentWState.setAccept(true);
for (Transition trans : currentState.getTransitions()) {
destinationState = trans.getDest();
if (!statesTranslationMap.containsKey(destinationState)) {
destinationWState = new WeightedState();
statesTranslationMap.put(destinationState, destinationWState);
} else {
destinationWState = statesTranslationMap.get(destinationState);
}
for (char evt = trans.getMin(); evt <= trans.getMax(); evt++) {
currentWState.addTransition(new WeightedTransition(evt,
destinationWState, translationMap.get(evt).toString()));
}
visitedStates.add(currentState);
unfoldTransitions(statesTranslationMap, visitedStates,
destinationState);
}
}
示例3: closeScope
import dk.brics.automaton.Transition; //导入方法依赖的package包/类
private Automaton closeScope(Automaton automaton) {
// Make sure automaton is deterministic
automaton.determinize();
// Skip the starting character, as it is not part of the actual sequence
State oldInit = automaton.getInitialState();
State realInit = oldInit.step(startChar);
// Duplicate the initial state, as it will *not* receive any epsilon-transitions
// for the inner character
State newInit = new State();
newInit.setAccept(true);
newInit.getTransitions().addAll(realInit.getTransitions());
automaton.setInitialState(newInit);
automaton.setDeterministic(false);
for(State s : automaton.getStates()) {
s.setAccept(true);
if(s.step(endChar) != null) {
s.getTransitions().clear();
continue;
}
if(s != newInit) {
State innerSucc = s.step(innerChar);
if(innerSucc != null) {
automaton.addEpsilons(Collections.singleton(new StatePair(s, innerSucc)));
}
}
// Remove all transitions with special characters
List<Transition> newTransitions = new ArrayList<>();
Set<Transition> transSet = s.getTransitions();
Iterator<Transition> transIt = transSet.iterator();
while(transIt.hasNext()) {
Transition t = transIt.next();
State succ = t.getDest();
if(t.getMax() > overallHigh) {
transIt.remove();
if(t.getMin() <= overallHigh) {
newTransitions.add(new Transition(t.getMin(), overallHigh, succ));
}
}
}
transSet.addAll(newTransitions);
}
automaton.determinize();
automaton.minimize();
return automaton;
}