From 4aa64cd2df9f46f308d109ae6cb135e18ab5717c Mon Sep 17 00:00:00 2001
From: Peter Powers <pmpowers@usgs.gov>
Date: Fri, 18 Feb 2022 09:44:10 -0700
Subject: [PATCH] removed unnecessary methods from export classes

---
 .../earthquake/nshmp/calc/EqRateExport.java   | 35 ----------------
 .../earthquake/nshmp/calc/HazardExport.java   | 41 -------------------
 2 files changed, 76 deletions(-)

diff --git a/src/main/java/gov/usgs/earthquake/nshmp/calc/EqRateExport.java b/src/main/java/gov/usgs/earthquake/nshmp/calc/EqRateExport.java
index ab5284ed..9d2e2e10 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/calc/EqRateExport.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/calc/EqRateExport.java
@@ -1,6 +1,5 @@
 package gov.usgs.earthquake.nshmp.calc;
 
-import static com.google.common.base.Preconditions.checkState;
 import static java.nio.file.StandardOpenOption.APPEND;
 
 import java.io.IOException;
@@ -41,11 +40,8 @@ public final class EqRateExport {
   private final HazardModel model;
   private final boolean exportSource;
 
-  private int resultCount = 0;
-
   private final boolean namedSites;
   private boolean firstRecord = true;
-  private boolean used = false;
 
   private EqRateExport(
       HazardModel model,
@@ -90,37 +86,6 @@ public final class EqRateExport {
    * @param rate data container to add
    */
   public void write(EqRate rate) throws IOException {
-    checkState(!used, "This result handler is expired");
-    writeRate(rate);
-    resultCount++;
-  }
-
-  /**
-   * Flushes any remaining results, stops all timers and sets the state of this
-   * exporter to 'used'; no more results may be added.
-   */
-  public void expire() {
-    used = true;
-  }
-
-  /**
-   * The number of rate results passed to this handler thus far.
-   */
-  public int resultCount() {
-    return resultCount;
-  }
-
-  /**
-   * The target output directory established by this handler.
-   */
-  public Path outputDir() {
-    return out;
-  }
-
-  /*
-   * Write the current list of {@code EqRate}s to file.
-   */
-  private void writeRate(EqRate rate) throws IOException {
 
     Iterable<Double> emptyValues = Doubles.asList(new double[rate.totalMfd.size()]);
     Function<Double, String> formatter = Parsing.formatDoubleFunction(valueFormat);
diff --git a/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java b/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java
index 805721d6..47ccd92e 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/calc/HazardExport.java
@@ -1,6 +1,5 @@
 package gov.usgs.earthquake.nshmp.calc;
 
-import static com.google.common.base.Preconditions.checkState;
 import static gov.usgs.earthquake.nshmp.calc.ValueFormat.POISSON_PROBABILITY;
 import static gov.usgs.earthquake.nshmp.data.MutableXySequence.emptyCopyOf;
 import static java.nio.charset.StandardCharsets.UTF_8;
@@ -51,14 +50,6 @@ import gov.usgs.earthquake.nshmp.model.SourceType;
  */
 public final class HazardExport {
 
-  /*
-   * Developer notes
-   *
-   * Export of gmm and source type is unreliable for results where multiple
-   * models may have been run (e.g. Hazard2018) because the model.types() and
-   * model.gmms() methods will only reflect a single model.
-   */
-
   private static final String GMM_DIR = "gmm";
   static final String TYPE_DIR = "source";
   private static final String CURVE_FILE_ASCII = "curves.csv";
@@ -73,10 +64,7 @@ public final class HazardExport {
 
   private final Function<Double, String> valueFormatter;
 
-  private int resultCount = 0;
-
   private final boolean namedSites;
-  private boolean used = false;
 
   private HazardExport(
       HazardModel model,
@@ -189,35 +177,6 @@ public final class HazardExport {
    * @param hazard to write
    */
   public void write(Hazard hazard) throws IOException {
-    checkState(!used, "This result handler is expired");
-    writeHazard(hazard);
-    resultCount++;
-  }
-
-  /**
-   * Stops all timers and sets the state of this {@code Results} instance to
-   * 'used'; no more results may be added.
-   */
-  public void expire() {
-    used = true;
-  }
-
-  /**
-   * The number of hazard results passed to this handler thus far.
-   */
-  public int resultCount() {
-    return resultCount;
-  }
-
-  /**
-   * The target output directory established by this handler.
-   */
-  public Path outputDir() {
-    return out;
-  }
-
-  /* Write the supplied hazard results to file(s). */
-  private void writeHazard(Hazard hazard) throws IOException {
 
     Set<Gmm> gmms = hazard.model.gmms();
     Set<SourceType> types = hazard.model.types();
-- 
GitLab