package com.bbn.kbp.events2014.scorer;

import com.bbn.bue.common.symbols.Symbol;
import com.bbn.kbp.events2014.EventArgumentLinking;
import com.bbn.kbp.linking.ExplicitFMeasureInfo;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Created by rgabbard on 4/3/15.
 */
public final class LinkingScore {

  private final Symbol docID;
  private final EventArgumentLinking referenceArgumentLinking;
  private final ExplicitFMeasureInfo scores;

  private LinkingScore(final Symbol docID,
      final EventArgumentLinking referenceArgumentLinking,
      final ExplicitFMeasureInfo scores) {
    this.scores = checkNotNull(scores);
    this.docID = checkNotNull(docID);
    this.referenceArgumentLinking = referenceArgumentLinking;
  }

  public int referenceLinkingSize() {
    return referenceArgumentLinking.allLinkedEquivalenceClasses().size();
  }

  public double precision() {
    return scores.precision();
  }

  public double recall() {
    return scores.recall();
  }

  public double F1() {
    return scores.f1();
  }

  public Symbol docID() {
    return docID;
  }

  public EventArgumentLinking referenceArgumentLinking() {
    return referenceArgumentLinking;
  }

  @Override
  public String toString() {
    return String.format("LinkingScore[%.2f/%.2f/%.2f]",
        100 * precision(), 100 * recall(), 100 * F1());
  }

  public static LinkingScore from(
      final EventArgumentLinking referenceArgumentLinking,
      final ExplicitFMeasureInfo scores) {
    return new LinkingScore(referenceArgumentLinking.docID(), referenceArgumentLinking, scores);
  }
}

@@ -324,38 +324,8 @@
  %7B%0A%0A
-  private final Symbol docID;%0A
   pr
@@ -462,34 +462,8 @@
 nal 
-Symbol docID,%0A      final 
 Even
@@ -592,46 +592,8 @@
 s);%0A
-    this.docID = checkNotNull(docID);%0A
     
@@ -624,16 +624,29 @@
 nking = 
+checkNotNull(
 referenc
@@ -653,32 +653,33 @@
 eArgumentLinking
+)
 ;%0A  %7D%0A%0A  public 
@@ -1001,21 +1001,48 @@
  return 
+referenceArgumentLinking.
 docID
+()
 ;%0A  %7D%0A%0A 
@@ -1469,42 +1469,8 @@
 ore(
-referenceArgumentLinking.docID(), 
 refe

remove explicit storing of docID and check that referenceArgumentLinking is not null