Skip to content

Commit a8d4f18

Browse files
committed
Source -> Format
1 parent 1021070 commit a8d4f18

28 files changed

+1193
-1085
lines changed

fr.lip6.move.gal.structural/src/fr/lip6/move/gal/graph/GraphSuffix.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public static boolean[] computeNonStablePlaces(SparsePetriNet spn, DonePropertie
3232
// prédecesseur.
3333
reduced += reduceUnmarkedSuffix(spn, graph, nonstable, doneProps);
3434
if (reduced > 0) {
35-
System.out.println("Structural test allowed to assert that " + reduced + " places are NOT stable. Took "+(System.currentTimeMillis() - time)+" ms.");
35+
System.out.println("Structural test allowed to assert that " + reduced + " places are NOT stable. Took "
36+
+ (System.currentTimeMillis() - time) + " ms.");
3637
}
3738

3839
return nonstable;

fr.lip6.move.gal.structural/src/fr/lip6/move/gal/graph/Tarjan.java

Lines changed: 18 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,28 @@ public Set<Integer> parsePetriNet(ISparsePetriNet graph) {
8383
}
8484

8585
Map<Integer, List<Integer>> sccs = new HashMap<>();
86-
for(int pid = 0; pid < id.length; pid++) {
86+
for (int pid = 0; pid < id.length; pid++) {
8787
sccs.computeIfAbsent(id[pid], k -> new ArrayList<>()).add(pid);
8888

8989
}
9090
Set<Integer> nonTrivialSCC = new HashSet<>();
9191

92-
for(List<Integer> scc : sccs.values()) {
93-
if(scc.size() > 1 || adj.get(scc.get(0), scc.get(0)) == 1) {
92+
for (List<Integer> scc : sccs.values()) {
93+
if (scc.size() > 1 || adj.get(scc.get(0), scc.get(0)) == 1) {
9494
nonTrivialSCC.addAll(scc);
9595
}
9696
}
9797
return nonTrivialSCC;
9898

9999
}
100100

101-
public static Set<Integer> computePlacesInNonTrivialSCC (ISparsePetriNet spn) {
101+
public static Set<Integer> computePlacesInNonTrivialSCC(ISparsePetriNet spn) {
102102
IntMatrixCol graph = computeAdjacency(spn);
103103
Set<Integer> nonTrivialSCC = new HashSet<>();
104104

105105
List<List<Integer>> sccs = searchForSCC(graph);
106-
for(List<Integer> scc : sccs) {
107-
if(scc.size() > 1 || graph.get(scc.get(0), scc.get(0)) == 1) {
106+
for (List<Integer> scc : sccs) {
107+
if (scc.size() > 1 || graph.get(scc.get(0), scc.get(0)) == 1) {
108108
nonTrivialSCC.addAll(scc);
109109
}
110110
}
@@ -128,37 +128,30 @@ private static IntMatrixCol computeAdjacency(ISparsePetriNet graph) {
128128
return adj;
129129
}
130130

131-
132-
133-
134131
/**
135132
* Non recursive version based on Ivan Stoev proposal on SO :
136133
* https://stackoverflow.com/questions/46511682/non-recursive-version-of-tarjans-algorithm.
137134
*
138135
* @param graph
139136
* @return the SCCs
140137
*/
141-
public static List<List<Integer>> searchForSCC(IntMatrixCol graph)
142-
{
138+
public static List<List<Integer>> searchForSCC(IntMatrixCol graph) {
143139
List<List<Integer>> stronglyConnectedComponents = new ArrayList<>();
144140

145141
int preCount = 0;
146-
int [] low = new int[graph.getColumnCount()];
147-
boolean [] visited = new boolean[graph.getColumnCount()];
142+
int[] low = new int[graph.getColumnCount()];
143+
boolean[] visited = new boolean[graph.getColumnCount()];
148144
Stack<Integer> stack = new Stack<>();
149145

150146
Stack<Integer> minStack = new Stack<>();
151147
Stack<Integer> vStack = new Stack<>();
152148
Stack<Iterator<Integer>> enumeratorStack = new Stack<>();
153149

154150
Iterator<Integer> enumerator = IntStream.range(0, graph.getColumnCount()).iterator();
155-
while (true)
156-
{
157-
if (enumerator.hasNext())
158-
{
151+
while (true) {
152+
if (enumerator.hasNext()) {
159153
int v = enumerator.next();
160-
if (!visited[v])
161-
{
154+
if (!visited[v]) {
162155
low[v] = preCount++;
163156
visited[v] = true;
164157
stack.push(v);
@@ -168,18 +161,14 @@ public static List<List<Integer>> searchForSCC(IntMatrixCol graph)
168161
vStack.push(v);
169162
enumeratorStack.push(enumerator);
170163
enumerator = Arrays.stream(graph.getColumn(v).copyKeys()).iterator();
171-
}
172-
else if (minStack.size() > 0)
173-
{
164+
} else if (minStack.size() > 0) {
174165
int min = minStack.pop();
175166
if (low[v] < min) {
176167
min = low[v];
177168
}
178169
minStack.push(min);
179170
}
180-
}
181-
else
182-
{
171+
} else {
183172
// Level up
184173
if (enumeratorStack.size() == 0) {
185174
break;
@@ -189,26 +178,21 @@ else if (minStack.size() > 0)
189178
int v = vStack.pop();
190179
int min = minStack.pop();
191180

192-
if (min < low[v])
193-
{
181+
if (min < low[v]) {
194182
low[v] = min;
195-
}
196-
else
197-
{
183+
} else {
198184
List<Integer> component = new ArrayList<>();
199185

200186
int w;
201-
do
202-
{
187+
do {
203188
w = stack.pop();
204189
component.add(w);
205190
low[w] = graph.getColumnCount();
206191
} while (w != v);
207192
stronglyConnectedComponents.add(component);
208193
}
209194

210-
if (minStack.size() > 0)
211-
{
195+
if (minStack.size() > 0) {
212196
min = minStack.pop();
213197
if (low[v] < min) {
214198
min = low[v];

fr.lip6.move.gal.structural/src/fr/lip6/move/gal/mcc/properties/ConcurrentHashDoneProperties.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
public class ConcurrentHashDoneProperties implements DoneProperties {
1313
private static final int DEBUG = 0;
14-
private Map<String,Boolean> map = new ConcurrentHashMap<>();
15-
protected Map<String,List<String>> alias = new HashMap<>();
14+
private Map<String, Boolean> map = new ConcurrentHashMap<>();
15+
protected Map<String, List<String>> alias = new HashMap<>();
1616

1717
@Override
1818
public boolean containsKey(Object arg0) {
@@ -27,12 +27,12 @@ public Set<Entry<String, Boolean>> entrySet() {
2727
@Override
2828
public Boolean put(String prop, Boolean value, String techniques) {
2929
if (DEBUG >= 1) {
30-
System.out.println(prop +"=" + value +"; "+techniques);
30+
System.out.println(prop + "=" + value + "; " + techniques);
3131
}
3232
Boolean b = map.put(prop, value);
3333
if (b == null) {
3434
for (String aka : alias.getOrDefault(prop, Collections.emptyList())) {
35-
put(aka,value,techniques);
35+
put(aka, value, techniques);
3636
}
3737
}
3838
return b;
@@ -44,7 +44,7 @@ public Boolean put(String prop, Integer value, String techniques) {
4444
Boolean b = map.put(prop, true);
4545
if (b == null) {
4646
for (String aka : alias.getOrDefault(prop, Collections.emptyList())) {
47-
put(aka,value,techniques);
47+
put(aka, value, techniques);
4848
}
4949
}
5050
return b;
@@ -72,9 +72,8 @@ public boolean isFinished() {
7272

7373
@Override
7474
public void addAlias(String propToCheck, String aka) {
75-
alias.compute(propToCheck, (k,v) ->
76-
{
77-
if (v==null) {
75+
alias.compute(propToCheck, (k, v) -> {
76+
if (v == null) {
7877
v = new ArrayList<>();
7978
}
8079
v.add(aka);

fr.lip6.move.gal.structural/src/fr/lip6/move/gal/mcc/properties/LTSMinPropertyPrinter.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ public Void visit(AtomicPropRef apRef) {
1717
return apRef.getAp().getExpression().accept(this);
1818
}
1919

20-
2120
@Override
2221
public Void visit(TransRef transRef) {
23-
pw.append("t"+transRef.getValue());
22+
pw.append("t" + transRef.getValue());
2423
return null;
2524
}
2625

fr.lip6.move.gal.structural/src/fr/lip6/move/gal/mcc/properties/MCCExporter.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ public class MCCExporter {
1111

1212
/**
1313
* Build MCC compliant representation of the provided SparsePetriNet and it's
14-
* properties.
15-
* NB : IOExceptions are not reported to caller.
14+
* properties. NB : IOExceptions are not reported to caller.
1615
*
1716
* @param pnmlpath path to build the model file in PNML format
1817
* @param proppath path to put the formulas in MCC XML format
@@ -24,13 +23,13 @@ public static void exportToMCCFormat(String pnmlpath, String proppath, SparsePet
2423
if (!spn.getProperties().isEmpty()) {
2524
usedConstants = PropertiesToPNML.transform(spn, proppath, new ConcurrentHashDoneProperties());
2625
}
27-
if (! usedConstants.isEmpty()) {
26+
if (!usedConstants.isEmpty()) {
2827
// we exported constants to a place with index = current place count
2928
// to be consistent now add a trivially constant place with initial marking 1
3029
// token
3130
System.out.println("Added places for constants to the net.");
3231
for (int cst : usedConstants) {
33-
spn.addPlace("constant"+cst, cst);
32+
spn.addPlace("constant" + cst, cst);
3433
}
3534
}
3635
StructuralToPNML.transform(spn, pnmlpath);

fr.lip6.move.gal.structural/src/fr/lip6/move/gal/mcc/properties/PropReader.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,25 @@ public static void readXMLPropertiesIntoProps(File fileProp, PetriNet ptnet, boo
2929
PropHandler handler = new PropHandler(ptnet, isLTL);
3030
long debut = System.currentTimeMillis();
3131
saxParser.parse(in, handler);
32-
//LOGGER.info("Load time of PNML: " + (System.currentTimeMillis() - debut) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$
32+
// LOGGER.info("Load time of PNML: " + (System.currentTimeMillis() - debut) + "
33+
// ms"); //$NON-NLS-1$ //$NON-NLS-2$
3334
}
3435

3536
catch (IOException e) {
3637
LOGGER.warning("IO exception : " + e.getMessage()); //$NON-NLS-1$
37-
error =e;
38+
error = e;
3839
} catch (ParserConfigurationException e) {
3940
LOGGER.warning("Error at ToolSpecific Xml parser creation. " + e.getMessage()); //$NON-NLS-1$
40-
error =e;
41+
error = e;
4142
} catch (SAXException e) {
4243
LOGGER.warning("Parse error while parsing toolspecific elements in xml.\n details:" + e.getMessage()); //$NON-NLS-1$
4344
e.printStackTrace();
44-
error =e;
45+
error = e;
4546
}
4647
if (error != null) {
47-
throw new IOException("Parse error while treating translation of formula, possibly this examination is not supported yet.", error);
48+
throw new IOException(
49+
"Parse error while treating translation of formula, possibly this examination is not supported yet.",
50+
error);
4851
}
4952
}
5053

0 commit comments

Comments
 (0)