Verified Commit 433c57b0 authored by Amin Bandali's avatar Amin Bandali
Browse files

Remove ModuleResult and store ssr & mutation results separately

parent b7174282
......@@ -42,7 +42,7 @@ enum Solver {
}
}
enum MutKind {
enum MutationKind {
ORIGINAL,
MUT_RANDOM
}
......@@ -139,12 +139,10 @@ public final class MainCLI {
if (o.ssr) {
long ssrc = 0, ssrt = 0;
for (FileResult fr : cr.file_results)
for (ModuleResult mr : fr.module_results)
if (mr instanceof SSRResult) {
SSRResult r = (SSRResult)mr;
ssrc += r.ssr_candidate_count;
ssrt += r.total_sig_count;
}
for (SSRResult r : fr.ssr_results) {
ssrc += r.ssr_candidate_count;
ssrt += r.total_sig_count;
}
mainPr.ln(String.format("SSR candidates: %d/%d (%.2f%%)",
ssrc, ssrt, 100. * ssrc / ssrt));
}
......@@ -157,7 +155,8 @@ public final class MainCLI {
private FileResult analyzeFile(Printer mainPr, Path p, String corpus, int index, int total) {
FileResult fr = new FileResult();
fr.file_name = p.toString();
fr.module_results = new ArrayList<ModuleResult>();
fr.ssr_results = new ArrayList<SSRResult>();
fr.mutation_results = new ArrayList<MutationResult>();
fr.error = new ArrayList<ParseOrTypeError>();
String progress = String.format("[%d/%d]: ", index, total);
......@@ -213,7 +212,7 @@ public final class MainCLI {
if (o.ssr) { // if we're in SSR mode
SSRResult r = detectRemovableSigs(world);
fr.module_results.add(r);
fr.ssr_results.add(r);
mainPr.ln(progress + "done: " + fr.file_name);
pr.close();
return fr;
......@@ -229,7 +228,7 @@ public final class MainCLI {
pr.lnd(" running...");
try {
fr.module_results.add(mutModule(pr, world, MutKind.ORIGINAL));
fr.mutation_results.add(mutateModule(pr, world, MutationKind.ORIGINAL));
} catch (Err e) {
String msg = "Error while analyzing original module. Stack trace from the exception:",
err = e.dump();
......@@ -253,7 +252,7 @@ public final class MainCLI {
pr.lnd(" running...");
try {
fr.module_results.add(mutModule(pr, world, MutKind.MUT_RANDOM));
fr.mutation_results.add(mutateModule(pr, world, MutationKind.MUT_RANDOM));
} catch (Err e) {
String msg = "Error while analyzing mutation. Stack trace from the exception:",
err = e.dump();
......@@ -317,8 +316,8 @@ public final class MainCLI {
}
}
private MutResult mutModule(Printer pr, CompModule module, MutKind kind) throws Err {
MutResult mr = new MutResult();
private MutationResult mutateModule(Printer pr, CompModule module, MutationKind kind) throws Err {
MutationResult mr = new MutationResult();
mr.kind = kind;
mr.runs = Collections.synchronizedList(new ArrayList<Run>());
......
......@@ -32,19 +32,18 @@ class ParseOrTypeError {
class FileResult {
public String file_name;
public List<ModuleResult> module_results;
public List<SSRResult> ssr_results;
public List<MutationResult> mutation_results;
public List<ParseOrTypeError> error;
}
abstract class ModuleResult {}
class SSRResult extends ModuleResult {
class SSRResult {
public long total_sig_count;
public long ssr_candidate_count;
}
class MutResult extends ModuleResult {
MutKind kind;
class MutationResult {
MutationKind kind;
List<Run> runs;
}
......
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