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


Java SimpleAlphabet类代码示例

本文整理汇总了Java中net.automatalib.words.impl.SimpleAlphabet的典型用法代码示例。如果您正苦于以下问题:Java SimpleAlphabet类的具体用法?Java SimpleAlphabet怎么用?Java SimpleAlphabet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TLSSUL

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
public TLSSUL(TLSConfig config) throws Exception {
	alphabet = new SimpleAlphabet<String>(Arrays.asList(config.alphabet.split(" ")));
	
	tls = new TLSTestService();
	
	tls.setTarget(config.target);
	tls.setHost(config.host);
	tls.setPort(config.port);
	tls.setCommand(config.cmd);
	tls.setRequireRestart(config.restart);
	tls.setReceiveMessagesTimeout(config.timeout);
	tls.setKeystore(config.keystore_filename, config.keystore_password);
	tls.setConsoleOutput(config.console_output);
	
	if(config.version.equals("tls10")) {
		tls.useTLS10();
	}
	else {
		tls.useTLS12();
	}
	
	tls.start();
}
 
开发者ID:jderuiter,项目名称:statelearner,代码行数:24,代码来源:TLSSUL.java

示例2: shouldGetOneTestResult

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
@Test
public void shouldGetOneTestResult() throws NotFoundException, JsonProcessingException {
    // given
    ObjectMapper objectMapper = new ObjectMapper();
    Alphabet<String> sigma = new SimpleAlphabet<>();
    sigma.add("0");
    sigma.add("1");

    LearnerResult learnerResult = new LearnerResult();
    learnerResult.setProject(project);
    learnerResult.setTestNo(RESULT_ID);
    learnerResult.setSigma(AlphabetProxy.createFrom(sigma));

    given(learnerResultDAO.get(admin, PROJECT_ID, RESULT_ID, false)).willReturn(learnerResult);

    // when
    Response response = target("/projects/" + PROJECT_ID + "/results/" + RESULT_ID).request()
            .header("Authorization", adminToken).get();

    // then
    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    assertEquals(objectMapper.writeValueAsString(learnerResult), response.readEntity(String.class));
}
 
开发者ID:LearnLib,项目名称:alex,代码行数:24,代码来源:LearnerResultResourceTest.java

示例3: getOutputAlphabet

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
protected Alphabet<String> getOutputAlphabet(FastMealy<Symbol,String> hypothesis) {
	Collection<FastMealyState<String>> allStates = hypothesis.getStates();

	Stream<String> outputStream = inputAlphabet.stream().
			flatMap(i -> allStates.stream().map(s -> hypothesis.getOutput(s, i))).distinct();
	SimpleAlphabet<String> outputAlphabet = new SimpleAlphabet<>();
	outputStream.forEach(o -> outputAlphabet.add(o));
	return outputAlphabet;
}
 
开发者ID:mtappler,项目名称:mut-learn,代码行数:10,代码来源:MutationOperator.java

示例4: SocketSUL

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
public SocketSUL(SocketConfig config) throws Exception {
	alphabet = new SimpleAlphabet<String>(Arrays.asList(config.alphabet.split(" ")));
	
	// Initialise test service
	socket = new Socket(config.hostname, config.port);
	out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
	in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
}
 
开发者ID:jderuiter,项目名称:statelearner,代码行数:9,代码来源:SocketSUL.java

示例5: SCSUL

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
public SCSUL(SCConfig config) throws Exception {
	// Initialise test service
	scTestService = new SmartcardTestService();
	scTestService.loadAPDUDictionary(config.apdu_file);

	if(config.alphabet != null)
		alphabet = new SimpleAlphabet<String>(Arrays.asList(config.alphabet.split(" ")));
	else
		alphabet = new SimpleAlphabet<String>(scTestService.getAPDUDictionary().keySet());

	if(config.prefix != null)
		prefix = config.prefix.split(" ");		
}
 
开发者ID:jderuiter,项目名称:statelearner,代码行数:14,代码来源:SCSUL.java

示例6: loadEquivalenceAlgorithm

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
public void loadEquivalenceAlgorithm(String algorithm, SimpleAlphabet<String> alphabet, SUL<String, String> sul) throws Exception {
	//TODO We could combine the two cached oracle to save some queries to the SUL
	// Create the equivalence oracle
	//eqOracle = new SULOracle<String, String>(sul);
	// Add a logging oracle
	logEqOracle = new MealyLogOracle<String, String>(sul, LearnLogger.getLogger("equivalence_queries"));
	// Add an oracle that counts the number of queries
	statsEqOracle = new MealyCounterOracle<String, String>(logEqOracle, "equivalence queries to SUL");
	// Use cache oracle to prevent double queries to the SUL
	//cachedEqOracle = MealyCacheOracle.createDAGCacheOracle(alphabet, statsEqOracle);
       // Count the number of queries to the cache
	statsCachedEqOracle = new MealyCounterOracle<String, String>(statsEqOracle, "equivalence queries to cache");
	
	// Instantiate the selected equivalence algorithm
	switch(algorithm.toLowerCase()) {
		case "wmethod":
			equivalenceAlgorithm = new WMethodEQOracle.MealyWMethodEQOracle<String, String>(config.max_depth, statsCachedEqOracle);
			break;

		case "modifiedwmethod":
			equivalenceAlgorithm = new MealyModifiedWMethodEQOracle<String, String>(config.max_depth, statsCachedEqOracle);
			break;
			
		case "wpmethod":
			equivalenceAlgorithm = new WpMethodEQOracle.MealyWpMethodEQOracle<String, String>(config.max_depth, statsCachedEqOracle);
			break;
			
		case "randomwords":
			equivalenceAlgorithm = new MealyRandomWordsEQOracle<String, String>(statsCachedEqOracle, config.min_length, config.max_length, config.nr_queries, new Random(config.seed));
			break;
			
		default:
			throw new Exception("Unknown equivalence algorithm " + config.eqtest);
	}	
}
 
