Skip to content

Commit 0e923d8

Browse files
committed
Remove code using a deprecated method
The `getRegisters()` method of `SDT` has been marked deprecated for a long time, but has been kept in the code base as it is used in various tests. This commit makes the method private and removes (unused) code in other classes that was calling this method. This change shuts off two deprecation warnings from the linter.
1 parent 04069ea commit 0e923d8

File tree

3 files changed

+4
-58
lines changed

3 files changed

+4
-58
lines changed

src/main/java/de/learnlib/ralib/oracles/mto/LabeledSDT.java

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
package de.learnlib.ralib.oracles.mto;
22

3-
import java.util.Arrays;
43
import java.util.LinkedHashMap;
54
import java.util.LinkedHashSet;
65
import java.util.Map;
7-
import java.util.Map.Entry;
86
import java.util.Set;
97

108
import de.learnlib.ralib.theory.SDT;
@@ -142,50 +140,4 @@ public static LabeledSDT pruneBranch(LabeledSDT lsdt, int label) {
142140
return new LabeledSDT(lsdt, label);
143141
}
144142

145-
@Override
146-
public String toString() {
147-
StringBuilder sb = new StringBuilder();
148-
String regs = Arrays.toString(sdt.getRegisters().toArray());
149-
sb.append(regs).append("-+\n");
150-
toString(sb, spaces(regs.length()));
151-
return sb.toString();
152-
}
153-
154-
void toString(StringBuilder sb, String indentation) {
155-
if (sdt instanceof SDTLeaf) {
156-
sb.append(indentation).append("[Leaf").append(sdt.isAccepting() ? "+" : "-").append("]").append("\n");
157-
} else {
158-
LabeledSDT idioticSdt = this;
159-
sb.append(indentation).append("[]");
160-
final int childCount = idioticSdt.children.size();
161-
int count = 1;
162-
for (Entry<SDTGuard, LabeledSDT> e : idioticSdt.children.entrySet()) {
163-
SDTGuard g = e.getKey();
164-
String gString = g.toString();
165-
String nextIndent;
166-
if (count == childCount) {
167-
nextIndent = indentation + " ";
168-
} else {
169-
nextIndent = indentation + " | ";
170-
}
171-
172-
if (count > 1) {
173-
sb.append(indentation).append(" +");
174-
}
175-
sb.append("- ").append(e.getValue().label).append(":").append(gString).append("\n");
176-
e.getValue().toString(sb, nextIndent);
177-
178-
count++;
179-
}
180-
}
181-
}
182-
183-
private String spaces(int max) {
184-
StringBuilder sb = new StringBuilder();
185-
for (int i = 0; i < max; i++) {
186-
sb.append(" ");
187-
}
188-
return sb.toString();
189-
}
190-
191143
}

src/main/java/de/learnlib/ralib/theory/SDT.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ public SDT(Map<SDTGuard, SDT> children) {
5151
* @return
5252
*/
5353
// todo: SDTs cannot have registers anymore, this should be data values!
54-
// this method is currently only used in the toString methods of SDTs. Changing
55-
// it will require changing many test cases as the toString methods are used
56-
// to check the correctness of many SDTs.
54+
// This private method is currently only used in the toString method of this
55+
// class. Removing it will require changing many test cases as the toString
56+
// method is used to check the correctness of many SDTs.
5757
@Deprecated
58-
public Set<Register> getRegisters() {
58+
private Set<Register> getRegisters() {
5959
Set<DataValue> temp = new LinkedHashSet<>();
6060
this.getVariables().stream().filter(SDTGuardElement::isDataValue).forEach((x) -> {
6161
temp.add((DataValue) x);

src/main/java/de/learnlib/ralib/theory/SDTLeaf.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525

2626
import de.learnlib.ralib.data.SDTGuardElement;
2727
import de.learnlib.ralib.data.SDTRelabeling;
28-
import de.learnlib.ralib.data.SymbolicDataValue;
2928

3029
/**
3130
* Leaf implementation of an SDT.
@@ -103,11 +102,6 @@ public Map<List<SDTGuard>, Boolean> getAllPaths(List<SDTGuard> path) {
103102
return ret;
104103
}
105104

106-
@Override
107-
public Set<SymbolicDataValue.Register> getRegisters() {
108-
return new LinkedHashSet<>();
109-
}
110-
111105
@Override
112106
public Set<SDTGuardElement> getVariables() {
113107
return new LinkedHashSet<>();

0 commit comments

Comments
 (0)