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


Java Automaton.getInitialState方法代码示例

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


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

示例1: initialState

import dk.brics.automaton.Automaton; //导入方法依赖的package包/类
static PolyState initialState(List<Automaton> automata) {
    final State[] initialStates = new State[automata.size()];
    int c = 0;
    for (final Automaton automaton: automata) {
        initialStates[c++] = automaton.getInitialState();
    }
    return new PolyState(initialStates);
}
 
开发者ID:salesforce,项目名称:gorp,代码行数:9,代码来源:Automata.java

示例2: createFormula

import dk.brics.automaton.Automaton; //导入方法依赖的package包/类
public static Formula createFormula(Automaton A, int n) {
    State root = A.getInitialState();
    if (n==0) {
        if (root.isAccept()) {
            return new TrueFormula();
        } else {
            return new FalseFormula();
        }
    } else {
        Formula ret = createFormula(root,1,n);
        return ret==null? new FalseFormula() : ret;
    }
}
 
开发者ID:zhihan,项目名称:janala2-gradle,代码行数:14,代码来源:AutomatonTest1.java

示例3: createFormula

import dk.brics.automaton.Automaton; //导入方法依赖的package包/类
public static Constraint createFormula(Automaton A, String prefix, int n) {
  State root = A.getInitialState();
  if (n == 0) {
    if (root.isAccept()) {
      return SymbolicTrueConstraint.instance;
    } else {
      return SymbolicFalseConstraint.instance;
    }
  } else {
    Constraint ret = createFormula(root, prefix, 0, n);
    return ret == null ? SymbolicFalseConstraint.instance : ret;
  }
}
 
开发者ID:zhihan,项目名称:janala2-gradle,代码行数:14,代码来源:RegexpEncoder.java

示例4: refineAutomaton

import dk.brics.automaton.Automaton; //导入方法依赖的package包/类
private Automaton refineAutomaton(Automaton automaton) {
	State initialState = automaton.getInitialState();
	this.pruneOutRedundantTransitions(initialState);
	
	automaton.minimize();
	return automaton;
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:8,代码来源:DimensionalityHeuristicBasedCallableBriefSubAutomataMaker.java

示例5: accepts

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

示例6: WeightedAutomaton

import dk.brics.automaton.Automaton; //导入方法依赖的package包/类
public WeightedAutomaton(Automaton automaton,
		NavigableMap<Character, AbstractTaskClass> translationMap) {
	this.translationMap = translationMap;
	
	NavigableMap<State, WeightedState> statesTranslationMap = new TreeMap<State, WeightedState>();
	NavigableSet<State> visitedStates = new TreeSet<State>();

	WeightedState initWState = new WeightedState();
	State initState = automaton.getInitialState();
	this.setInitialState(initWState);

	statesTranslationMap.put(initState, initWState);

	unfoldTransitions(statesTranslationMap, visitedStates, initState);
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:16,代码来源:WeightedAutomaton.java

示例7: pathRegex

import dk.brics.automaton.Automaton; //导入方法依赖的package包/类
public static void pathRegex(String regex) {
  pathRegex = regex;
  Automaton pathsAutomaton = (new RegExp(regex)).toAutomaton();
  //System.out.println(pathsAutomaton.toDot());
  pathsState = pathsAutomaton.getInitialState();
}
 
开发者ID:zhihan,项目名称:janala2-gradle,代码行数:7,代码来源:Main.java

示例8: automatonToTSML

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

示例9: postConstructionInit

import dk.brics.automaton.Automaton; //导入方法依赖的package包/类
protected void postConstructionInit(Automaton automaton) {
	this.alphabet = new TreeSet<Character>();
	
	automaton.minimize();

	NavigableMap<State, ActivationStatusAwareState> statesTranslationMap = new TreeMap<State, ActivationStatusAwareState>();
	NavigableSet<State> visitedStates = new TreeSet<State>();

	ActivationStatusAwareState initWState = makeNewState();
	State initState = automaton.getInitialState();
	this.setInitialState(initWState);

	statesTranslationMap.put(initState, initWState);

	visitTransitions(statesTranslationMap, visitedStates, initState);
}
 
开发者ID:cdc08x,项目名称:MINERful,代码行数:17,代码来源:VacuityAwareAutomaton.java

示例10: cacheRegex

import dk.brics.automaton.Automaton; //导入方法依赖的package包/类
private static void cacheRegex(String regex) {
	String r = expandRegex(regex);
	Automaton automaton = new RegExp(r, RegExp.NONE).toAutomaton();
	automaton.expandSingleton();

	// We convert this to a graph without self-loops in order to determine the topological order
	DirectedGraph<State, DefaultEdge> regexGraph = new DefaultDirectedGraph<State, DefaultEdge>(
			DefaultEdge.class);
	Set<State> visitedStates = new HashSet<State>();
	Queue<State> states = new LinkedList<State>();
	State initialState = automaton.getInitialState();
	states.add(initialState);

	while (!states.isEmpty()) {
		State currentState = states.poll();
		if (visitedStates.contains(currentState))
			continue;
		if (!regexGraph.containsVertex(currentState))
			regexGraph.addVertex(currentState);
		for (Transition t : currentState.getTransitions()) {
			// Need to get rid of back edges, otherwise there is no topological order!
			if (!t.getDest().equals(currentState)) {
				regexGraph.addVertex(t.getDest());
				regexGraph.addEdge(currentState, t.getDest());
				states.add(t.getDest());
				CycleDetector<State, DefaultEdge> det = new CycleDetector<State, DefaultEdge>(
						regexGraph);
				if (det.detectCycles()) {
					regexGraph.removeEdge(currentState, t.getDest());
				}
			}
		}
		visitedStates.add(currentState);
	}

	TopologicalOrderIterator<State, DefaultEdge> iterator = new TopologicalOrderIterator<State, DefaultEdge>(
			regexGraph);
	List<State> topologicalOrder = new ArrayList<State>();
	while (iterator.hasNext()) {
		topologicalOrder.add(iterator.next());
	}

	regexStateCache.put(regex, topologicalOrder);
	regexAutomatonCache.put(regex, automaton);
}
 
开发者ID:EvoSuite,项目名称:evosuite,代码行数:46,代码来源:RegexDistanceUtils.java


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