开发者ID:jderuiter,项目名称:statelearner,代码行数:36,代码来源:Learner.java

示例7: writeAutModel

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
public static void writeAutModel(MealyMachine<?, String, ?, String> model, SimpleAlphabet<String> alphabet, String filename) throws FileNotFoundException {
	// Make use of LearnLib's internal representation of states as integers
	@SuppressWarnings("unchecked")
	MealyMachine<Integer, String, ?, String> tmpModel = (MealyMachine<Integer, String, ?, String>) model;
	
	// Write output to aut-file
	File autFile = new File(filename);
	PrintStream psAutFile = new PrintStream(autFile);
	
	int nrStates = model.getStates().size();
	// Compute number of transitions, assuming the graph is complete
	int nrTransitions = nrStates * alphabet.size();
	
	psAutFile.println("des(" + model.getInitialState().toString() + "," + nrTransitions + "," + nrStates + ")");
	
	Collection<Integer> states = tmpModel.getStates();

	for(Integer state: states) {
		for(String input: alphabet) {
			String output = tmpModel.getOutput(state, input);
			Integer successor = tmpModel.getSuccessor(state, input);
			psAutFile.println("(" + state + ",'" + input + " / " + output + "', " + successor + ")");
		}
	}
	
	psAutFile.close();
}
 
开发者ID:jderuiter,项目名称:statelearner,代码行数:28,代码来源:Learner.java

示例8: writeDotModel

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
public static void writeDotModel(MealyMachine<?, String, ?, String> model, SimpleAlphabet<String> alphabet, String filename) throws IOException, InterruptedException {
	// Write output to dot-file
	File dotFile = new File(filename);
	PrintStream psDotFile = new PrintStream(dotFile);
	GraphDOT.write(model, alphabet, psDotFile);
	psDotFile.close();
	
	//TODO Check if dot is available
	
	// Convert .dot to .pdf
	Runtime.getRuntime().exec("dot -Tpdf -O " + filename);
}
 
开发者ID:jderuiter,项目名称:statelearner,代码行数:13,代码来源:Learner.java

示例9: createAlphabet

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
/**
 * Create an Alphabet based on the proxy.
 *
 * @return An Alphabet with all the proxy input symbols.
 */
@Transient
@JsonIgnore
public Alphabet<String> createAlphabet() {
    Set<String> inputs = edges.stream().map(CompactMealyTransitionProxy::getInput)
                                       .collect(Collectors.toSet());

    Alphabet<String> alphabet = new SimpleAlphabet<>(inputs);
    return alphabet;
}
 
开发者ID:LearnLib,项目名称:alex,代码行数:15,代码来源:CompactMealyMachineProxy.java

示例10: shouldCreateCorrectLearner

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
@Test
public void shouldCreateCorrectLearner() {
    Alphabet<String> sigma = new SimpleAlphabet<>();
    sigma.add("a");
    sigma.add("b");
    SULOracle<String, String> oracle = mock(SULOracle.class);

    algorithm.createLearner(sigma, oracle);
}
 
开发者ID:LearnLib,项目名称:alex,代码行数:10,代码来源:LStarTest.java

示例11: createTestLearnResults

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
private List<LearnerResult> createTestLearnResults() {
    List<LearnerResult> results = new LinkedList<>();
    for (long i = 0; i < TEST_RESULT_AMOUNT; i++) {
        Alphabet<String> sigma = new SimpleAlphabet<>();
        sigma.add("0");
        sigma.add("1");

        LearnerResult learnerResult = new LearnerResult();
        learnerResult.setProject(project);
        learnerResult.setTestNo(i);
        learnerResult.setSigma(AlphabetProxy.createFrom(sigma));

        results.add(learnerResult);
    } return results;
}
 
开发者ID:LearnLib,项目名称:alex,代码行数:16,代码来源:LearnerResultResourceTest.java

示例12: getAlphabet

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
public SimpleAlphabet<String> getAlphabet() {
	return alphabet;
}
 
开发者ID:jderuiter,项目名称:statelearner,代码行数:4,代码来源:SocketSUL.java

