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


Java Transition.getMax方法代码示例

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


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

示例1: 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();
}
 
开发者ID:julianthome,项目名称:autorex,代码行数:14,代码来源:DefaultLabelTranslator.java

示例2: 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);
}
 
开发者ID:julianthome,项目名称:autorex,代码行数:8,代码来源:TestStateElimination.java

示例3: 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;
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:11,代码来源:AutomatonUtils.java

示例4: 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;
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:37,代码来源:VacuityAwareAutomaton.java

示例5: 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);
		}
	}
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:37,代码来源:VacuityAwareAutomaton.java

示例6: 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);
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:8,代码来源:ActivationStatusAwareState.java

示例7: 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);
	}
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:30,代码来源:WeightedAutomaton.java

示例8: setAlphabet

import dk.brics.automaton.Transition; //导入方法依赖的package包/类
/**
 * Part of the initialization of the message space:
 * Writes all characters of the alphabet to a private instance variable. 
 */
private void setAlphabet() {
	Set<Character> alphabet = new HashSet<Character>();
	//for each transition add characters to set
	for (State state : dfa.getStates()) {
		for (Transition transition : state.getTransitions()) {
			for (char i = transition.getMin(); i<=transition.getMax(); i++) {
				alphabet.add(i);
			}
		}
	}
	this.alphabet = new ArrayList<Character>(alphabet);
}
 
开发者ID:EVGStudents,项目名称:FPE,代码行数:17,代码来源:StringMessageSpace.java

示例9: automatonToTSML

import dk.brics.automaton.Transition; //导入方法依赖的package包/类
/**
	 * 
	 * Creates a TSML-document based on an instance of the class {@link Automaton}. 
	 * 
	 * @param a Automaton to be used.
	 * @param automatonSource The Automaton used.
	 * @return TSML document.
	 */
	public String automatonToTSML(Automaton a, String automatonSource) {

		Set<State> stateSet = a.getStates();
		HashMap<State, Set<Transition>> transitionSet = new HashMap<State, Set<Transition>>();
		StringBuilder tsmlBuilder = new StringBuilder();

		tsmlBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
		tsmlBuilder.append('\n');
		tsmlBuilder.append("<tsml label=\"Converted from " + automatonSource + "\" layout=\"false\">");
		tsmlBuilder.append('\n');

		State initialState = a.getInitialState();
		for (State state : stateSet) {
			tsmlBuilder.append("<state weight=\"");
			tsmlBuilder.append(DEFAULT_WEIGHT); // TODO: WEIGHT of a transition!
			tsmlBuilder.append("\" ");
			tsmlBuilder.append("id=\"state" + state.hashCode() + "\" ");
			if (initialState.equals(state))
				tsmlBuilder.append(" start=\"true\"");
			if (state.isAccept())
				tsmlBuilder.append(" accept=\"true\"");
			tsmlBuilder.append(">\n<name><text>" + state.hashCode());
			tsmlBuilder.append("</text></name>");
			tsmlBuilder.append("</state>");
			tsmlBuilder.append('\n');
			transitionSet.put(state, state.getTransitions());
		}

		for (State source : transitionSet.keySet()) {
			for (Transition t : transitionSet.get(source)) {
				for (Character c = t.getMin(); c <= t.getMax(); c++) {
					tsmlBuilder.append("<transition weight=\"");
					tsmlBuilder.append(DEFAULT_WEIGHT); // TODO: WEIGHT of a transition!
					tsmlBuilder.append("\" ");
//					tsmlBuilder.append("id=\"transition_" + source.hashCode() + "_" + c.hashCode() + "_" + t.getDest().hashCode() + "\" ");
					tsmlBuilder.append("id=\"" + this.transMap.get(c) + "\" ");
					tsmlBuilder.append("source=\"state" + source.hashCode() + "\" ");
					tsmlBuilder.append("target=\"state" + t.getDest().hashCode() + "\" >");
					tsmlBuilder.append("<name><text>");
					tsmlBuilder.append(this.transMap.get(c));
					tsmlBuilder.append("</text></name>");
					tsmlBuilder.append("</transition>");
					tsmlBuilder.append('\n');
				}
			}
		}

		tsmlBuilder.append("</tsml>");
		
		return tsmlBuilder.toString();
	}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:60,代码来源:TsmlEncoder.java

示例10: 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;
}
 
开发者ID:misberner,项目名称:duzzt,代码行数:59,代码来源:BricsCompiler.java


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