本文整理汇总了Java中dk.brics.automaton.Transition类的典型用法代码示例。如果您正苦于以下问题:Java Transition类的具体用法?Java Transition怎么用?Java Transition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Transition类属于dk.brics.automaton包,在下文中一共展示了Transition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dfaToDkAutomaton
import dk.brics.automaton.Transition; //导入依赖的package包/类
private static Automaton dfaToDkAutomaton(TIntObjectMap<State> map, Machine machine) {
dk.brics.automaton.Automaton dkAut = new dk.brics.automaton.Automaton();
APList aps = machine.getInAPs();
for(int stateNr = 0; stateNr < machine.getStateSize(); stateNr ++) {
State state = getState(map, stateNr);
// initial states
if(machine.getInitialState() == stateNr) {
dkAut.setInitialState(state);
}
// final states
if(machine.getAcceptance().isFinal(stateNr)) {
state.setAccept(true);
}
for (int letter = 0; letter < aps.size(); letter ++) {
int succ = machine.getSuccessor(stateNr, letter);
State stateSucc = getState(map, succ);
state.addTransition(new Transition(aps.get(letter).toString().charAt(0),
stateSucc));
}
}
dkAut.setDeterministic(true);
return dkAut;
}
示例2: FullTransition
import dk.brics.automaton.Transition; //导入依赖的package包/类
public FullTransition(State src, Transition trans, State dest,
LabelTranslator ltrans) {
this.src = src;
this.trans = new HashSet<>();
this.ltrans = ltrans;
if(trans != null) {
this.trans.add(trans);
this.label = getTransitionLabel();
}
this.dest = dest;
this.tid = id ++;
this.isEpsilon = false;
this.kind = Kind.MATCH;
this.recentlyAdded = trans;
}
示例3: getTransitionLabel
import dk.brics.automaton.Transition; //导入依赖的package包/类
public String getTransitionLabel() {
if(this.trans.size() == 1)
return ltrans.getTransitionString(this.trans.iterator().next());
StringBuilder sb = new StringBuilder();
for(Transition t : this.trans) {
if(sb.length() > 0)
sb.append("|");
sb.append(ltrans.getTransitionString(t));
}
sb.insert(0,"(");
sb.append(")");
return sb.toString();
}
示例4: getCheckAutomaton
import dk.brics.automaton.Transition; //导入依赖的package包/类
@Override
public VacuityAwareWildcardAutomaton getCheckAutomaton() {
VacuityAwareWildcardAutomaton autom = new VacuityAwareWildcardAutomaton(
this.getRegularExpression(), TaskCharEncoderDecoder.getTranslationMap(this.getInvolvedTaskChars()), this.toString());
// TODO Tweaking to insert the loopback to the initial state
State state = autom.getInitialState();
int i = 0;
for (; i < this.getParameters().size() - 1; i++) {
state = state.step(this.parameters.get(i).getFirstTaskChar().identifier);
}
State stateToRemove = state.step(this.parameters.get(i).getFirstTaskChar().identifier);
state.getTransitions().remove(new Transition(this.parameters.get(i).getFirstTaskChar().identifier, stateToRemove));
RelevanceAwareTransition newTransition = new RelevanceAwareTransition(this.parameters.get(i).getFirstTaskChar().identifier, autom.getInitialState(), this.parameters.get(i).getFirstTaskChar().taskClass.toString());
newTransition.setRelevance(TransitionRelevance.RELEVANT);
state.addTransition(newTransition);
return autom;
}
示例5: pruneOutRedundantTransitions
import dk.brics.automaton.Transition; //导入依赖的package包/类
private void pruneOutRedundantTransitions(State initialState) {
boolean redundantTransitions = false;
State nextState = initialState.step(basingCharacter.charValue());
// Heuristic 1: if the automaton contains an action with the basingCharacter, the other are optional: we can exclude them!
if (nextState != null)
redundantTransitions = true;
if (redundantTransitions) {
Iterator<Transition> transIterator = initialState.getTransitions().iterator();
while (transIterator.hasNext()) {
transIterator.next();
transIterator.remove();
}
initialState.addTransition(new Transition(basingCharacter, nextState));
}
else {
Set<Transition> transitions = initialState.getTransitions();
if (transitions.size() == 0) {
return;
} else {
for (Transition transition : transitions) {
this.pruneOutRedundantTransitions(transition.getDest());
}
}
}
}
开发者ID:cdc08x,项目名称:MINERful,代码行数:27,代码来源:DimensionalityHeuristicBasedCallableBriefSubAutomataMaker.java
示例6: decideRelevanceOfTransitions
import dk.brics.automaton.Transition; //导入依赖的package包/类
private void decideRelevanceOfTransitions(
ActivationStatusAwareState currentStAwaState) {
ActivationStatusAwareState destStAwaState;
RelevanceAwareTransition relAwaTrans;
for (Transition trans : currentStAwaState.getTransitions()) {
relAwaTrans = (RelevanceAwareTransition) trans;
destStAwaState = (ActivationStatusAwareState) relAwaTrans.getDest();
// A transition is of relevance iff...
if (
// 1. the activation status of the destination state changes (no matter how), or
!currentStAwaState.getStatus().equals(destStAwaState.getStatus())
// 2. the possible actions that are allowed from this state are different than the ones in the destination state
|| !currentStAwaState.allowsTheSameTransitionsAs(destStAwaState)
) {
relAwaTrans.setRelevance(TransitionRelevance.RELEVANT);
} else {
relAwaTrans.setRelevance(TransitionRelevance.IRRELEVANT);
}
}
}
示例7: toString
import dk.brics.automaton.Transition; //导入依赖的package包/类
@Override
public String toString() {
StringBuilder sBuil = new StringBuilder();
sBuil.append("State");
sBuil.append(" ID: ");
sBuil.append(this.getStateUUID());
sBuil.append(" Status: ");
sBuil.append(this.getStatus());
sBuil.append(" Accept: ");
sBuil.append(this.isAccept());
sBuil.append(" ");
sBuil.append("\n Transitions:\n");
for (Transition trans : this.getTransitions()) {
sBuil.append(" Transition ");
sBuil.append(trans.getMin() + " - " + trans.getMax());
sBuil.append(" to ");
sBuil.append(((ActivationStatusAwareState)trans.getDest()).getStateUUID());
sBuil.append(" ");
sBuil.append(" Relevant: ");
sBuil.append(((RelevanceAwareTransition) trans).getRelevance());
sBuil.append("\n");
}
return sBuil.toString();
}
示例8: buildIllegalityStats
import dk.brics.automaton.Transition; //导入依赖的package包/类
private void buildIllegalityStats() {
this.stateIllegalityStats = new DescriptiveStatistics();
this.transIllegalityStats = new DescriptiveStatistics();
for (State state : this.automaton.getStates()) {
this.stateIllegalityStats.addValue(((WeightedState) state).getWeight());
for (Transition trans: state.getTransitions()) {
if (((WeightedTransition) trans).getWeight() > 0)
this.transIllegalityStats.addValue(((WeightedTransition) trans).getWeight());
}
}
for (int q = 0; q < AMOUNT_OF_QUANTILES - 1 ; q++) { // say we want quartiles. Then AMOUNT_OF_QUANTILES = 4. We want boundary values for 25, 50 and 75 => q values have to be 0, 1, 2 because the percentile is calculated as MAX_PERCENTAGE / AMOUNT_OF_QUANTILES * (q + 1) -- see the +1 there? Good!
stateIllegalityQuantileBoundaries[q] = stateIllegalityStats.getPercentile((double) MAX_PERCENTAGE / AMOUNT_OF_QUANTILES * (q + 1) );
}
for (int q = 0; q < AMOUNT_OF_QUANTILES - 1 ; q++) { // say we want quartiles. Then AMOUNT_OF_QUANTILES = 4. We want boundary values for 25, 50 and 75 => q values have to be 0, 1, 2 because the percentile is calculated as MAX_PERCENTAGE / AMOUNT_OF_QUANTILES * (q + 1) -- see the +1 there? Good!
transIllegalityQuantileBoundaries[q] = transIllegalityStats.getPercentile((double) MAX_PERCENTAGE / AMOUNT_OF_QUANTILES * (q + 1) );
}
}
示例9: getTransitionString
import dk.brics.automaton.Transition; //导入依赖的package包/类
@Override
public String getTransitionString(Transition t) {
StringBuilder sb = new StringBuilder();
if (t.getMax() == t.getMin()) {
sb.append(EscapeUtils.escapeSpecialCharacters(String.valueOf(t.getMin
())));
} else {
sb.append("[" + t.getMin() + "-" + t.getMax() + "]");
}
return sb.toString();
}
示例10: getTransitionString
import dk.brics.automaton.Transition; //导入依赖的package包/类
@Override
public String getTransitionString(Transition t) {
if (t.getMin() == Character.MIN_VALUE && t.getMax() == Character.MAX_VALUE){
return ".";
}
return super.getTransitionString(t);
}
示例11: getAllPossibleSteps
import dk.brics.automaton.Transition; //导入依赖的package包/类
public static ArrayList<Character> getAllPossibleSteps(State state) {
Collection<Transition> transitions = state.getTransitions();
ArrayList<Character> enabledTransitions = new ArrayList<Character>();
for (Transition transition : transitions) {
for (char c = transition.getMin(); c <= transition.getMax(); c++) {
enabledTransitions.add(c);
}
}
return enabledTransitions;
}
示例12: 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;
}
示例13: decideActivationStatus
import dk.brics.automaton.Transition; //导入依赖的package包/类
private void decideActivationStatus(State currentState, ActivationStatusAwareState currentStAwaState) {
boolean loop = true;
int outgoingAllowedTransitions = 0;
// A permanent satisfaction is possible in trimmed MINIMISED automata iff
// 1. the state is accepting...
if (currentState.isAccept()) {
currentStAwaState.setAccept(true);
Iterator<Transition> transIt = currentState.getTransitions().iterator();
Transition nextTrans = null;
// 2. the state is looping...
while (loop & transIt.hasNext()) {
nextTrans = transIt.next();
loop = loop && nextTrans.getDest().equals(currentState);
outgoingAllowedTransitions += nextTrans.getMax() - nextTrans.getMin() + 1;
}
// 3. all transitions are loops
if (loop && outgoingAllowedTransitions == this.translationMap.size()) {
currentStAwaState.setStatus(StateActivationStatus.SAT_PERM);
} else {
// In the worst case, an accepting state is at least a temp-satisfied one
currentStAwaState.setStatus(StateActivationStatus.SAT_TEMP);
}
} else {
// A state is of permanent violation when it is a not accepting sink
// Watch out: empty automata are clearly composed only of a permanently violating state
if (currentState.getTransitions().size() == 0) {
currentStAwaState.setStatus(StateActivationStatus.VIO_PERM);
// An intermediate non-accepting state is a temporary violation
} else {
currentStAwaState.setStatus(StateActivationStatus.VIO_TEMP);
}
}
}
示例14: addTransition
import dk.brics.automaton.Transition; //导入依赖的package包/类
@Override
public void addTransition(Transition transition) {
for (char fire = transition.getMin(); fire <= transition.getMax(); fire++)
this.transitionMap.put(fire, transition);
super.addTransition(transition);
}
示例15: getTransitions
import dk.brics.automaton.Transition; //导入依赖的package包/类
@Override
@XmlElementWrapper(name="transitions")
@XmlElement(name="transition")
@XmlJavaTypeAdapter(WeightedTransitionXmlAdapter.class)
public Set<Transition> getTransitions() {
return super.getTransitions();
}