Skip to content

Commit

Permalink
remove commented out code and uncalled methods
Browse files Browse the repository at this point in the history
  • Loading branch information
FredrikTaquist committed Jun 13, 2024
1 parent b3f7c6a commit 7bc373c
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 644 deletions.
7 changes: 0 additions & 7 deletions src/main/java/de/learnlib/ralib/learning/MeasuringOracle.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,8 @@

public class MeasuringOracle extends MultiTheoryTreeOracle {

// private final TreeOracle oracle;

private final Measurements result;

// public MeasuringOracle(TreeOracle oracle, Measurements m) {
// this.oracle = oracle;
// this.result = m;
// }

public MeasuringOracle(DataWordOracle oracle, Map<DataType, Theory> teachers, Constants constants,
ConstraintSolver solver, Measurements m) {
super(oracle, teachers, constants, solver);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,4 @@ public SuffixValueRestriction restrictSuffixValue(SDTGuard guard, Map<SuffixValu
Theory theory = teachers.get(guard.getParameter().getType());
return theory.restrictSuffixValue(guard, prior);
}

// public boolean sdtPathRevealsRegister(List<SDTGuard> path, SymbolicDataValue[] registers) {
// if (teachers == null)
// return false;
// Set<SymbolicDataValue> revealedRegisters = new LinkedHashSet<>();
// for (SDTGuard guard : path) {
// Theory theory = teachers.get(guard.getParameter().getType());
// for (SymbolicDataValue r : registers) {
// if (theory.guardRevealsRegister(guard, r)) {
// revealedRegisters.add(r);
// }
// }
// }
// return revealedRegisters.size() == registers.length;
// }
}
5 changes: 0 additions & 5 deletions src/main/java/de/learnlib/ralib/theory/SDTAndGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,6 @@ public SDTGuard relabel(VarMapping relabelling) {
return new SDTAndGuard(sv, gg.toArray(new SDTIfGuard[]{}));
}

// @Override
// public Set<SDTGuard> mergeWith(SDTGuard other, List<SymbolicDataValue> regPotential) {
// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
// }

@Override
public SDTAndGuard copy() {
return new SDTAndGuard(this);
Expand Down
85 changes: 1 addition & 84 deletions src/main/java/de/learnlib/ralib/theory/SDTGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ public SuffixValue getParameter() {
}

public SDTGuard(SuffixValue param) {

this.parameter = param;

parameter = param;
}

public abstract Set<SymbolicDataValue> getComparands(SymbolicDataValue dv);
Expand All @@ -60,86 +58,5 @@ public TransitionGuard toTG() {

public abstract SDTGuard relabel(VarMapping relabelling);

// public abstract Set<SDTGuard> mergeWith(SDTGuard other, List<SymbolicDataValue> regPotential);

public abstract SDTGuard copy();

// private Set<SDTGuard> mergeIfWith(SDTIfGuard thisIf, SDTIfGuard otherIf) {
// Set<SDTGuard> ifGuard = new LinkedHashSet<>();
// ifGuard.add(otherIf);
// return mergeIfWith(thisIf, ifGuard);
// }
//
// private Set<SDTGuard> mergeIfWith(SDTIfGuard thisIf, Set<SDTGuard> otherOr) {
//// System.out.println("mergeIfWith Set: thisIf " + thisIf + ", otherOr " + otherOr);
// Set<SDTGuard> otherGuards = new LinkedHashSet<>();
// otherGuards.addAll(otherOr);
// if (otherGuards.contains(thisIf.toDeqGuard())) {
//// System.out.println("contradiction");
// otherGuards.remove(thisIf.toDeqGuard());
// // disequality + equality = true
// if (!((thisIf instanceof EqualityGuard) || thisIf instanceof DisequalityGuard)) {
//// System.out.println("neither is eq or deq");
// otherGuards.add(new DisequalityGuard(
// thisIf.getParameter(), thisIf.getRegister()));
// }
// } else {
// otherGuards.add(thisIf);
// }
//// System.out.println("otherGuards " + otherGuards);
// return otherGuards;
// }
//
// private Set<SDTGuard> mergeIfWith(SDTIfGuard thisIf, SDTAndGuard otherAnd) {
// Set<SDTGuard> ifGuard = new LinkedHashSet<>();
// ifGuard.add(thisIf);
// return mergeAndWith(otherAnd, ifGuard);
// }
//
//// private Set<SDTGuard> mergeAndWith(SDTAndGuard thisAnd, SDTAndGuard otherAnd) {
//// Set<SDTGuard> andGuard = new LinkedHashSet<>();
//// andGuard.add(otherAnd);
//// return mergeAndWith(thisAnd, andGuard);
//// }
////
//// private Set<SDTGuard> mergeAndWith(SDTAndGuard thisAnd, SDTIfGuard otherIf) {
//// return mergeIfWith(otherIf, thisAnd);
//// }
// private Set<SDTGuard> mergeAndWith(SDTAndGuard thisAnd, Set<SDTGuard> _merged) {
// //System.out.println(thisAnd + " merges with " + _merged);
// Set<SDTIfGuard> ifs = new LinkedHashSet<>();
// List<SDTGuard> thisGuards = thisAnd.getGuards();
// Set<SDTGuard> merged = new LinkedHashSet<>();
// merged.addAll(_merged);
// for (SDTGuard x : thisGuards) {
// assert x instanceof SDTIfGuard;
// SDTIfGuard ifX = (SDTIfGuard) x;
// if (merged.contains(ifX.toDeqGuard())) {
// merged.remove(ifX.toDeqGuard());
// if (!((ifX instanceof EqualityGuard) || ifX instanceof DisequalityGuard)) {
// merged.add(new DisequalityGuard(ifX.getParameter(), ifX.getRegister()));
// }
// } else {
// ifs.add(ifX);
// }
// }
// if (ifs.size() == 1) {
// merged.addAll(ifs);
// } else if (ifs.size() > 1) {
// merged.add(new SDTAndGuard(thisAnd.parameter, ifs.toArray(new SDTIfGuard[]{})));
//
// }
// //System.out.println("result: " + merged);
// return merged;
// }

// private Set<SDTGuard> mergeOrWith(SDTOrGuard thisOr, SDTIfGuard otherIf) {
// return mergeIfWith(otherIf, thisOr.guardSet);
// }
//
// private Set<SDTGuard> mergeOrWith(SDTOrGuard thisOr, SDTAndGuard otherAnd) {
// return mergeAndWith(otherAnd, thisOr.guardSet);
// }
//public abstract SDTGuard mergeWith(Set<SDTGuard> others);

}
30 changes: 0 additions & 30 deletions src/main/java/de/learnlib/ralib/theory/SDTOrGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,38 +97,8 @@ public SDTGuard relabel(VarMapping relabelling) {
return new SDTOrGuard(sv, gg.toArray(new SDTGuard[]{}));
}

// @Override
// public Set<SDTGuard> mergeWith(SDTGuard other, List<SymbolicDataValue> regPotential) {
// return other.mergeWith(this, regPotential);
// }

@Override
public SDTOrGuard copy() {
return new SDTOrGuard(this);
}

//@Override
//public SDTGuard mergeWith(Set<SDTGuard> _merged) {
// return null;
//}
// Set<SDTGuard> merged = new LinkedHashSet<>();
// merged.addAll(_merged);
// for (SDTGuard x : this.getGuards()) {
// if (x instanceof SDTIfGuard) {
// SDTGuard newGuard = x.mergeWith(merged);
// }
// }
// if (merged.isEmpty()) {
// return new SDTTrueGuard(this.parameter);
// } else {
// SDTGuard[] mergedArr = merged.toArray(new SDTGuard[]{});
// if (mergedArr.length == 1) {
// return mergedArr[0];
// }
// else {
// return new SDTOrGuard(this.parameter, mergedArr);
// }
//
// }
// }
}
12 changes: 0 additions & 12 deletions src/main/java/de/learnlib/ralib/theory/SDTTrueGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ public int hashCode() {
return hash;
}

// @Override
// public Set<SDTGuard> mergeWith(SDTGuard other, List<SymbolicDataValue> regPotential) {
// throw new IllegalStateException("trying to merge true guard");
// }

@Override
public Set<SymbolicDataValue> getComparands(SymbolicDataValue dv) {
return new LinkedHashSet<>();
Expand All @@ -96,11 +91,4 @@ public Set<SymbolicDataValue> getComparands(SymbolicDataValue dv) {
public SDTTrueGuard copy() {
return new SDTTrueGuard(this);
}


// @Override
// public SDTGuard mergeWith(Set<SDTGuard> _merged) {
// return new SDTOrGuard(this.parameter, _merged.toArray(new SDTGuard[]{}));
//
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import de.learnlib.ralib.automata.guards.GuardExpression;
import de.learnlib.ralib.automata.guards.Relation;
import de.learnlib.ralib.data.SymbolicDataValue;
import de.learnlib.ralib.data.SymbolicDataValue.SuffixValue;
import de.learnlib.ralib.data.VarMapping;
import de.learnlib.ralib.theory.SDTGuard;
import de.learnlib.ralib.theory.SDTIfGuard;
Expand Down Expand Up @@ -55,7 +56,7 @@ public String toString() {

@Override
public GuardExpression toExpr() {
return new AtomicGuardExpression(
return new AtomicGuardExpression<SymbolicDataValue, SuffixValue>(
register, Relation.NOT_EQUALS, parameter);
}

Expand Down Expand Up @@ -104,31 +105,8 @@ public boolean equals(Object obj) {
return Objects.equals(this.parameter, other.parameter);
}

// @Override
// public Set<SDTGuard> mergeWith(SDTGuard other, List<SymbolicDataValue> regPotential) {
// Set<SDTGuard> guards = new LinkedHashSet<>();
// if (other instanceof EqualityGuard) {
// if (!(other.equals(this.toDeqGuard()))) {
// guards.add(this);
// guards.add(other);
// }
// }
// else if (other instanceof DisequalityGuard) {
// guards.add(this);
// guards.add(other);
// }
// else {
//// System.out.println("attempt to merge " + this + " with " + other);
// guards.addAll(other.mergeWith(this, regPotential));
//
// }
// return guards;
// }

@Override
public SDTGuard copy() {
return new DisequalityGuard(this);
}


}
25 changes: 0 additions & 25 deletions src/main/java/de/learnlib/ralib/theory/equality/EqualityGuard.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,31 +103,6 @@ public GuardExpression toExpr() {
Relation.EQUALS, parameter);
}

// @Override
// public Set<SDTGuard> mergeWith(SDTGuard other, List<SymbolicDataValue> regPotential) {
// Set<SDTGuard> guards = new LinkedHashSet<>();
// if (other instanceof DisequalityGuard) {
// if (!(other.equals(this.toDeqGuard()))) {
// guards.add(this);
// guards.add(other);
// }
// } else if (other instanceof EqualityGuard) {
// if (!(this.equals(other))) {
// guards.add(other);
// }
// guards.add(this);
// } else if (other instanceof SDTOrGuard) {
// for (SDTGuard s : ((SDTOrGuard)other).getGuards()) {
// guards.addAll(this.mergeWith(s, regPotential));
// }
// }else {
// //System.out.println("attempt to merge " + this + " with " + other);
// guards.addAll(other.mergeWith(this, regPotential));
//
// }
// return guards;
// }

@Override
public EqualityGuard copy() {
return new EqualityGuard(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,20 +455,4 @@ public SuffixValueRestriction restrictSuffixValue(SDTGuard guard, Map<SuffixValu
// for now, use generic restrictions with equality theory
return SuffixValueRestriction.genericRestriction(guard, prior);
}

// @Override
// public boolean guardRevealsRegister(SDTGuard guard, SymbolicDataValue register) {
// if (guard instanceof EqualityGuard && ((EqualityGuard) guard).getRegister().equals(register)) {
// return true;
// } else if (guard instanceof DisequalityGuard && ((DisequalityGuard)guard).getRegister().equals(register)) {
// return true;
// } else if (guard instanceof SDTMultiGuard) {
// boolean revealsGuard = false;
// for (SDTGuard g : ((SDTMultiGuard)guard).getGuards()) {
// revealsGuard = revealsGuard || this.guardRevealsRegister(g, register);
// }
// return revealsGuard;
// }
// return false;
// }
}
Loading

0 comments on commit 7bc373c

Please sign in to comment.