当前位置: 首页>>代码示例>>Java>>正文


Java State.addTransition方法代码示例

本文整理汇总了Java中dk.brics.automaton.State.addTransition方法的典型用法代码示例。如果您正苦于以下问题:Java State.addTransition方法的具体用法?Java State.addTransition怎么用?Java State.addTransition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dk.brics.automaton.State的用法示例。


在下文中一共展示了State.addTransition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dfaToDkAutomaton

import dk.brics.automaton.State; //导入方法依赖的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;
}
 
开发者ID:duckly,项目名称:LearnMealyMachine,代码行数:27,代码来源:UtilMachine.java

示例2: getCheckAutomaton

import dk.brics.automaton.State; //导入方法依赖的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;
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:20,代码来源:SequenceResponse21.java

示例3: pruneOutRedundantTransitions

import dk.brics.automaton.State; //导入方法依赖的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


注:本文中的dk.brics.automaton.State.addTransition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。