Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tlatools
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tlatools
Commits
f7a03673
Commit
f7a03673
authored
Jul 24, 2024
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Weaken some collection types in our code
parent
873d2284
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tlatools/org.lamport.tlatools/src/tlc2/output/OutputCollector.java
+12
-11
12 additions, 11 deletions
...org.lamport.tlatools/src/tlc2/output/OutputCollector.java
tlatools/org.lamport.tlatools/src/tlc2/tool/TLCTrace.java
+3
-2
3 additions, 2 deletions
tlatools/org.lamport.tlatools/src/tlc2/tool/TLCTrace.java
with
15 additions
and
13 deletions
tlatools/org.lamport.tlatools/src/tlc2/output/OutputCollector.java
+
12
−
11
View file @
f7a03673
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
...
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
tla2sany.semantic.ExprNode
;
import
tla2sany.semantic.ExprNode
;
...
@@ -16,23 +17,23 @@ import tlc2.tool.TLCStateInfo;
...
@@ -16,23 +17,23 @@ import tlc2.tool.TLCStateInfo;
public
class
OutputCollector
{
public
class
OutputCollector
{
private
static
TLCState
initialState
=
null
;
private
static
TLCState
initialState
=
null
;
private
static
Array
List
<
TLCStateInfo
>
trace
=
null
;
private
static
List
<
TLCStateInfo
>
trace
=
null
;
private
static
Array
List
<
Message
>
allMessages
=
new
ArrayList
<
Message
>();
private
static
List
<
Message
>
allMessages
=
new
ArrayList
<>();
private
static
Map
<
Location
,
Long
>
lineCount
=
new
HashMap
<>();
private
static
Map
<
Location
,
Long
>
lineCount
=
new
HashMap
<>();
private
static
ModuleNode
moduleNode
=
null
;
private
static
ModuleNode
moduleNode
=
null
;
private
static
Array
List
<
ExprNode
>
violatedAssumptions
=
new
ArrayList
<>();
private
static
List
<
ExprNode
>
violatedAssumptions
=
new
ArrayList
<>();
public
static
Array
List
<
TLCStateInfo
>
getTrace
()
{
public
static
List
<
TLCStateInfo
>
getTrace
()
{
return
trace
;
return
Collections
.
unmodifiableList
(
trace
)
;
}
}
public
static
void
setTrace
(
Array
List
<
TLCStateInfo
>
trace
)
{
public
static
void
setTrace
(
List
<
TLCStateInfo
>
trace
)
{
OutputCollector
.
trace
=
trace
;
OutputCollector
.
trace
=
trace
;
}
}
public
static
void
addStateToTrace
(
TLCStateInfo
tlcStateInfo
)
{
public
static
void
addStateToTrace
(
TLCStateInfo
tlcStateInfo
)
{
if
(
trace
==
null
)
{
if
(
trace
==
null
)
{
trace
=
new
ArrayList
<
TLCStateInfo
>();
trace
=
new
ArrayList
<>();
}
}
trace
.
add
(
tlcStateInfo
);
trace
.
add
(
tlcStateInfo
);
}
}
...
@@ -45,16 +46,16 @@ public class OutputCollector {
...
@@ -45,16 +46,16 @@ public class OutputCollector {
return
OutputCollector
.
initialState
;
return
OutputCollector
.
initialState
;
}
}
public
static
Array
List
<
Message
>
getAllMessages
()
{
public
static
List
<
Message
>
getAllMessages
()
{
return
allMessages
;
return
Collections
.
unmodifiableList
(
allMessages
)
;
}
}
public
static
void
addViolatedAssumption
(
ExprNode
assumption
)
{
public
static
void
addViolatedAssumption
(
ExprNode
assumption
)
{
violatedAssumptions
.
add
(
assumption
);
violatedAssumptions
.
add
(
assumption
);
}
}
public
static
Array
List
<
ExprNode
>
getViolatedAssumptions
()
{
public
static
List
<
ExprNode
>
getViolatedAssumptions
()
{
return
violatedAssumptions
;
return
Collections
.
unmodifiableList
(
violatedAssumptions
)
;
}
}
public
synchronized
static
void
saveMessage
(
int
messageClass
,
public
synchronized
static
void
saveMessage
(
int
messageClass
,
...
...
This diff is collapsed.
Click to expand it.
tlatools/org.lamport.tlatools/src/tlc2/tool/TLCTrace.java
+
3
−
2
View file @
f7a03673
...
@@ -11,8 +11,8 @@ import java.io.DataOutputStream;
...
@@ -11,8 +11,8 @@ import java.io.DataOutputStream;
import
java.io.File
;
import
java.io.File
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
tlc2.output.EC
;
import
tlc2.output.EC
;
...
@@ -22,6 +22,7 @@ import tlc2.output.StatePrinter;
...
@@ -22,6 +22,7 @@ import tlc2.output.StatePrinter;
import
tlc2.util.BufferedRandomAccessFile
;
import
tlc2.util.BufferedRandomAccessFile
;
import
tlc2.util.LongVec
;
import
tlc2.util.LongVec
;
import
tlc2.value.RandomEnumerableValues
;
import
tlc2.value.RandomEnumerableValues
;
import
util.FileUtil
;
import
util.FileUtil
;
public
class
TLCTrace
{
public
class
TLCTrace
{
...
@@ -343,7 +344,7 @@ public class TLCTrace {
...
@@ -343,7 +344,7 @@ public class TLCTrace {
protected
synchronized
final
void
printTrace
(
final
TLCState
s1
,
final
TLCState
s2
,
final
TLCStateInfo
[]
prefix
)
protected
synchronized
final
void
printTrace
(
final
TLCState
s1
,
final
TLCState
s2
,
final
TLCStateInfo
[]
prefix
)
throws
IOException
,
WorkerException
{
throws
IOException
,
WorkerException
{
Array
List
<
TLCStateInfo
>
trace
=
new
ArrayList
<
TLCStateInfo
>();
// collecting the whole error trace
List
<
TLCStateInfo
>
trace
=
new
ArrayList
<>();
// collecting the whole error trace
if
(
s1
.
isInitial
())
{
if
(
s1
.
isInitial
())
{
// Do not recreate the potentially expensive error trace - e.g. when the set of
// Do not recreate the potentially expensive error trace - e.g. when the set of
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment