Skip to content

Commit

Permalink
Removed unused ContractError members from the various error enums in …
Browse files Browse the repository at this point in the history
…GCM. (#214)
  • Loading branch information
shawnhatch authored Mar 1, 2024
1 parent d149d27 commit fa133a0
Show file tree
Hide file tree
Showing 17 changed files with 250 additions and 260 deletions.
158 changes: 74 additions & 84 deletions simulation/src/main/java/gov/hhs/aspr/ms/gcm/nucleus/NucleusError.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,90 +8,80 @@
* description of the exception.
*/
public enum NucleusError implements ContractError {
PLANNING_QUEUE_ACTIVE("The planning queue is still active and plans cannot be retrieved"),
ACCESS_VIOLATION("A contributed behavior is accessing locked state during a state change"),
DATA_MANAGER_ACCESS_VIOLATION(
"A data manager is attempting to access another data manager that is incompatible with the plugin dependencies"),
AMBIGUOUS_DATA_MANAGER_CLASS("Multiple data manager matches found"),
AMBIGUOUS_PLUGIN_DATA_BUILDER_CLASS("Multiple plugin data builder matches found"),
AMBIGUOUS_PLUGIN_DATA_CLASS("Multiple plugin data object matches found"),
CIRCULAR_PLUGIN_DEPENDENCIES("Circular plugin dependencies were found"),
DATA_MANAGER_DUPLICATE_INITIALIZATION("Data manager was already initialized"),
DATA_MANAGER_INITIALIZATION_FAILURE(
"Data manager base class was not properly initialized, be sure to call super()"),
DIMENSION_LABEL_MISMATCH(
"The number of scenario labels provided by a dimension level do not match the number of labels in the dimension's meta data"),
DUPLICATE_DATA_MANAGER_TYPE("Duplicate data manager type"), DUPLICATE_DATA_VIEW_TYPE("Duplicate data view type"),
DUPLICATE_EVENT_SUBSCRIPTION("An event subscription duplicates an existing event subscription"),
DUPLICATE_META_SUBSCRIPTION("An meta subscription duplicates an existing meta subscription"),
DUPLICATE_PLAN_PRIORITY(
"A plan priority was duplicated during the initialization phase of the simulation when plans from a previous simulation execution can be added to the current simulation"),
DUPLICATE_EXPERIMENT_OPEN("Duplicate opening of experiment"),
DUPLICATE_LABELER_ID_IN_EVENT_LABELER("Duplicate labeler id in labeler"),
DUPLICATE_PLAN_KEY("There is an existing plan currently scheduled with the same key"),
DUPLICATE_PLUGIN("There are two or more plugins with the same id"),
INCOMPATIBLE_SCEANARIO_PROGRESS("The scenario progress file is incompatible with the current experiment"),
LABLER_GENERATED_LABEL_WITH_INCORRECT_EVENT_CLASS("Event labler generated a label with an incorrect event class"),
LABLER_GENERATED_LABEL_WITH_INCORRECT_ID("Event labler generated a label with an incorrect event labeler id"),
LABLER_GENERATED_LABEL_WITH_INCORRECT_PRIMARY_KEY("Event labler generated a label with an incorrect primary key"),
MISSING_PLUGIN("A plugin is missing"), NEGATIVE_THREAD_COUNT("Negative thread count"),
NON_EXISTANT_SCEANARIO_PROGRESS(
"The scenario progress file does not exist, but is required when continuation from progress file is chosen"),
NULL_ACTOR_CONTEXT_CONSUMER("Null actor context consumer"),
NULL_REPORT_CONTEXT_CONSUMER("Null report context consumer"), NULL_ACTOR_ID("Null actor id"),
NULL_BASE_DATE("Null base date"), NULL_DATA_MANAGER("Null data manager"), NULL_DATA_VIEW("Null data view"),
NULL_DATA_MANAGER_CLASS("Null data manager class"), NULL_DATA_VIEW_CLASS("Null data view class"),
NULL_DATA_MANAGER_CONTEXT_CONSUMER("Null data manager context consumer"),
NULL_DATA_MANAGER_STATE_CONTEXT_CONSUMER("Null data manager state context consumer"),
NULL_REPORT_STATE_CONTEXT_CONSUMER("Null report state context consumer"),
NULL_ACTOR_STATE_CONTEXT_CONSUMER("Null actor state context consumer"),
NULL_CLASS_REFERENCE("Null class reference"), NULL_EVENT("Event is null"), NULL_EVENT_CLASS("Null event class"),
NULL_EVENT_CONSUMER("Null event consumer"), NULL_EVENT_LABEL("Null event label"),
NULL_EVENT_LABEL_FUNCTION("Null event label function"), NULL_EVENT_LABEL_KEY("Null event label key"),
NULL_EVENT_LABELER("Null event labeler"), NULL_EVENT_LABELER_ID("Null event labeler id"),
NULL_EXPERIMENT_CONTEXT_CONSUMER("Null experiment context consumer"),
NULL_LABELER_ID_IN_EVENT_LABEL("Event label returns a null event labeler id"),
NULL_LABELER_ID_IN_EVENT_LABELER("Event labeler returns a null id"), NULL_META_DATA("Null meta data"),
NULL_OUTPUT_HANDLER("Null output item handler"), NULL_OUTPUT_ITEM("Null output"), NULL_PLAN("Null plan"),
NULL_PLAN_CONSUMER("Null plan consumer"), NULL_PLAN_DATA("Null plan data"),
NULL_PLAN_KEY("Null planning key"),
NULL_PLUGIN("Null plugin"), NULL_PLUGINS("Null collection of plugins"), NULL_PLUGIN_CONTEXT("Null plugin context"),
NULL_PLUGIN_DATA("Null plugin data"),
NULL_PLUGIN_DATA_BUILDER("A null plugin data builder instance was added to the context"),
NULL_PLUGIN_DATA_CLASS("Null plugin data class"), NULL_PLUGIN_ID("Null plugin id"),
NULL_PLUGIN_INITIALIZER("Null plugin initializer"), NULL_PRIMARY_KEY_VALUE("Null primary key value"),
NULL_SCENARIO_ID("Null scenario id"), NULL_SCENARIO_PROGRESS_FILE("Null scenario progress file"),
NULL_SIMULATION_CONTEXT("Null simulation context"), NULL_SIMULATION_TIME("Null simulation time"),
PAST_PLANNING_TIME("Plan execution time is in the past"),
PLANNING_QUEUE_CLOSED("The planning phase of the simulation is over and plans may not be added"),
PLUGIN_INITIALIZATION_CLOSED("Plugin context is no longer valid"),
REPEATED_EXECUTION("Attempted repeat execution of simulation engine"),
REPORT_ATTEMPTING_MUTATION("A report is attempting to mutate data state"),
DATA_MANAGER_ATTEMPTING_MUTATION("A data manager is attempting to mutate data state after event flow has stopped"),
SCENARIO_CANNOT_BE_EXECUTED("Scenario cannot be executed"),
SCENARIO_FAILED("Scenario failed to complete execution"),
MISSING_SIM_HALT_TIME(
"Simulation halt time must be set when simulation state is being recorded at the end of a simulation run"),
SIM_HALT_TIME_TOO_EARLY(
"When a simulation halt time is non-negative, it must be greater than or equal to the start time of the simulation"),
TERMINAL_PLAN_DATA_ACCESS_VIOLATION("There is no access to terminal plan data until the simulation closes"),
UNCLOSABLE_EXPERIMENT("Cannot close an experiment not in the open state"),
UNKNOWN_ACTOR_ID("Actor id does not correspond to a known actor"), UNKNOWN_DATA_MANAGER("Unknown data manager"),
UNKNOWN_DATA_VIEW("Unknown data view"),
UNKNOWN_EVENT_LABELER("The labeler id an event label does not match a registered event labeler"),
UNKNOWN_PLUGIN_DATA_BUILDER_CLASS("The plugin data builder class was not found"),
UNKNOWN_PLUGIN_DATA_CLASS("The plugin data class was not found"), UNKNOWN_SCENARIO_ID("Unknown scenario id"),
UNREADABLE_SCEANARIO_PROGRESS("The scenario progress file is unreadable"),
OBSERVATION_EVENT_IMPROPER_RELEASE(
"An observation event is being released during a mutation by a data manager without the use of a corresponding mutation event"),
UNKNOWN_FUNCTION_ID("Unknown event function id"), NULL_FUNCTION_ID("Null function id"),
NULL_FUNCTION_VALUE("Null event function value"), NULL_FUNCTION("Null function"),
NULL_IDENTIFIABLE_FUNCTION("Null identifiable function"), NULL_EVENT_FILTER("Null event filter"),
INVALID_PLAN_ARRIVAL_ID("The given plan id is invalid. It either needs to be >=0, or -1, and nothing else"),
INVALID_DIMENSION_LEVEL("Invalid Dimension Level"),
UNKNOWN_DIMENSION_LEVEL_NAME("The given level name is not known"),
DUPLICATE_DIMENSION_LEVEL_NAME("Duplicate Dimension Level Name"),
NULL_DIMENSION_LEVEL_NAME("Null Dimension level name"),;

ACCESS_VIOLATION("A contributed behavior is accessing locked state during a state change"),//
AMBIGUOUS_DATA_MANAGER_CLASS("Multiple data manager matches found"),//
AMBIGUOUS_PLUGIN_DATA_BUILDER_CLASS("Multiple plugin data builder matches found"),//
AMBIGUOUS_PLUGIN_DATA_CLASS("Multiple plugin data object matches found"),//
CIRCULAR_PLUGIN_DEPENDENCIES("Circular plugin dependencies were found"),//
DATA_MANAGER_ACCESS_VIOLATION("A data manager is attempting to access another data manager that is incompatible with the plugin dependencies"),//
DATA_MANAGER_ATTEMPTING_MUTATION("A data manager is attempting to mutate data state after event flow has stopped"),//
DATA_MANAGER_DUPLICATE_INITIALIZATION("Data manager was already initialized"),//
DATA_MANAGER_INITIALIZATION_FAILURE("Data manager base class was not properly initialized, be sure to call super()"),//
DIMENSION_LABEL_MISMATCH("The number of scenario labels provided by a dimension level do not match the number of labels in the dimension's meta data"),//
DUPLICATE_DATA_MANAGER_TYPE("Duplicate data manager type"),//
DUPLICATE_EVENT_SUBSCRIPTION("An event subscription duplicates an existing event subscription"),//
DUPLICATE_EXPERIMENT_OPEN("Duplicate opening of experiment"),//
DUPLICATE_PLUGIN("There are two or more plugins with the same id"),//
INCOMPATIBLE_SCEANARIO_PROGRESS("The scenario progress file is incompatible with the current experiment"),//
INVALID_DIMENSION_LEVEL("Invalid Dimension Level"),//
INVALID_PLAN_ARRIVAL_ID("The given plan id is invalid. It either needs to be >=0, or -1, and nothing else"),//
MISSING_PLUGIN("A plugin is missing"),//
MISSING_SIM_HALT_TIME("Simulation halt time must be set when simulation state is being recorded at the end of a simulation run"),//
NEGATIVE_THREAD_COUNT("Negative thread count"),//
NON_EXISTANT_SCEANARIO_PROGRESS("The scenario progress file does not exist, but is required when continuation from progress file is chosen"),//
NULL_ACTOR_CONTEXT_CONSUMER("Null actor context consumer"),//
NULL_ACTOR_ID("Null actor id"),//
NULL_BASE_DATE("Null base date"),//
NULL_CLASS_REFERENCE("Null class reference"),//
NULL_DATA_MANAGER("Null data manager"),//
NULL_DATA_MANAGER_CLASS("Null data manager class"),//
NULL_DATA_MANAGER_CONTEXT_CONSUMER("Null data manager context consumer"),//
NULL_EVENT("Event is null"),//
NULL_EVENT_CLASS("Null event class"),//
NULL_EVENT_CONSUMER("Null event consumer"),//
NULL_EVENT_FILTER("Null event filter"),//
NULL_EXPERIMENT_CONTEXT_CONSUMER("Null experiment context consumer"),//
NULL_FUNCTION("Null function"),//
NULL_FUNCTION_ID("Null function id"),//
NULL_FUNCTION_VALUE("Null event function value"),//
NULL_IDENTIFIABLE_FUNCTION("Null identifiable function"),//
NULL_META_DATA("Null meta data"),//
NULL_OUTPUT_HANDLER("Null output item handler"),//
NULL_OUTPUT_ITEM("Null output"),//
NULL_PLAN("Null plan"),//
NULL_PLAN_CONSUMER("Null plan consumer"),//
NULL_PLUGIN("Null plugin"),//
NULL_PLUGIN_CONTEXT("Null plugin context"),//
NULL_PLUGIN_DATA("Null plugin data"),//
NULL_PLUGIN_DATA_CLASS("Null plugin data class"),//
NULL_PLUGIN_ID("Null plugin id"),//
NULL_PLUGIN_INITIALIZER("Null plugin initializer"),//
NULL_PLUGINS("Null collection of plugins"),//
NULL_REPORT_CONTEXT_CONSUMER("Null report context consumer"),//
NULL_SCENARIO_ID("Null scenario id"),//
NULL_SCENARIO_PROGRESS_FILE("Null scenario progress file"),//
NULL_SIMULATION_CONTEXT("Null simulation context"),//
NULL_SIMULATION_TIME("Null simulation time"),//
OBSERVATION_EVENT_IMPROPER_RELEASE("An observation event is being released during a mutation by a data manager without the use of a corresponding mutation event"),//
PAST_PLANNING_TIME("Plan execution time is in the past"),//
PLANNING_QUEUE_ACTIVE("The planning queue is still active and plans cannot be retrieved"),//
PLANNING_QUEUE_CLOSED("The planning phase of the simulation is over and plans may not be added"),//
PLUGIN_INITIALIZATION_CLOSED("Plugin context is no longer valid"),//
REPEATED_EXECUTION("Attempted repeat execution of simulation engine"),//
REPORT_ATTEMPTING_MUTATION("A report is attempting to mutate data state"),//
SCENARIO_CANNOT_BE_EXECUTED("Scenario cannot be executed"),//
SIM_HALT_TIME_TOO_EARLY("When a simulation halt time is non-negative, it must be greater than or equal to the start time of the simulation"),//
UNCLOSABLE_EXPERIMENT("Cannot close an experiment not in the open state"),//
UNKNOWN_ACTOR_ID("Actor id does not correspond to a known actor"),//
UNKNOWN_DATA_MANAGER("Unknown data manager"),//
UNKNOWN_DIMENSION_LEVEL_NAME("The given level name is not known"),//
UNKNOWN_FUNCTION_ID("Unknown event function id"),//
UNKNOWN_PLUGIN_DATA_BUILDER_CLASS("The plugin data builder class was not found"),//
UNKNOWN_PLUGIN_DATA_CLASS("The plugin data class was not found"),//
UNKNOWN_SCENARIO_ID("Unknown scenario id"),//
UNREADABLE_SCEANARIO_PROGRESS("The scenario progress file is unreadable"),//
;

private final String description;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,12 +947,6 @@ protected void halt() {

private Consumer<Object> outputConsumer;

protected void validatePlanKeyNotNull(final Object key) {
if (key == null) {
throw new ContractException(NucleusError.NULL_PLAN_KEY, "");
}
}

protected void releaseOutput(Object output) {
if (outputConsumer != null) {
outputConsumer.accept(output);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
* description of the exception.
*/
public enum TestError implements ContractError {
MULTIPLE_MATCHING_ITEMS("Multiple items were found matching "),
DUPLICATE_TEST_SCENARIO_REPORTS("Duplicate test scenario reports"),
MISSING_TEST_SCENARIO_REPORTS("Missing test scenario report likely due to not including a TestPlugin"),
DUPLICATE_TEST_SCENARIO_REPORTS("Duplicate test scenario reports"), NULL_ALIAS("Null alias value"),
NULL_OUTPUT_ITEM("Null released output item"), NULL_PLUGIN_ID("Null plugin id"),
NULL_DATA_MANAGER_SUPPLIER("Null data manager supplier"), NULL_PLAN("Null plan"),
MULTIPLE_MATCHING_ITEMS("Multiple items were found matching "),
NULL_ALIAS("Null alias value"),
NULL_DATA_MANAGER_SUPPLIER("Null data manager supplier"),
NULL_OUTPUT_ITEM("Null released output item"),
NULL_PLAN("Null plan"),
NULL_PLUGIN_ID("Null plugin id"),
TEST_EXECUTION_FAILURE("Not all action plans were executed or no action plans were added to the test plugin"),
UNKNOWN_DATA_MANAGER_ALIAS(
"A data manager test plan was submitted under an alias that does not have a test data manager class type"),;
UNKNOWN_DATA_MANAGER_ALIAS("A data manager test plan was submitted under an alias that does not have a test data manager class type"),
;

private final String description;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
*/
public enum GlobalPropertiesError implements ContractError {

NULL_GLOBAL_DATA_MANGER("Null global data manager"), NULL_GLOBAL_PLUGIN_DATA("Null global plugin data"),
NULL_GLOBAL_PROPERTY_REPORT_PLUGIN_DATA("Null global property report plugin data"),
NULL_GLOBAL_PROPERTY_INITIALIZATION("Null global property initialization"),;

NULL_GLOBAL_PLUGIN_DATA("Null global plugin data"),//
NULL_GLOBAL_PROPERTY_INITIALIZATION("Null global property initialization"),//
NULL_GLOBAL_PROPERTY_REPORT_PLUGIN_DATA("Null global property report plugin data"),//
;

private final String description;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,25 @@
*/
public enum GroupError implements ContractError {

NEGATIVE_GROUP_ID("group id is negative"), NEGATIVE_GROUP_COUNT("group count is negative"),
NEXT_GROUP_ID_TOO_SMALL("The next group id must exceed all extant group ids"),
NULL_GROUP_INITIALIZATION_DATA("Null group initialization data"),
NULL_GROUP_DATA_MANAGER("Null group data manager"), NULL_GROUP_PLUGIN_DATA("null groupsplugin data"),
NULL_GROUP_POPULATION_REPORT_PLUGIN_DATA("Null group population report plugin data"),
NULL_GROUP_PROPERTY_REPORT_PLUGIN_DATA("Null group property report plugin data"),
DUPLICATE_GROUP_MEMBERSHIP("Person was previously assigned to group"),
GROUP_MEMBERSHIP_ASYMMETRY("Person-group relationships are asymmetric"),
DUPLICATE_GROUP_TYPE("Duplicate group type"),
MALFORMED_GROUP_SAMPLE_WEIGHTING_FUNCTION(
"Data used to form an enumerated distribution for group sampling was malformed"),
NON_GROUP_MEMBERSHIP("Person is not currently assigned to group"),
NULL_GROUP_CONSTRUCTION_INFO("Null group construction info"), NULL_GROUP_ID("Null group id"),
NULL_GROUP_SAMPLER("Null group sampler"), NULL_GROUP_TYPE_ID("Null group type id"),
UNKNOWN_GROUP_ID("Unknown group id"), INCORRECT_GROUP_TYPE_ID("incorrect group type id for a group"),
UNKNOWN_GROUP_TYPE_ID("Unknown group type id"),;
DUPLICATE_GROUP_MEMBERSHIP("Person was previously assigned to group"),//
DUPLICATE_GROUP_TYPE("Duplicate group type"),//
GROUP_MEMBERSHIP_ASYMMETRY("Person-group relationships are asymmetric"),//
INCORRECT_GROUP_TYPE_ID("incorrect group type id for a group"),//
MALFORMED_GROUP_SAMPLE_WEIGHTING_FUNCTION("Data used to form an enumerated distribution for group sampling was malformed"),//
NEGATIVE_GROUP_ID("group id is negative"), NEGATIVE_GROUP_COUNT("group count is negative"),//
NEXT_GROUP_ID_TOO_SMALL("The next group id must exceed all extant group ids"),//
NON_GROUP_MEMBERSHIP("Person is not currently assigned to group"),//
NULL_GROUP_CONSTRUCTION_INFO("Null group construction info"),//
NULL_GROUP_ID("Null group id"),//
NULL_GROUP_INITIALIZATION_DATA("Null group initialization data"),//
NULL_GROUP_PLUGIN_DATA("null groupsplugin data"),//
NULL_GROUP_POPULATION_REPORT_PLUGIN_DATA("Null group population report plugin data"),//
NULL_GROUP_PROPERTY_REPORT_PLUGIN_DATA("Null group property report plugin data"),//
NULL_GROUP_SAMPLER("Null group sampler"),//
NULL_GROUP_TYPE_ID("Null group type id"),//
UNKNOWN_GROUP_ID("Unknown group id"),//
UNKNOWN_GROUP_TYPE_ID("Unknown group type id"),//
;

private final String description;

Expand Down
Loading

0 comments on commit fa133a0

Please sign in to comment.