-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v3.0.0
- Loading branch information
Showing
268 changed files
with
3,340 additions
and
3,654 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 0 additions & 80 deletions
80
protobuf/src/main/java/gov/hhs/aspr/ms/gcm/taskit/protobuf/nucleus/NucleusTranslator.java
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
...pecs/ExampleDimensionTranslationSpec.java → ...pecs/ExampleDimensionTranslationSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
.../main/java/gov/hhs/aspr/ms/gcm/taskit/protobuf/nucleus/translation/NucleusTranslator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package gov.hhs.aspr.ms.gcm.taskit.protobuf.nucleus.translation; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import gov.hhs.aspr.ms.gcm.taskit.protobuf.nucleus.input.ExperimentParameterDataInput; | ||
import gov.hhs.aspr.ms.gcm.taskit.protobuf.nucleus.input.SimulationStateInput; | ||
import gov.hhs.aspr.ms.gcm.taskit.protobuf.nucleus.testsupport.translation.specs.ExampleDimensionTranslationSpec; | ||
import gov.hhs.aspr.ms.gcm.taskit.protobuf.nucleus.translation.specs.DimensionTranslationSpec; | ||
import gov.hhs.aspr.ms.gcm.taskit.protobuf.nucleus.translation.specs.ExperimentParameterDataTranslationSpec; | ||
import gov.hhs.aspr.ms.gcm.taskit.protobuf.nucleus.translation.specs.PlannerTranslationSpec; | ||
import gov.hhs.aspr.ms.gcm.taskit.protobuf.nucleus.translation.specs.SimulationStateTranslationSpec; | ||
import gov.hhs.aspr.ms.taskit.core.translation.Translator; | ||
import gov.hhs.aspr.ms.taskit.protobuf.engine.IProtobufTaskitEngineBuilder; | ||
import gov.hhs.aspr.ms.taskit.protobuf.engine.ProtobufJsonTaskitEngine; | ||
import gov.hhs.aspr.ms.taskit.protobuf.translation.ProtobufTranslationSpec; | ||
|
||
/** | ||
* Translator for Nucleus Using this Translator will add all the necessary | ||
* TranslationSpecs needed to read and write the classes within Nucleus | ||
*/ | ||
public class NucleusTranslator { | ||
|
||
private NucleusTranslator() { | ||
} | ||
|
||
protected static List<ProtobufTranslationSpec<?, ?>> getTranslationSpecs() { | ||
List<ProtobufTranslationSpec<?, ?>> list = new ArrayList<>(); | ||
|
||
list.add(new SimulationStateTranslationSpec()); | ||
list.add(new PlannerTranslationSpec()); | ||
list.add(new DimensionTranslationSpec()); | ||
list.add(new ExampleDimensionTranslationSpec()); | ||
list.add(new ExperimentParameterDataTranslationSpec()); | ||
|
||
return list; | ||
} | ||
|
||
/** | ||
* Returns a Translator Builder that already includes the necessary | ||
* TranslationSpecs needed to read and write the classes within Nucleus | ||
*/ | ||
private static Translator.Builder builder() { | ||
Translator.Builder builder = Translator.builder() | ||
.setTranslatorId(NucleusTranslatorId.TRANSLATOR_ID) | ||
.setInitializer((translatorContext) -> { | ||
IProtobufTaskitEngineBuilder taskitEngineBuilder = translatorContext | ||
.getTaskitEngineBuilder(IProtobufTaskitEngineBuilder.class); | ||
|
||
for (ProtobufTranslationSpec<?, ?> translationSpec : getTranslationSpecs()) { | ||
taskitEngineBuilder.addTranslationSpec(translationSpec); | ||
} | ||
|
||
if (taskitEngineBuilder instanceof ProtobufJsonTaskitEngine.Builder) { | ||
((ProtobufJsonTaskitEngine.Builder) taskitEngineBuilder).addFieldToIncludeDefaultValue( | ||
SimulationStateInput.getDescriptor().findFieldByName("startTime")); | ||
|
||
((ProtobufJsonTaskitEngine.Builder) taskitEngineBuilder) | ||
.addFieldToIncludeDefaultValue( | ||
ExperimentParameterDataInput.getDescriptor().findFieldByName("threadCount")) | ||
.addFieldToIncludeDefaultValue(ExperimentParameterDataInput.getDescriptor() | ||
.findFieldByName("startRecordingIsScheduled")) | ||
.addFieldToIncludeDefaultValue(ExperimentParameterDataInput.getDescriptor() | ||
.findFieldByName("simulationHaltTime")) | ||
.addFieldToIncludeDefaultValue( | ||
ExperimentParameterDataInput.getDescriptor().findFieldByName("haltOnException")) | ||
.addFieldToIncludeDefaultValue(ExperimentParameterDataInput.getDescriptor() | ||
.findFieldByName("experimentProgressLogPath")) | ||
.addFieldToIncludeDefaultValue(ExperimentParameterDataInput.getDescriptor() | ||
.findFieldByName("continueFromProgressLog")); | ||
} | ||
|
||
}); | ||
|
||
return builder; | ||
} | ||
|
||
/** | ||
* Returns a Translator that includes TranslationSpecs for the classes within | ||
* Nucleus | ||
*/ | ||
public static Translator getTranslator() { | ||
return builder().build(); | ||
} | ||
} |
Oops, something went wrong.