net.automatalib.words.Word.suffixes()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(77)

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

Word.suffixes介绍

[英]Retrieves the list of all suffixes of this word. In the default implementation, the suffixes are lazily instantiated upon the respective calls of List#get(int) or Iterator#next().
[中]检索该单词所有后缀的列表。在默认实现中,后缀是在分别调用List#get(int)或Iterator#next()时被惰性地实例化的。

代码示例

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

/**
 * Returns all suffixes of the counterexample word as distinguishing suffixes, as suggested by Maler & Pnueli.
 *
 * @param ceQuery
 *         the counterexample query
 *
 * @return all suffixes of the counterexample input
 */
public static <I, D> List<Word<I>> findMalerPnueli(Query<I, D> ceQuery) {
  return ceQuery.getInput().suffixes(false);
}

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

/**
 * Transforms a suffix index returned by a {@link LocalSuffixFinder} into a list of distinguishing suffixes. This
 * list always contains the corresponding local suffix. Since local suffix finders only return a single suffix,
 * suffix-closedness of the set of distinguishing suffixes might not be preserved. Note that for correctly
 * implemented local suffix finders, this does not impair correctness of the learning algorithm. However, without
 * suffix closedness, intermediate hypothesis models might be non-canonical, if no additional precautions are taken.
 * For that reasons, the <tt>allSuffixes</tt> parameter can be specified to control whether or not the list returned
 * by {@link GlobalSuffixFinder#findSuffixes(Query, AccessSequenceTransformer, SuffixOutput, MembershipOracle)} of
 * the returned global suffix finder should not only contain the single suffix, but also all of its suffixes,
 * ensuring suffix-closedness.
 */
public static <I, D> List<Word<I>> suffixesForLocalOutput(Query<I, D> ceQuery,
                             int localSuffixIdx,
                             boolean allSuffixes) {
  if (localSuffixIdx == -1) {
    return Collections.emptyList();
  }
  Word<I> suffix = ceQuery.getInput().subWord(localSuffixIdx);
  if (!allSuffixes) {
    return Collections.singletonList(suffix);
  }
  return suffix.suffixes(false);
}

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

@Override
public boolean refineHypothesis(DefaultQuery<I, Boolean> ceQuery) {
  if (hypothesis == null) {
    throw new IllegalStateException();
  }
  boolean refined = false;
  while (MQUtil.isCounterexample(ceQuery, hypothesis)) {
    Word<I> ceWord = ceQuery.getInput();
    List<List<Row<I>>> unclosed = table.addSuffixes(ceWord.suffixes(false));
    completeConsistentTable(unclosed);
    constructHypothesis();
    refined = true;
  }
  return refined;
}

代码示例来源: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);
}

相关文章