/** Convert a ClusterSourceSet to a List of future HazardInputs Lists. */ static final AsyncList<ClusterInputs> toClusterInputs( final ClusterSourceSet sourceSet, final Site site, final Executor ex) { Function<ClusterSource, ClusterInputs> function = new ClusterSourceToInputs(site); AsyncList<ClusterInputs> result = AsyncList.create(); for (ClusterSource source : sourceSet.iterableForLocation(site.location)) { result.add(transform(immediateFuture(source), function, ex)); } return result; }
/** Convert a List of future HazardInputs Lists to a List of future HazardGroundMotions Lists. */ static final AsyncList<ClusterGroundMotions> toClusterGroundMotions( final AsyncList<ClusterInputs> inputsList, final ClusterSourceSet sourceSet, final Set<Imt> imts, final Executor ex) { Set<Gmm> gmms = sourceSet.groundMotionModels().gmms(); Table<Gmm, Imt, GroundMotionModel> gmmInstances = Gmm.instances(gmms, imts); Function<ClusterInputs, ClusterGroundMotions> function = new ClusterInputsToGroundMotions(gmmInstances); AsyncList<ClusterGroundMotions> result = createWithCapacity(inputsList.size()); for (ListenableFuture<ClusterInputs> inputs : inputsList) { result.add(transform(inputs, function, ex)); } return result; }