Catalyst: change package name to org.shemshak.alloy.catalyst

As well as a few minor enhancements to SSR.java
parent 115a2b0a
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>org.aminb.alloy.catalyst.dist</name> <name>org.shemshak.alloy.catalyst.dist</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
......
Main-Class: org.aminb.alloy.catalyst.MainCLI Main-Class: org.shemshak.alloy.catalyst.MainCLI
-buildpath: \ -buildpath: \
org.aminb.alloy.catalyst,\ org.shemshak.alloy.catalyst,\
org.alloytools.alloy.core,\ org.alloytools.alloy.core,\
org.alloytools.kodkod.core;version=latest,\ org.alloytools.kodkod.core;version=latest,\
org.alloytools.kodkod.nativesat.x86-windows;version=latest,\ org.alloytools.kodkod.nativesat.x86-windows;version=latest,\
...@@ -14,7 +14,7 @@ Main-Class: org.aminb.alloy.catalyst.MainCLI ...@@ -14,7 +14,7 @@ Main-Class: org.aminb.alloy.catalyst.MainCLI
-sources: false -sources: false
-includeresource: \ -includeresource: \
@${repo;org.aminb.alloy.catalyst}, \ @${repo;org.shemshak.alloy.catalyst}, \
@${repo;org.alloytools.alloy.core}, \ @${repo;org.alloytools.alloy.core}, \
@${repo;org.alloytools.kodkod.core}, \ @${repo;org.alloytools.kodkod.core}, \
@${repo;org.alloytools.kodkod.nativesat.util}, \ @${repo;org.alloytools.kodkod.nativesat.util}, \
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>org.aminb.alloy.catalyst</name> <name>org.shemshak.alloy.catalyst</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
......
Main-Class: org.aminb.alloy.catalyst.MainCLI Main-Class: org.shemshak.alloy.catalyst.MainCLI
-buildpath: \ -buildpath: \
org.alloytools.alloy.core;version=latest,\ org.alloytools.alloy.core;version=latest,\
...@@ -15,5 +15,5 @@ Main-Class: org.aminb.alloy.catalyst.MainCLI ...@@ -15,5 +15,5 @@ Main-Class: org.aminb.alloy.catalyst.MainCLI
com.google.gson com.google.gson
Private-Package: \ Private-Package: \
org.aminb.alloy.catalyst,\ org.shemshak.alloy.catalyst,\
kodkod.engine.satlab;-split-package:=merge-first kodkod.engine.satlab;-split-package:=merge-first
package org.aminb.alloy.catalyst; package org.shemshak.alloy.catalyst;
import java.io.BufferedWriter; import java.io.BufferedWriter;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
......
package org.aminb.alloy.catalyst; package org.shemshak.alloy.catalyst;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.kohsuke.github.GHRepository; import org.kohsuke.github.GHRepository;
......
package org.aminb.alloy.catalyst; package org.shemshak.alloy.catalyst;
import edu.mit.csail.sdg.ast.Expr; import edu.mit.csail.sdg.ast.Expr;
import edu.mit.csail.sdg.ast.Func; import edu.mit.csail.sdg.ast.Func;
......
package org.aminb.alloy.catalyst; package org.shemshak.alloy.catalyst;
import picocli.CommandLine; import picocli.CommandLine;
import picocli.CommandLine.Command; import picocli.CommandLine.Command;
...@@ -13,7 +13,7 @@ import picocli.CommandLine.Command; ...@@ -13,7 +13,7 @@ import picocli.CommandLine.Command;
"Catalyst is free software: you are free to change and redistribute it.", "Catalyst is free software: you are free to change and redistribute it.",
"There is NO WARRANTY, to the extent permitted by law.", "There is NO WARRANTY, to the extent permitted by law.",
"", "",
"Written by Amin Bandali." "Written by Amin Bandali <https://shemshak.org/~amin>."
}, },
description = "A framework for analysis/optimization of performance of Alloy models.", description = "A framework for analysis/optimization of performance of Alloy models.",
customSynopsis = "@|bold catalyst|@ [OPTION] COMMAND", customSynopsis = "@|bold catalyst|@ [OPTION] COMMAND",
......
package org.aminb.alloy.catalyst; package org.shemshak.alloy.catalyst;
import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;
......
package org.aminb.alloy.catalyst; package org.shemshak.alloy.catalyst;
import java.util.List; import java.util.List;
......
package org.aminb.alloy.catalyst; package org.shemshak.alloy.catalyst;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
...@@ -10,8 +10,6 @@ import java.time.Duration; ...@@ -10,8 +10,6 @@ import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -71,9 +69,6 @@ public final class SSR extends CatalystCommand implements Runnable { ...@@ -71,9 +69,6 @@ public final class SSR extends CatalystCommand implements Runnable {
protected final CorpusResult analyzeCorpus(String corpus) { protected final CorpusResult analyzeCorpus(String corpus) {
CorpusResult cr = new CorpusResult(); CorpusResult cr = new CorpusResult();
cr.corpus_name = corpus; cr.corpus_name = corpus;
cr.file_results = parallel ?
Collections.synchronizedList(new ArrayList<FileResult>()) :
new ArrayList<FileResult>();
pln(); pln();
...@@ -81,15 +76,17 @@ public final class SSR extends CatalystCommand implements Runnable { ...@@ -81,15 +76,17 @@ public final class SSR extends CatalystCommand implements Runnable {
try { try {
List<Path> files = Files.walk(Paths.get(modelsDir, corpus)) List<Path> files = Files.walk(Paths.get(modelsDir, corpus))
.filter(Files::isRegularFile) .filter(Files::isRegularFile)
.filter(p -> p.getFileName().toString().endsWith(".als"))
.filter(p -> !Arrays.asList(ignoredFiles).contains(p.getFileName().toString()))
.collect(Collectors.toList()); .collect(Collectors.toList());
cr.file_count = files.size(); cr.file_count = files.size();
pln("number of " + corpus + " models: " + cr.file_count); pln("number of " + corpus + " models: " + cr.file_count);
r.total_file_count += cr.file_count; r.total_file_count += cr.file_count;
AtomicInteger i = new AtomicInteger(1); AtomicInteger i = new AtomicInteger(1);
Stream<Path> fs = parallel ? files.parallelStream() : files.stream(); Stream<Path> fs = parallel ? files.parallelStream() : files.stream();
fs.filter(p -> p.getFileName().toString().endsWith(".als")) cr.file_results =
.filter(p -> !Arrays.asList(ignoredFiles).contains(p.getFileName().toString())) fs.map(p -> analyzeFile(corpus, p, i.getAndIncrement(), cr.file_count))
.forEach(p -> cr.file_results.add(analyzeFile(corpus, p, i.getAndIncrement(), cr.file_count))); .collect(Collectors.toList());
} catch (Exception e) { } catch (Exception e) {
String msg = "Failed while trying to iterate through and analyze " + corpus + " models."; String msg = "Failed while trying to iterate through and analyze " + corpus + " models.";
cr.error = String.format("%s%n%s", msg, Utils.toString(e)); cr.error = String.format("%s%n%s", msg, Utils.toString(e));
...@@ -125,7 +122,6 @@ public final class SSR extends CatalystCommand implements Runnable { ...@@ -125,7 +122,6 @@ public final class SSR extends CatalystCommand implements Runnable {
protected final FileResult analyzeFile(String corpus, Path p, int index, int total) { protected final FileResult analyzeFile(String corpus, Path p, int index, int total) {
FileResult fr = new FileResult(); FileResult fr = new FileResult();
fr.file_name = p.toString(); fr.file_name = p.toString();
fr.mutation_results = new ArrayList<MutationResult>();
fr.errors = new ArrayList<ParseOrTypeError>(); fr.errors = new ArrayList<ParseOrTypeError>();
String progress = String.format("[%d/%d]: ", index, total); String progress = String.format("[%d/%d]: ", index, total);
......
package org.aminb.alloy.catalyst; package org.shemshak.alloy.catalyst;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
......
package org.aminb.alloy.catalyst; package org.shemshak.alloy.catalyst;
import java.io.File; import java.io.File;
import java.nio.file.Path; import java.nio.file.Path;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment