From c05e81b25a754b05d997c368942e4319f3f7cdcb Mon Sep 17 00:00:00 2001
From: Peter Powers <pmpowers@usgs.gov>
Date: Sat, 5 Feb 2022 11:41:31 -0700
Subject: [PATCH] exposed data types in builder

---
 .../usgs/earthquake/nshmp/calc/CalcConfig.java  | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/main/java/gov/usgs/earthquake/nshmp/calc/CalcConfig.java b/src/main/java/gov/usgs/earthquake/nshmp/calc/CalcConfig.java
index 48daad71..3945369d 100644
--- a/src/main/java/gov/usgs/earthquake/nshmp/calc/CalcConfig.java
+++ b/src/main/java/gov/usgs/earthquake/nshmp/calc/CalcConfig.java
@@ -802,9 +802,10 @@ public final class CalcConfig {
 
     private Output(Builder b) {
       this.directory = b.directory;
-      b.dataTypes.add(DataType.TOTAL);
-      b.dataTypes.add(DataType.MAP);
-      this.dataTypes = Collections.unmodifiableSet(b.dataTypes);
+      Set<DataType> dataTypes = EnumSet.copyOf(b.dataTypes);
+      dataTypes.add(DataType.TOTAL);
+      dataTypes.add(DataType.MAP);
+      this.dataTypes = Collections.unmodifiableSet(dataTypes);
       this.returnPeriods = List.copyOf(b.returnPeriods);
     }
 
@@ -1028,6 +1029,16 @@ public final class CalcConfig {
       return this;
     }
 
+    /**
+     * Set the data types for which results should be calculated.
+     *
+     * @see gov.usgs.earthquake.nshmp.calc.CalcConfig.Hazard#imts
+     */
+    public Builder dataTypes(Set<DataType> dataTypes) {
+      this.output.dataTypes = checkNotNull(dataTypes);
+      return this;
+    }
+
     /**
      * Set the timespan for earthquake probabilities. Calling this method also
      * sets {@link Rate#valueFormat} to {@link ValueFormat#POISSON_PROBABILITY}
-- 
GitLab