de.learnlib.api.query.Query.getPrefix()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(85)

本文整理了Java中de.learnlib.api.query.Query.getPrefix方法的一些代码示例,展示了Query.getPrefix的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getPrefix方法的具体详情如下:
包路径:de.learnlib.api.query.Query
类名称:Query
方法名:getPrefix

Query.getPrefix介绍

暂无

代码示例

代码示例来源:origin: de.learnlib/learnlib-cache

@Override
public Word<I> getPrefix() {
  return origQuery.getPrefix();
}

代码示例来源:origin: de.learnlib/learnlib-util

@Override
@Nonnull
public Word<I> getPrefix() {
  return originalQuery.getPrefix();
}

代码示例来源:origin: de.learnlib/learnlib-equivalence-oracles

/**
 * Tests if the input word of the given {@link Query} consists entirely of symbols in {@code inputs}.
 *
 * @param query
 *         the query to test
 * @param inputs
 *         the set of allowed inputs
 *
 * @return {@code true} if the input word of {@code query} consists entirely of symbols in {@code inputs}, {@code
 * false} otherwise
 */
private static <I> boolean checkInputs(Query<I, ?> query, Collection<? extends I> inputs) {
  for (I sym : query.getPrefix()) {
    if (!inputs.contains(sym)) {
      return false;
    }
  }
  for (I sym : query.getSuffix()) {
    if (!inputs.contains(sym)) {
      return false;
    }
  }
  return true;
}

代码示例来源:origin: de.learnlib/learnlib-util

public static <I, D> void answerQueriesParallel(QueryAnswerer<I, D> answerer,
                        Collection<? extends Query<I, D>> queries) {
  queries.parallelStream().forEach(q -> {
    Word<I> prefix = q.getPrefix();
    Word<I> suffix = q.getSuffix();
    D answer = answerer.answerQuery(prefix, suffix);
    q.answer(answer);
  });
}

代码示例来源:origin: de.learnlib/learnlib-util

public static <I, D> void answerQueries(QueryAnswerer<I, D> answerer, Collection<? extends Query<I, D>> queries) {
  for (Query<I, D> query : queries) {
    Word<I> prefix = query.getPrefix();
    Word<I> suffix = query.getSuffix();
    D answer = answerer.answerQuery(prefix, suffix);
    query.answer(answer);
  }
}

代码示例来源:origin: de.learnlib/learnlib-membership-oracles

private static <I, O> void processQueries(SUL<I, O> sul, Collection<? extends Query<I, Word<O>>> queries) {
  for (Query<I, Word<O>> q : queries) {
    Word<O> output = answerQuery(sul, q.getPrefix(), q.getSuffix());
    q.answer(output);
  }
}

代码示例来源:origin: de.learnlib/learnlib-cache

private void answerSlave(Query<I, Word<O>> slave) {
  int start = slave.getPrefix().length();
  int end = start + slave.getSuffix().length();
  slave.answer(answer.subWord(start, end));
}

代码示例来源:origin: de.learnlib/learnlib-counterexamples

/**
 * Returns all suffixes of the counterexample word as distinguishing suffixes, after stripping a maximal one-letter
 * extension of an access sequence, as suggested by Shahbaz.
 *
 * @param ceQuery
 *         the counterexample query
 * @param asTransformer
 *         the access sequence transformer
 *
 * @return all suffixes from the counterexample after stripping a maximal one-letter extension of an access
 * sequence.
 */
public static <I, D> List<Word<I>> findShahbaz(Query<I, D> ceQuery, AccessSequenceTransformer<I> asTransformer) {
  Word<I> queryWord = ceQuery.getInput();
  int queryLen = queryWord.length();
  Word<I> prefix = ceQuery.getPrefix();
  int i = prefix.length();
  while (i <= queryLen) {
    Word<I> nextPrefix = queryWord.prefix(i);
    if (!asTransformer.isAccessSequence(nextPrefix)) {
      break;
    }
    i++;
  }
  return queryWord.subWord(i).suffixes(false);
}

相关文章