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

x33g5p2x  于2022-01-16 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(73)

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

Alphabet.getSymbolIndex介绍

[英]Returns the index of the given symbol in the alphabet.
[中]返回字母表中给定符号的索引。

代码示例

代码示例来源:origin: net.automatalib/automata-api

@Override
default int applyAsInt(I symbol) {
  return getSymbolIndex(symbol);
}

代码示例来源:origin: net.automatalib/automata-core

@Override
public T getTransition(S state, I input) {
  int inputIdx = inputAlphabet.getSymbolIndex(input);
  return state.getTransition(inputIdx);
}

代码示例来源:origin: net.automatalib/automata-core

@Override
public void setTransitions(S state, I input, Collection<? extends T> transitions) {
  int inputIdx = inputAlphabet.getSymbolIndex(input);
  state.setTransitions(inputIdx, transitions);
}

代码示例来源:origin: net.automatalib/automata-core

@Override
public void setTransition(S state, I input, T transition) {
  int inputIdx = inputAlphabet.getSymbolIndex(input);
  state.setTransition(inputIdx, transition);
}

代码示例来源:origin: net.automatalib/automata-incremental

@Override
protected State getState(Word<? extends I> word) {
  State s = init;
  for (I sym : word) {
    int idx = inputAlphabet.getSymbolIndex(sym);
    s = s.getSuccessor(idx);
    if (s == null || s == sink) {
      return s;
    }
  }
  return s;
}

代码示例来源:origin: net.automatalib/automata-core

public void setTransitions(int state,
              I input,
              Collection<? extends Integer> successors) { // TODO: replace by primitive specialization
  setTransitions(state, alphabet.getSymbolIndex(input), successors);
}

代码示例来源:origin: LearnLib/automatalib

@Override
public T getTransition(S state, I input) {
  int inputIdx = inputAlphabet.getSymbolIndex(input);
  return state.getTransitionObject(inputIdx);
}

代码示例来源:origin: LearnLib/automatalib

@Override
public void setTransitions(S state, I input, Collection<? extends T> transitions) {
  int inputIdx = inputAlphabet.getSymbolIndex(input);
  state.setTransitionObject(inputIdx, new HashSet<>(transitions));
}

代码示例来源:origin: LearnLib/automatalib

@Override
protected State getState(Word<? extends I> word) {
  State s = init;
  for (I sym : word) {
    int idx = inputAlphabet.getSymbolIndex(sym);
    s = s.getSuccessor(idx);
    if (s == null || s == sink) {
      return s;
    }
  }
  return s;
}

代码示例来源:origin: LearnLib/automatalib

@Override
public void setTransition(S state, I input, T transition) {
  int inputIdx = inputAlphabet.getSymbolIndex(input);
  state.setTransitionObject(inputIdx, transition);
}

代码示例来源:origin: LearnLib/automatalib

@Override
public Collection<T> getTransitions(S state, I input) {
  int inputIdx = inputAlphabet.getSymbolIndex(input);
  final Collection<T> result = state.getTransitionObject(inputIdx);
  return result == null ? Collections.emptySet() : result;
}

代码示例来源:origin: net.automatalib/automata-core

@Override
public Collection<T> getTransitions(S state, I input) {
  int inputIdx = inputAlphabet.getSymbolIndex(input);
  final Collection<T> result = state.getTransitions(inputIdx);
  return result == null ? Collections.emptySet() : result;
}

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

@Override
public HTransition<I, O, SP, TP> getTransition(HState<I, O, SP, TP> state, I symbol) {
  int symIdx = alphabet.getSymbolIndex(symbol);
  return state.getTransition(symIdx);
}

代码示例来源:origin: net.automatalib/automata-incremental

@Override
public boolean hasDefinitiveInformation(Word<? extends I> word) {
  Node<I, O> curr = root;
  Iterator<? extends I> symIt = word.iterator();
  while (symIt.hasNext() && curr != null) {
    int symIdx = inputAlphabet.getSymbolIndex(symIt.next());
    curr = curr.getSuccessor(symIdx);
  }
  return (curr != null);
}

代码示例来源:origin: net.automatalib/automata-core

@Override
public T getTransition(Integer state, I input) {
  return getTransition(getId(state), alphabet.getSymbolIndex(input));
}

代码示例来源:origin: net.automatalib/automata-core

@Override
public void setTransition(Integer state, I input, T transition) {
  setTransition(getId(state), alphabet.getSymbolIndex(input), transition);
}

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

@Override
public boolean isAccessSequence(Word<I> word) {
  HState<I, O, SP, TP> curr = root;
  for (I sym : word) {
    int symIdx = alphabet.getSymbolIndex(sym);
    HTransition<I, O, SP, TP> trans = curr.getTransition(symIdx);
    if (!trans.isTree()) {
      return false;
    }
    curr = trans.getTreeTarget();
  }
  return true;
}

代码示例来源:origin: net.automatalib/automata-api

default <I2> Mapping<I2, I> translateFrom(Alphabet<I2> other) {
  if (other.size() > size()) {
    throw new IllegalArgumentException(
        "Cannot translate from an alphabet with " + other.size() + " elements into an alphabet with only " +
        size() + " elements");
  }
  return i -> getSymbol(other.getSymbolIndex(i));
}

代码示例来源:origin: LearnLib/automatalib

default <I2> Mapping<I2, I> translateFrom(Alphabet<I2> other) {
  if (other.size() > size()) {
    throw new IllegalArgumentException(
        "Cannot translate from an alphabet with " + other.size() + " elements into an alphabet with only " +
        size() + " elements");
  }
  return i -> getSymbol(other.getSymbolIndex(i));
}

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

protected TTTState<I, D> getAnySuccessor(TTTState<I, D> state, I sym) {
  int symIdx = alphabet.getSymbolIndex(sym);
  TTTTransition<I, D> trans = state.getTransition(symIdx);
  if (trans.isTree()) {
    return trans.getTreeTarget();
  }
  return trans.getNonTreeTarget().subtreeStatesIterator().next();
}

相关文章