diff --git a/src/main/java/de/tlc4b/Log.java b/src/main/java/de/tlc4b/Log.java index 6da1a162f13aff465e058c04f81979ae9e2e9f08..721b8a4badaad7d12d1aa1cfe8e920b9708e63fb 100644 --- a/src/main/java/de/tlc4b/Log.java +++ b/src/main/java/de/tlc4b/Log.java @@ -14,8 +14,8 @@ public class Log { public static final String DELIMITER = ";"; - private final ArrayList<String> fieldNames = new ArrayList<>(); - private final ArrayList<String> fieldValues = new ArrayList<>(); + private final List<String> fieldNames = new ArrayList<>(); + private final List<String> fieldValues = new ArrayList<>(); public Log(TLC4B tlc4b, TLCResults tlcResults) { fieldNames.add("Machine File"); diff --git a/src/main/java/de/tlc4b/TLC4B.java b/src/main/java/de/tlc4b/TLC4B.java index fcfd24d506f48b30bab29b4d02dcd1acb78072ee..3457114309b4b670903a02d58fae52b03500fe58 100644 --- a/src/main/java/de/tlc4b/TLC4B.java +++ b/src/main/java/de/tlc4b/TLC4B.java @@ -11,7 +11,7 @@ import java.io.InputStream; import java.io.OutputStreamWriter; import java.nio.charset.StandardCharsets; import java.nio.file.Files; -import java.util.LinkedHashMap; +import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.*; @@ -175,7 +175,7 @@ public class TLC4B { } private void printOperationsCount(TLCResults results) { - LinkedHashMap<String, Long> operationCount = results.getOperationCount(); + Map<String, Long> operationCount = results.getOperationCount(); if (TLC4BGlobals.isPrintCoverage() && operationCount != null) { printlnSilent("---------- Coverage statistics ----------"); for (Entry<String, Long> entry : operationCount.entrySet()) { diff --git a/src/main/java/de/tlc4b/tlc/TLCResults.java b/src/main/java/de/tlc4b/tlc/TLCResults.java index 7ec7edc8ca0400f25646fe692da28f507c119da0..4478de64c4b55bb2b33ab9df1d4bba14bf29c891 100644 --- a/src/main/java/de/tlc4b/tlc/TLCResults.java +++ b/src/main/java/de/tlc4b/tlc/TLCResults.java @@ -24,8 +24,8 @@ public class TLCResults implements ToolGlobals { private String violatedDefinition, tlcErrorMessage; private Date startTime; private Date endTime; - private LinkedHashMap<String, Long> operationsCount; - private final ArrayList<String> violatedAssertions = new ArrayList<>(); + private Map<String, Long> operationsCount; + private final List<String> violatedAssertions = new ArrayList<>(); private int lengthOfTrace; private String traceString, traceFile; @@ -55,7 +55,7 @@ public class TLCResults implements ToolGlobals { } } - public LinkedHashMap<String, Long> getOperationCount() { + public Map<String, Long> getOperationCount() { return operationsCount; } @@ -76,7 +76,7 @@ public class TLCResults implements ToolGlobals { return violatedDefinition; } - public ArrayList<String> getViolatedAssertions() { + public List<String> getViolatedAssertions() { return this.violatedAssertions; } @@ -120,7 +120,7 @@ public class TLCResults implements ToolGlobals { lineCount.put(endline, entry.getValue()); } } - ArrayList<OpDefNode> defs = getActionsFromGeneratedModule(OutputCollector.getModuleNode()); + List<OpDefNode> defs = getActionsFromGeneratedModule(OutputCollector.getModuleNode()); operationsCount = new LinkedHashMap<>(); for (OpDefNode opDefNode : defs) { String operationName = opDefNode.getName().toString(); @@ -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 - ArrayList<OpDefNode> actions = new ArrayList<>(); + List<OpDefNode> actions = new ArrayList<>(); // get all definitions from the module OpDefNode[] opDefs = moduleNode.getOpDefs(); @@ -178,7 +178,7 @@ public class TLCResults implements ToolGlobals { } private void evalTrace() { - ArrayList<TLCStateInfo> trace = OutputCollector.getTrace(); + List<TLCStateInfo> trace = OutputCollector.getTrace(); TracePrinter printer = null; if (trace != null) { printer = new TracePrinter(trace, tlcOutputInfo); @@ -192,7 +192,7 @@ public class TLCResults implements ToolGlobals { private void evalAllMessages() { - ArrayList<Message> messages = new ArrayList<>(OutputCollector.getAllMessages()); + List<Message> messages = new ArrayList<>(OutputCollector.getAllMessages()); for (Message m : messages) { switch (m.getMessageClass()) { case ERROR: @@ -281,8 +281,7 @@ public class TLCResults implements ToolGlobals { case EC.TLC_ASSUMPTION_FALSE: // get the violated assumption expr from the OutputCollector - ArrayList<ExprNode> violatedAssumptions = OutputCollector - .getViolatedAssumptions(); + List<ExprNode> violatedAssumptions = OutputCollector.getViolatedAssumptions(); if (!violatedAssumptions.isEmpty()) { // try to find the assume node contain the expr in order to get // the name of the assumption diff --git a/src/main/java/de/tlc4b/tlc/TracePrinter.java b/src/main/java/de/tlc4b/tlc/TracePrinter.java index eed6adb2f8b42aaba8f04136e81261870164801d..c3dcfb943f86e3a099432b170a30237830e5f417 100644 --- a/src/main/java/de/tlc4b/tlc/TracePrinter.java +++ b/src/main/java/de/tlc4b/tlc/TracePrinter.java @@ -1,6 +1,7 @@ package de.tlc4b.tlc; import java.util.ArrayList; +import java.util.List; import de.tlc4b.btypes.BType; import de.tlc4b.btypes.FunctionType; @@ -17,16 +18,16 @@ import static tlc2.value.ValueConstants.*; public class TracePrinter { - ArrayList<TLCStateInfo> trace; + List<TLCStateInfo> trace; TLCState initialState; final TLCOutputInfo tlcOutputInfo; - ArrayList<OpDeclNode> constants; - ArrayList<OpDeclNode> variables; + List<OpDeclNode> constants; + List<OpDeclNode> variables; StringBuilder traceBuilder; - public TracePrinter(ArrayList<TLCStateInfo> trace, TLCOutputInfo tlcOutputInfo) { + public TracePrinter(List<TLCStateInfo> trace, TLCOutputInfo tlcOutputInfo) { this.trace = trace; this.tlcOutputInfo = tlcOutputInfo;