本文整理了Java中net.automatalib.words.Word.equals()
方法的一些代码示例,展示了Word.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Word.equals()
方法的具体详情如下:
包路径:net.automatalib.words.Word
类名称:Word
方法名:equals
暂无
代码示例来源:origin: de.learnlib/learnlib-lstar-baseline
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof ObservationTableRow)) {
return false;
}
ObservationTableRow<?> that = (ObservationTableRow<?>) o;
return label.equals(that.label) && rowData.equals(that.rowData);
}
代码示例来源:origin: de.learnlib/learnlib-lstar-baseline
@Nonnull
ObservationTableRow<I> getRowForPrefix(@Nonnull Word<I> state) {
for (ObservationTableRow<I> row : shortPrefixRows) {
if (row.getLabel().equals(state)) {
return row;
}
}
for (ObservationTableRow<I> row : longPrefixRows) {
if (row.getLabel().equals(state)) {
return row;
}
}
throw new IllegalArgumentException("Unable to find a row for '" + state + "'");
}
代码示例来源:origin: de.learnlib/learnlib-dhc
@Override
public boolean isAccessSequence(Word<I> word) {
checkInternalState();
Word<I> canonical = transformAccessSequence(word);
return canonical.equals(word);
}
代码示例来源:origin: de.learnlib/learnlib-lstar-baseline
/**
* Moves a single row from long prefix rows to short prefix rows.
*
* @param longPrefix
* A row which must be part of the long prefix rows and
* should be moved to the short prefix rows.
*/
void moveLongPrefixToShortPrefixes(@Nonnull Word<I> longPrefix) {
ObservationTableRow<I> rowToMove = null;
for (ObservationTableRow<I> row : longPrefixRows) {
if (row.getLabel().equals(longPrefix)) {
rowToMove = row;
break;
}
}
if (rowToMove == null) {
throw new IllegalArgumentException("Word '" + longPrefix + "' not part of long prefixes");
}
longPrefixRows.remove(rowToMove);
rowToMove.setShortPrefixRow();
shortPrefixRows.add(rowToMove);
}
}
代码示例来源:origin: de.learnlib/learnlib-adt
@Override
public boolean isAccessSequence(final Word<I> word) {
return this.getState(word).getAccessSequence().equals(word);
}
代码示例来源:origin: de.learnlib/learnlib-lstar-baseline
@Override
@Nullable
public Row<I, Boolean> getSuccessorRow(@Nonnull Row<I, Boolean> spRow, I symbol) {
//noinspection SuspiciousMethodCalls
if (!shortPrefixRows.contains(spRow)) {
throw new IllegalArgumentException("Row '" + spRow + "' is not part of short prefix rows!");
}
Word<I> successorLabel = spRow.getLabel().append(symbol);
Row<I, Boolean> successor = null;
for (Row<I, Boolean> row : getAllRows()) {
if (row.getLabel().equals(successorLabel)) {
successor = row;
break;
}
}
return successor;
}
代码示例来源:origin: de.learnlib/learnlib-core
@Override
public final boolean equals(Object o) {
if(o == null)
return false;
if(this == o)
return true;
if(!(o instanceof Query))
return false;
Query<?,?> other = (Query<?,?>)o;
Word<I> thisPref = getPrefix();
Word<I> thisSuff = getSuffix();
Word<?> otherPref = other.getPrefix();
Word<?> otherSuff = other.getSuffix();
if(thisPref != otherPref && !thisPref.equals(otherPref))
return false;
if(thisSuff != otherSuff && !thisSuff.equals(otherSuff))
return false;
return true;
}
代码示例来源:origin: de.learnlib/learnlib-adt
@Override
public boolean refineHypothesis(DefaultQuery<I, Word<O>> ce) {
if (!MQUtil.isCounterexample(ce, this.hypothesis)) {
return false;
}
this.evaluateSubtreeReplacement();
this.openCounterExamples.add(ce);
while (!this.openCounterExamples.isEmpty()) {
// normal refinement step
while (!this.openCounterExamples.isEmpty()) {
final DefaultQuery<I, Word<O>> currentCE = this.openCounterExamples.poll();
this.allCounterExamples.add(currentCE);
while (this.refineHypothesisInternal(currentCE)) {
}
}
// subtree replacements may reactivate old CEs
for (final DefaultQuery<I, Word<O>> oldCE : this.allCounterExamples) {
if (!this.hypothesis.computeOutput(oldCE.getInput()).equals(oldCE.getOutput())) {
this.openCounterExamples.add(oldCE);
}
}
ADTUtil.collectLeaves(this.adt.getRoot()).forEach(this::ensureConsistency);
}
return true;
}
代码示例来源:origin: de.learnlib/learnlib-adt
final Word<O> output = entry.getValue().getSecond();
if (!this.hypothesis.computeSuffixOutput(prefix, input).equals(output)) {
throw new IllegalArgumentException("Output of new ADS does not match hypothesis");
代码示例来源:origin: de.learnlib/learnlib-adt
throw new IllegalArgumentException("Distinguishing suffixes and outputs differ in length");
if (oldOutput.equals(newOutput)) {
throw new IllegalArgumentException("Old and new output are equal");
代码示例来源:origin: de.learnlib/learnlib-adt
throw new IllegalArgumentException("Distinguishing suffixes and outputs differ in length");
if (oldOutput.equals(newOutput)) {
throw new IllegalArgumentException("Old and new output are equal");
代码示例来源:origin: de.learnlib/learnlib-adt
/**
* Ensure that the output behavior of a hypothesis state matches the observed output behavior recorded in the ADT.
* Any differences in output behavior yields new counterexamples.
*
* @param leaf
* the leaf whose hypothesis state should be checked
*/
private void ensureConsistency(final ADTNode<ADTState<I, O>, I, O> leaf) {
final ADTState<I, O> state = leaf.getHypothesisState();
final Word<I> as = state.getAccessSequence();
final Word<O> asOut = this.hypothesis.computeOutput(as);
ADTNode<ADTState<I, O>, I, O> iter = leaf;
while (iter != null) {
final Pair<Word<I>, Word<O>> trace = ADTUtil.buildTraceForNode(iter);
final Word<I> input = trace.getFirst();
final Word<O> output = trace.getSecond();
final Word<O> hypOut = this.hypothesis.computeStateOutput(state, input);
if (!hypOut.equals(output)) {
this.openCounterExamples.add(new DefaultQuery<>(as.concat(input), asOut.concat(output)));
}
iter = ADTUtil.getStartOfADS(iter).getParent();
}
}
代码示例来源:origin: de.learnlib/learnlib-ttt
/**
* Finalize a discriminator. Given a block root and a {@link Splitter}, replace the discriminator at the block root
* by the one derived from the splitter, and update the discrimination tree accordingly.
*
* @param blockRoot
* the block root whose discriminator to finalize
* @param splitter
* the splitter to use for finalization
*/
private void finalizeDiscriminator(AbstractBaseDTNode<I, D> blockRoot, Splitter<I, D> splitter) {
assert blockRoot.isBlockRoot();
notifyPreFinalizeDiscriminator(blockRoot, splitter);
Word<I> succDiscr = splitter.getDiscriminator().prepend(alphabet.getSymbol(splitter.symbolIdx));
if (!blockRoot.getDiscriminator().equals(succDiscr)) {
Word<I> finalDiscriminator = prepareSplit(blockRoot, splitter);
Map<D, AbstractBaseDTNode<I, D>> repChildren = createMap();
for (D label : blockRoot.getSplitData().getLabels()) {
repChildren.put(label, extractSubtree(blockRoot, label));
}
blockRoot.replaceChildren(repChildren);
blockRoot.setDiscriminator(finalDiscriminator);
}
declareFinal(blockRoot);
notifyPostFinalizeDiscriminator(blockRoot, splitter);
}
内容来源于网络,如有侵权,请联系作者删除!