-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #908 from NASA-AMMOS/904-parameterizedduration-ann…
…otation ParametricDuration annotation
- Loading branch information
Showing
12 changed files
with
328 additions
and
76 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...tion/src/main/java/gov/nasa/jpl/aerie/banananation/activities/DownloadBananaActivity.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,44 @@ | ||
package gov.nasa.jpl.aerie.banananation.activities; | ||
|
||
import gov.nasa.jpl.aerie.banananation.Mission; | ||
import gov.nasa.jpl.aerie.merlin.framework.annotations.ActivityType; | ||
import gov.nasa.jpl.aerie.merlin.framework.annotations.ActivityType.EffectModel; | ||
import gov.nasa.jpl.aerie.merlin.framework.annotations.ActivityType.ParametricDuration; | ||
import gov.nasa.jpl.aerie.merlin.framework.annotations.Export.Parameter; | ||
import gov.nasa.jpl.aerie.merlin.protocol.types.Duration; | ||
|
||
import static gov.nasa.jpl.aerie.merlin.framework.ModelActions.delay; | ||
|
||
/** | ||
* Internet technology has come a long way. | ||
* | ||
* @subsystem fruit | ||
* @contact Jane Doe | ||
*/ | ||
@ActivityType("DownloadBanana") | ||
public final class DownloadBananaActivity { | ||
|
||
public enum ConnectionType { | ||
DSL, | ||
FiberOptic, | ||
DietaryFiberOptic | ||
} | ||
|
||
@Parameter | ||
public ConnectionType connection = ConnectionType.DSL; | ||
|
||
@ParametricDuration | ||
public Duration duration() { | ||
return switch (this.connection) { | ||
case DSL -> Duration.HOUR; | ||
case FiberOptic -> Duration.of(10, Duration.MINUTE); | ||
case DietaryFiberOptic -> Duration.MINUTE; | ||
}; | ||
} | ||
|
||
@EffectModel | ||
public void run(final Mission mission) { | ||
delay(duration()); | ||
mission.fruit.add(1); | ||
} | ||
} |
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
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
Oops, something went wrong.