示例13: getAlphabet

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
public SimpleAlphabet<String> getAlphabet() {
	// Get alphabet from the SmartcardService's APDU dictionary
	return alphabet;
}
 
开发者ID:jderuiter,项目名称:statelearner,代码行数:5,代码来源:SCSUL.java

示例14: loadLearningAlgorithm

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
public void loadLearningAlgorithm(String algorithm, SimpleAlphabet<String> alphabet, SUL<String, String> sul) throws Exception {
	// Create the membership oracle
	//memOracle = new SULOracle<String, String>(sul);
	// Add a logging oracle
	logMemOracle = new MealyLogOracle<String, String>(sul, LearnLogger.getLogger("learning_queries"));		
       // Count the number of queries actually sent to the SUL
	statsMemOracle = new MealyCounterOracle<String, String>(logMemOracle, "membership queries to SUL");
	// Use cache oracle to prevent double queries to the SUL
	//cachedMemOracle = MealyCacheOracle.createDAGCacheOracle(alphabet, statsMemOracle);
       // Count the number of queries to the cache
	statsCachedMemOracle = new MealyCounterOracle<String, String>(statsMemOracle, "membership queries to cache");
	
	// Instantiate the selected learning algorithm
	switch(algorithm.toLowerCase()) {
		case "lstar":
			learningAlgorithm = new ExtensibleLStarMealyBuilder<String, String>().withAlphabet(alphabet).withOracle(statsCachedMemOracle).create();
			break;
			 	
		case "dhc":
			learningAlgorithm = new MealyDHC<String, String>(alphabet, statsCachedMemOracle);
			break;
			
		case "kv":
			learningAlgorithm = new KearnsVaziraniMealy<String, String>(alphabet, statsCachedMemOracle, true, AcexAnalyzers.BINARY_SEARCH);
			break;
			
		case "ttt":
			AcexLocalSuffixFinder suffixFinder = new AcexLocalSuffixFinder(AcexAnalyzers.BINARY_SEARCH, true, "Analyzer");
			learningAlgorithm = new TTTLearnerMealy<String, String>(alphabet, statsCachedMemOracle, suffixFinder);
			break;
			
		case "mp":
			learningAlgorithm = new MalerPnueliMealy<String, String>(alphabet, statsCachedMemOracle);
			break;
			
		case "rs":
			learningAlgorithm = new RivestSchapireMealy<String, String>(alphabet, statsCachedMemOracle);
			break;

		default:
			throw new Exception("Unknown learning algorithm " + config.learning_algorithm);
	}		
}
 
开发者ID:jderuiter,项目名称:statelearner,代码行数:44,代码来源:Learner.java

示例15: AbstractLearnerThread

import net.automatalib.words.impl.SimpleAlphabet; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param user
 * @param learnerResultDAO {@link #learnerResultDAO}.
 * @param context          The context to use.
 * @param result           {@link #result}.
 * @param configuration    {@link #configuration}.
 */
public AbstractLearnerThread(User user, LearnerResultDAO learnerResultDAO,
                             ConnectorContextHandler context,
                             LearnerResult result,
                             T configuration) {
    this.user = user;
    this.learnerResultDAO = learnerResultDAO;
    this.result = result;
    this.configuration = configuration;
    this.abstractAlphabet = new SimpleAlphabet<>(
            result.getSymbols().stream()
                    .map(Symbol::getName)
                    .sorted(String::compareTo)
                    .collect(Collectors.toList())
    );

    this.finished = false;
    this.maxConcurrentQueries = context.getMaxConcurrentQueries();
    this.currentQueries = new ArrayList<>();

    // prepare the mapped sul.
    symbolMapper = new SymbolMapper(result.getSymbols());
    final ContextExecutableInputSUL<ContextExecutableInput<ExecuteResult, ConnectorManager>, ExecuteResult, ConnectorManager>
            ceiSUL = new ContextExecutableInputSUL<>(context);
    final SUL<String, String> mappedSUL = SULMappers.apply(symbolMapper, ceiSUL);
    this.sul = new AlexSUL<>(mappedSUL);

    this.multiSULOracle = new MultiSULOracle<>(sul);

    // monitor which queries are being processed.
    monitorOracle = new QueryMonitorOracle<>(multiSULOracle);
    monitorOracle.addPostProcessingListener(queries -> {
        List<DefaultQueryProxy> currentQueries = new ArrayList<>();
        queries.forEach(query -> currentQueries.add(DefaultQueryProxy.createFrom(new DefaultQuery<>(query))));
        this.currentQueries = currentQueries;
    });

    // create the concrete membership oracle.
    this.mqOracle = new DelegationOracle<>();
    if (result.isUseMQCache()) {
        this.mqOracle.setDelegate(MealyCacheOracle.createDAGCacheOracle(this.abstractAlphabet, monitorOracle));
    } else {
        this.mqOracle.setDelegate(monitorOracle);
    }

    // create the learner.
    this.learner = result.getAlgorithm().createLearner(abstractAlphabet, mqOracle);
}
 
开发者ID:LearnLib,项目名称:alex,代码行数:57,代码来源:AbstractLearnerThread.java


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