Skip to content
Snippets Groups Projects

Resolves - Add total MFD for source tree to Models serialization classes

2 files
+ 12
7
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -15,7 +15,9 @@ import java.util.stream.Collectors;
@@ -15,7 +15,9 @@ import java.util.stream.Collectors;
import com.google.gson.Gson;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.GsonBuilder;
 
import gov.usgs.earthquake.nshmp.data.XySequence;
import gov.usgs.earthquake.nshmp.mfd.Mfd;
import gov.usgs.earthquake.nshmp.mfd.Mfd;
 
import gov.usgs.earthquake.nshmp.mfd.Mfds;
import gov.usgs.earthquake.nshmp.model.SourceTree.Leaf;
import gov.usgs.earthquake.nshmp.model.SourceTree.Leaf;
import gov.usgs.earthquake.nshmp.tree.Branch;
import gov.usgs.earthquake.nshmp.tree.Branch;
@@ -70,7 +72,6 @@ public class Models {
@@ -70,7 +72,6 @@ public class Models {
// System.out.println(GSON.toJson(tree(model, 2591))); // Stonewall Ant.
// System.out.println(GSON.toJson(tree(model, 2591))); // Stonewall Ant.
System.out.println(GSON.toJson(tree(model, 2535))); // Steens
System.out.println(GSON.toJson(tree(model, 2535))); // Steens
}
}
/**
/**
@@ -156,6 +157,7 @@ public class Models {
@@ -156,6 +157,7 @@ public class Models {
final String path;
final String path;
final TectonicSetting setting;
final TectonicSetting setting;
final SourceType type;
final SourceType type;
 
final XySequence totalMfd;
final List<SourceBranch> branches;
final List<SourceBranch> branches;
Tree(SourceTree tree, Path modelRoot) {
Tree(SourceTree tree, Path modelRoot) {
@@ -164,6 +166,8 @@ public class Models {
@@ -164,6 +166,8 @@ public class Models {
this.path = modelRoot.relativize(tree.path()).toString();
this.path = modelRoot.relativize(tree.path()).toString();
this.setting = tree.setting();
this.setting = tree.setting();
this.type = tree.type();
this.type = tree.type();
 
this.totalMfd = Mfds.combine(tree.stream().map(branch -> branch.value().totalMfd())
 
.collect(Collectors.toList())).data();
List<SourceBranch> branches = new ArrayList<>();
List<SourceBranch> branches = new ArrayList<>();
Loading