Skip to content

Commit

Permalink
avoid unnecessary lookups
Browse files Browse the repository at this point in the history
  • Loading branch information
baltzell committed Dec 29, 2024
1 parent ebd9e33 commit 0273077
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ public static void main(String[] args) {
OptionParser o = new OptionParser("trutheff");
o.setRequiresInputList(true);
o.parse(args);
System.out.println(o.getInputList());
Truth t = new Truth(o.getInputList().get(0));
t.add(o.getInputList());
System.out.println(t.toTable());
Expand Down Expand Up @@ -88,11 +87,12 @@ public float get(int truth, int rec) {
* @param rec reconstructed PID
*/
public void add(int truth, int rec) {
if (PIDS.contains(truth)) {
mcTallies[PIDS.indexOf(truth)]++;
if (!PIDS.contains(rec)) recTallies[PIDS.indexOf(truth)][UDF]++;
else recTallies[PIDS.indexOf(truth)][PIDS.indexOf(rec)]++;
}
final int t = PIDS.indexOf(truth);
if (t < 0) return;
final int r = PIDS.indexOf(rec);
mcTallies[t]++;
if (r < 0) recTallies[t][UDF]++;
else recTallies[t][r]++;
}

/**
Expand Down

0 comments on commit 0273077

Please sign in to comment.