Skip to content

Commit 3b137df

Browse files
committed
Adapting to code style checks
1 parent 7474c0b commit 3b137df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+924
-821
lines changed

lisa/src/main/java/it/unive/lisa/LiSA.java

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
package it.unive.lisa;
22

3-
import java.util.ArrayList;
4-
import java.util.Collection;
5-
import java.util.Collections;
6-
import java.util.concurrent.ConcurrentHashMap;
7-
8-
import org.apache.logging.log4j.LogManager;
9-
import org.apache.logging.log4j.Logger;
10-
113
import it.unive.lisa.cfg.CFG;
124
import it.unive.lisa.checks.CheckTool;
135
import it.unive.lisa.checks.syntactic.SyntacticCheck;
146
import it.unive.lisa.checks.syntactic.SyntacticChecksExecutor;
157
import it.unive.lisa.checks.warnings.Warning;
168
import it.unive.lisa.logging.TimerLogger;
9+
import java.util.ArrayList;
10+
import java.util.Collection;
11+
import java.util.Collections;
12+
import java.util.concurrent.ConcurrentHashMap;
13+
import org.apache.logging.log4j.LogManager;
14+
import org.apache.logging.log4j.Logger;
1715

1816
/**
1917
* This is the central class of the LiSA library. While LiSA's functionalities
@@ -24,8 +22,8 @@
2422
* @author <a href="mailto:[email protected]">Luca Negrini</a>
2523
*/
2624
public class LiSA {
27-
28-
private static final Logger log = LogManager.getLogger(LiSA.class);
25+
26+
private static final Logger log = LogManager.getLogger(LiSA.class);
2927

3028
/**
3129
* The collection of CFG instances that are to be analyzed
@@ -38,8 +36,8 @@ public class LiSA {
3836
private final Collection<SyntacticCheck> syntacticChecks;
3937

4038
/**
41-
* The collection of warnings that will be filled with the results of all the
42-
* executed checks
39+
* The collection of warnings that will be filled with the results of all
40+
* the executed checks
4341
*/
4442
private final Collection<Warning> warnings;
4543

@@ -49,7 +47,8 @@ public class LiSA {
4947
public LiSA() {
5048
this.inputs = Collections.newSetFromMap(new ConcurrentHashMap<>());
5149
this.syntacticChecks = Collections.newSetFromMap(new ConcurrentHashMap<>());
52-
// since the warnings collection will be filled AFTER the execution of every
50+
// since the warnings collection will be filled AFTER the execution of
51+
// every
5352
// concurrent bit has completed its execution, it is fine to use a non
5453
// thread-safe one
5554
this.warnings = new ArrayList<>();
@@ -101,7 +100,7 @@ public void run() {
101100
TimerLogger.execAction(log, "Analysis time", () -> runAux());
102101
printStats();
103102
}
104-
103+
105104
private void printConfig() {
106105
log.info("LiSA setup:");
107106
log.info(" " + inputs.size() + " CFGs to analyze");
@@ -120,9 +119,9 @@ private void runAux() {
120119
}
121120

122121
/**
123-
* Yields an unmodifiable view of the warnings that have been generated during
124-
* the analysis. Invoking this method before invoking {@link #run()} will return
125-
* an empty collection.
122+
* Yields an unmodifiable view of the warnings that have been generated
123+
* during the analysis. Invoking this method before invoking {@link #run()}
124+
* will return an empty collection.
126125
*
127126
* @return a view of the generated warnings
128127
*/

lisa/src/main/java/it/unive/lisa/cfg/AdjacencyMatrix.java

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
package it.unive.lisa.cfg;
22

3+
import it.unive.lisa.cfg.edge.Edge;
4+
import it.unive.lisa.cfg.edge.FalseEdge;
5+
import it.unive.lisa.cfg.edge.SequentialEdge;
6+
import it.unive.lisa.cfg.edge.TrueEdge;
7+
import it.unive.lisa.cfg.statement.NoOp;
8+
import it.unive.lisa.cfg.statement.Statement;
9+
import it.unive.lisa.util.collections.ExternalSet;
10+
import it.unive.lisa.util.collections.ExternalSetCache;
311
import java.util.Collection;
412
import java.util.HashSet;
513
import java.util.Iterator;
@@ -9,19 +17,9 @@
917
import java.util.concurrent.ConcurrentHashMap;
1018
import java.util.stream.Collectors;
1119
import java.util.stream.Stream;
12-
1320
import org.apache.commons.lang3.StringUtils;
1421
import org.apache.commons.lang3.tuple.Pair;
1522

16-
import it.unive.lisa.cfg.edge.Edge;
17-
import it.unive.lisa.cfg.edge.FalseEdge;
18-
import it.unive.lisa.cfg.edge.SequentialEdge;
19-
import it.unive.lisa.cfg.edge.TrueEdge;
20-
import it.unive.lisa.cfg.statement.NoOp;
21-
import it.unive.lisa.cfg.statement.Statement;
22-
import it.unive.lisa.util.collections.ExternalSet;
23-
import it.unive.lisa.util.collections.ExternalSetCache;
24-
2523
/**
2624
* An adjacency matrix for a graph that has {@link Statement}s as nodes and
2725
* {@link Edge}s as edges. It is represented as a map between a statement and a
@@ -54,8 +52,9 @@ public AdjacencyMatrix() {
5452
}
5553

5654
/**
57-
* Copies the given matrix by keeping the same edge {@link ExternalSetCache},
58-
* shallow-copying the {@link Statement}s and deep-copying the values.
55+
* Copies the given matrix by keeping the same edge
56+
* {@link ExternalSetCache}, shallow-copying the {@link Statement}s and
57+
* deep-copying the values.
5958
*
6059
* @param other the matrix to copy
6160
*/
@@ -85,11 +84,13 @@ public final Collection<Statement> getNodes() {
8584
}
8685

8786
/**
88-
* Adds an edge to this matrix
87+
* Adds an edge to this matrix.
8988
*
9089
* @param e the edge to add
91-
* @throws UnsupportedOperationException if the source or the destination of the
92-
* given edge are not part of this matrix
90+
*
91+
* @throws UnsupportedOperationException if the source or the destination of
92+
* the given edge are not part of
93+
* this matrix
9394
*/
9495
public void addEdge(Edge e) {
9596
if (!matrix.containsKey(e.getSource()))
@@ -104,13 +105,14 @@ public void addEdge(Edge e) {
104105

105106
/**
106107
* Yields the edge connecting the two given statements, if any. Yields
107-
* {@code null} if such edge does not exist, or if one of the two statements is
108-
* not inside this matrix.
108+
* {@code null} if such edge does not exist, or if one of the two statements
109+
* is not inside this matrix.
109110
*
110111
* @param source the source statement
111112
* @param destination the destination statement
113+
*
112114
* @return the edge connecting {@code source} to {@code destination}, or
113-
* {@code null}
115+
* {@code null}
114116
*/
115117
public final Edge getEdgeConnecting(Statement source, Statement destination) {
116118
if (!matrix.containsKey(source))
@@ -135,12 +137,13 @@ public final Collection<Edge> getEdges() {
135137
}
136138

137139
/**
138-
* Yields the collection of the nodes that are followers of the given one, that
139-
* is, all nodes such that there exist an edge in this matrix going from the
140-
* given node to such node. Yields {@code null} if the node is not in this
141-
* matrix.
140+
* Yields the collection of the nodes that are followers of the given one,
141+
* that is, all nodes such that there exist an edge in this matrix going
142+
* from the given node to such node. Yields {@code null} if the node is not
143+
* in this matrix.
142144
*
143145
* @param node the node
146+
*
144147
* @return the collection of followers
145148
*/
146149
public final Collection<Statement> followersOf(Statement node) {
@@ -151,12 +154,13 @@ public final Collection<Statement> followersOf(Statement node) {
151154
}
152155

153156
/**
154-
* Yields the collection of the nodes that are predecessors of the given vertex,
155-
* that is, all nodes such that there exist an edge in this matrix going from
156-
* such node to the given one. Yields {@code null} if the node is not in this
157-
* matrix.
157+
* Yields the collection of the nodes that are predecessors of the given
158+
* vertex, that is, all nodes such that there exist an edge in this matrix
159+
* going from such node to the given one. Yields {@code null} if the node is
160+
* not in this matrix.
158161
*
159162
* @param node the node
163+
*
160164
* @return the collection of predecessors
161165
*/
162166
public final Collection<Statement> predecessorsOf(Statement node) {
@@ -167,17 +171,18 @@ public final Collection<Statement> predecessorsOf(Statement node) {
167171
}
168172

169173
/**
170-
* Simplifies this matrix, removing all {@link NoOp}s and rewriting the edge set
171-
* accordingly. This method will throw an {@link UnsupportedOperationException}
172-
* if one of the {@link NoOp}s has an outgoing edge that is not a
173-
* {@link SequentialEdge}, since such statement is expected to always be
174-
* sequential.
174+
* Simplifies this matrix, removing all {@link NoOp}s and rewriting the edge
175+
* set accordingly. This method will throw an
176+
* {@link UnsupportedOperationException} if one of the {@link NoOp}s has an
177+
* outgoing edge that is not a {@link SequentialEdge}, since such statement
178+
* is expected to always be sequential.
175179
*
176180
* @throws UnsupportedOperationException if there exists at least one
177-
* {@link NoOp} with an outgoing
178-
* non-sequential edge, or if one of the
179-
* ingoing edges to the {@link NoOp} is
180-
* not currently supported.
181+
* {@link NoOp} with an outgoing
182+
* non-sequential edge, or if one
183+
* of the ingoing edges to the
184+
* {@link NoOp} is not currently
185+
* supported.
181186
*/
182187
public synchronized void simplify() {
183188
Set<Statement> noops = matrix.keySet().stream().filter(k -> k instanceof NoOp).collect(Collectors.toSet());
@@ -239,11 +244,13 @@ public boolean equals(Object obj) {
239244
}
240245

241246
/**
242-
* Checks if this matrix is effectively equal to the given one, that is, if they
243-
* have the same structure while potentially being different instances.
247+
* Checks if this matrix is effectively equal to the given one, that is, if
248+
* they have the same structure while potentially being different instances.
244249
*
245250
* @param other the other matrix
246-
* @return {@code true} if this matrix and the given one are effectively equals
251+
*
252+
* @return {@code true} if this matrix and the given one are effectively
253+
* equals
247254
*/
248255
public boolean isEqualTo(AdjacencyMatrix other) {
249256
if (this == other)

0 commit comments

Comments
 (0)