Skip to content
Snippets Groups Projects
Commit 317157b7 authored by dgelessus's avatar dgelessus
Browse files

Weaken some collection types

parent 04cebe7b
No related branches found
No related tags found
No related merge requests found
Pipeline #139805 failed
...@@ -14,8 +14,8 @@ public class Log { ...@@ -14,8 +14,8 @@ public class Log {
public static final String DELIMITER = ";"; public static final String DELIMITER = ";";
private final ArrayList<String> fieldNames = new ArrayList<>(); private final List<String> fieldNames = new ArrayList<>();
private final ArrayList<String> fieldValues = new ArrayList<>(); private final List<String> fieldValues = new ArrayList<>();
public Log(TLC4B tlc4b, TLCResults tlcResults) { public Log(TLC4B tlc4b, TLCResults tlcResults) {
fieldNames.add("Machine File"); fieldNames.add("Machine File");
......
...@@ -11,7 +11,7 @@ import java.io.InputStream; ...@@ -11,7 +11,7 @@ import java.io.InputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.util.LinkedHashMap; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.*; import java.util.concurrent.*;
...@@ -175,7 +175,7 @@ public class TLC4B { ...@@ -175,7 +175,7 @@ public class TLC4B {
} }
private void printOperationsCount(TLCResults results) { private void printOperationsCount(TLCResults results) {
LinkedHashMap<String, Long> operationCount = results.getOperationCount(); Map<String, Long> operationCount = results.getOperationCount();
if (TLC4BGlobals.isPrintCoverage() && operationCount != null) { if (TLC4BGlobals.isPrintCoverage() && operationCount != null) {
printlnSilent("---------- Coverage statistics ----------"); printlnSilent("---------- Coverage statistics ----------");
for (Entry<String, Long> entry : operationCount.entrySet()) { for (Entry<String, Long> entry : operationCount.entrySet()) {
......
...@@ -24,8 +24,8 @@ public class TLCResults implements ToolGlobals { ...@@ -24,8 +24,8 @@ public class TLCResults implements ToolGlobals {
private String violatedDefinition, tlcErrorMessage; private String violatedDefinition, tlcErrorMessage;
private Date startTime; private Date startTime;
private Date endTime; private Date endTime;
private LinkedHashMap<String, Long> operationsCount; private Map<String, Long> operationsCount;
private final ArrayList<String> violatedAssertions = new ArrayList<>(); private final List<String> violatedAssertions = new ArrayList<>();
private int lengthOfTrace; private int lengthOfTrace;
private String traceString, traceFile; private String traceString, traceFile;
...@@ -55,7 +55,7 @@ public class TLCResults implements ToolGlobals { ...@@ -55,7 +55,7 @@ public class TLCResults implements ToolGlobals {
} }
} }
public LinkedHashMap<String, Long> getOperationCount() { public Map<String, Long> getOperationCount() {
return operationsCount; return operationsCount;
} }
...@@ -76,7 +76,7 @@ public class TLCResults implements ToolGlobals { ...@@ -76,7 +76,7 @@ public class TLCResults implements ToolGlobals {
return violatedDefinition; return violatedDefinition;
} }
public ArrayList<String> getViolatedAssertions() { public List<String> getViolatedAssertions() {
return this.violatedAssertions; return this.violatedAssertions;
} }
...@@ -120,7 +120,7 @@ public class TLCResults implements ToolGlobals { ...@@ -120,7 +120,7 @@ public class TLCResults implements ToolGlobals {
lineCount.put(endline, entry.getValue()); lineCount.put(endline, entry.getValue());
} }
} }
ArrayList<OpDefNode> defs = getActionsFromGeneratedModule(OutputCollector.getModuleNode()); List<OpDefNode> defs = getActionsFromGeneratedModule(OutputCollector.getModuleNode());
operationsCount = new LinkedHashMap<>(); operationsCount = new LinkedHashMap<>();
for (OpDefNode opDefNode : defs) { for (OpDefNode opDefNode : defs) {
String operationName = opDefNode.getName().toString(); String operationName = opDefNode.getName().toString();
...@@ -132,9 +132,9 @@ public class TLCResults implements ToolGlobals { ...@@ -132,9 +132,9 @@ public class TLCResults implements ToolGlobals {
} }
} }
private ArrayList<OpDefNode> getActionsFromGeneratedModule(ModuleNode moduleNode) { private List<OpDefNode> getActionsFromGeneratedModule(ModuleNode moduleNode) {
// list of actions in the module // list of actions in the module
ArrayList<OpDefNode> actions = new ArrayList<>(); List<OpDefNode> actions = new ArrayList<>();
// get all definitions from the module // get all definitions from the module
OpDefNode[] opDefs = moduleNode.getOpDefs(); OpDefNode[] opDefs = moduleNode.getOpDefs();
...@@ -178,7 +178,7 @@ public class TLCResults implements ToolGlobals { ...@@ -178,7 +178,7 @@ public class TLCResults implements ToolGlobals {
} }
private void evalTrace() { private void evalTrace() {
ArrayList<TLCStateInfo> trace = OutputCollector.getTrace(); List<TLCStateInfo> trace = OutputCollector.getTrace();
TracePrinter printer = null; TracePrinter printer = null;
if (trace != null) { if (trace != null) {
printer = new TracePrinter(trace, tlcOutputInfo); printer = new TracePrinter(trace, tlcOutputInfo);
...@@ -192,7 +192,7 @@ public class TLCResults implements ToolGlobals { ...@@ -192,7 +192,7 @@ public class TLCResults implements ToolGlobals {
private void evalAllMessages() { private void evalAllMessages() {
ArrayList<Message> messages = new ArrayList<>(OutputCollector.getAllMessages()); List<Message> messages = new ArrayList<>(OutputCollector.getAllMessages());
for (Message m : messages) { for (Message m : messages) {
switch (m.getMessageClass()) { switch (m.getMessageClass()) {
case ERROR: case ERROR:
...@@ -281,8 +281,7 @@ public class TLCResults implements ToolGlobals { ...@@ -281,8 +281,7 @@ public class TLCResults implements ToolGlobals {
case EC.TLC_ASSUMPTION_FALSE: case EC.TLC_ASSUMPTION_FALSE:
// get the violated assumption expr from the OutputCollector // get the violated assumption expr from the OutputCollector
ArrayList<ExprNode> violatedAssumptions = OutputCollector List<ExprNode> violatedAssumptions = OutputCollector.getViolatedAssumptions();
.getViolatedAssumptions();
if (!violatedAssumptions.isEmpty()) { if (!violatedAssumptions.isEmpty()) {
// try to find the assume node contain the expr in order to get // try to find the assume node contain the expr in order to get
// the name of the assumption // the name of the assumption
......
package de.tlc4b.tlc; package de.tlc4b.tlc;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import de.tlc4b.btypes.BType; import de.tlc4b.btypes.BType;
import de.tlc4b.btypes.FunctionType; import de.tlc4b.btypes.FunctionType;
...@@ -17,16 +18,16 @@ import static tlc2.value.ValueConstants.*; ...@@ -17,16 +18,16 @@ import static tlc2.value.ValueConstants.*;
public class TracePrinter { public class TracePrinter {
ArrayList<TLCStateInfo> trace; List<TLCStateInfo> trace;
TLCState initialState; TLCState initialState;
final TLCOutputInfo tlcOutputInfo; final TLCOutputInfo tlcOutputInfo;
ArrayList<OpDeclNode> constants; List<OpDeclNode> constants;
ArrayList<OpDeclNode> variables; List<OpDeclNode> variables;
StringBuilder traceBuilder; StringBuilder traceBuilder;
public TracePrinter(ArrayList<TLCStateInfo> trace, TLCOutputInfo tlcOutputInfo) { public TracePrinter(List<TLCStateInfo> trace, TLCOutputInfo tlcOutputInfo) {
this.trace = trace; this.trace = trace;
this.tlcOutputInfo = tlcOutputInfo; this.tlcOutputInfo = tlcOutputInfo;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment