de.learnlib.algorithms.adt.model.ReplacementResult Maven / Gradle / Ivy
/* Copyright (C) 2013-2018 TU Dortmund
* This file is part of LearnLib, http://www.learnlib.de/.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package de.learnlib.algorithms.adt.model;
import java.util.Collections;
import java.util.Set;
import javax.annotation.ParametersAreNonnullByDefault;
import de.learnlib.algorithms.adt.adt.ADT;
import de.learnlib.algorithms.adt.adt.ADTNode;
import de.learnlib.algorithms.adt.api.SubtreeReplacer;
/**
* A class that describes the possible result a {@link SubtreeReplacer} can return. A replacement may either be
* - a complete replacement
- a partial replacement, that additionally defines which hypothesis states are
* not covered by the replacement
*
* @param
* (hypothesis) state type
* @param
* input alphabet type
* @param
* output alphabet type
*
* @author frohme
*/
@ParametersAreNonnullByDefault
public class ReplacementResult {
private final ADTNode nodeToReplace, replacement;
private final Set cutoutNodes;
public ReplacementResult(final ADTNode nodeToReplace, final ADTNode replacement) {
this(nodeToReplace, replacement, Collections.emptySet());
}
public ReplacementResult(final ADTNode nodeToReplace,
final ADTNode replacement,
final Set cutoutNodes) {
this.nodeToReplace = nodeToReplace;
this.replacement = replacement;
this.cutoutNodes = cutoutNodes;
}
/**
* The {@link ADT} subtree (root-node) that forms the replacement.
*
* @return the replacement
*/
public ADTNode getReplacement() {
return replacement;
}
/**
* The {@link ADT} subtree (root-node) that should be replaced.
*
* @return the node to replace
*/
public ADTNode getNodeToReplace() {
return nodeToReplace;
}
/**
* The set of hypothesis states that are not covered on the proposed replacement.
*
* @return the set
*/
public Set getCutoutNodes() {
return cutoutNodes;
}
}