gr.uom.java.xmi.decomposition.replacement.SplitVariableReplacement Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of refactoring-miner Show documentation
Show all versions of refactoring-miner Show documentation
RefactoringMiner is a library/API written in Java that can detect refactorings applied in the history of a Java project.
package gr.uom.java.xmi.decomposition.replacement;
import java.util.LinkedHashSet;
import java.util.Set;
public class SplitVariableReplacement extends Replacement {
private Set splitVariables;
public SplitVariableReplacement(String oldVariable, Set newVariables) {
super(oldVariable, newVariables.toString(), ReplacementType.SPLIT_VARIABLE);
this.splitVariables = newVariables;
}
public Set getSplitVariables() {
return splitVariables;
}
public boolean equal(SplitVariableReplacement other) {
return this.getBefore().equals(other.getBefore()) &&
this.splitVariables.containsAll(other.splitVariables) &&
other.splitVariables.containsAll(this.splitVariables);
}
public boolean commonBefore(SplitVariableReplacement other) {
Set interestion = new LinkedHashSet(this.splitVariables);
interestion.retainAll(other.splitVariables);
return this.getBefore().equals(other.getBefore()) && interestion.size() == 0;
}
public boolean subsumes(SplitVariableReplacement other) {
return this.getBefore().equals(other.getBefore()) &&
this.splitVariables.containsAll(other.splitVariables) &&
this.splitVariables.size() > other.splitVariables.size();
}
}