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


Java State.step方法代码示例

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


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

示例1: 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

示例2: 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

示例3: step

import dk.brics.automaton.State; //导入方法依赖的package包/类
public PolyState step(char token) {
    State[] nextStates = new State[states.length];
    for (int c = 0, clen = states.length; c < clen; ++c) {
        State prevState = states[c];
        nextStates[c] = (prevState == null) ? null : prevState.step(token);
    }
    return new PolyState(nextStates);
}
 
开发者ID:salesforce,项目名称:gorp,代码行数:9,代码来源:PolyState.java

示例4: accepts

import dk.brics.automaton.State; //导入方法依赖的package包/类
public static final boolean accepts(Automaton automaton, String string) {
	State state = automaton.getInitialState();
	for (char step : string.toCharArray()) {
		state = state.step(step);
		if (state == null)
			return false;
	}
	return state.isAccept();
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:10,代码来源:AutomatonUtils.java

示例5: closeScope

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


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