Class StudyStep

java.lang.Object
com.amalgamasimulation.studies.core.StudyStep
Direct Known Subclasses:
ScenarioStudyStep, Study

public abstract class StudyStep extends Object
  • Constructor Details

    • StudyStep

      protected StudyStep(StudyStep parent)
  • Method Details

    • id

      public ShortId id()
    • name

      public abstract String name()
    • completedFraction

      public double completedFraction()
    • errorsFraction

      public double errorsFraction()
    • isRunning

      public boolean isRunning()
    • elapsedTimeMillis

      public int elapsedTimeMillis()
    • errorsCount

      public int errorsCount()
    • childrenReplicationSteps

      public List<ReplicationStudyStep> childrenReplicationSteps()
    • correctChildrenResults

      public ResultsList correctChildrenResults()
    • estimatedRemainingTimeMillis

      public int estimatedRemainingTimeMillis()
    • run

      public void run(BiFunction<org.eclipse.emf.ecore.EObject,Integer,Run<?>> runSupplier, Supplier<Boolean> cancellationMonitor, Runnable runCompletionHandler)
    • hasReattachableRemoteRuns

      public boolean hasReattachableRemoteRuns(Predicate<ShortId> remoteRunAwarenessChecker)
      Returns true if any of descendants() represents a run that had been executed remotely before this study was saved to a file.
    • reattachToRemoteRuns

      public void reattachToRemoteRuns(Predicate<ShortId> remoteRunAwarenessChecker, BiFunction<ShortId,Integer,Run<?>> runSupplier, Supplier<Boolean> cancellationMonitor, Runnable runCompletionHandler)
      Creates remote runs 'attached' to remotely running experiments that had been submitted to the Cloud Server earlier.
      Parameters:
      remoteRunAwarenessChecker - checks that the Cloud Server knows a run with the provided id
      runSupplier - creates a run attached to the remotely executing run
      cancellationMonitor - object to check if user has requested a stop
      runCompletionHandler - callback to be called when a Run is completed
    • parentStudy

      public Optional<Study> parentStudy()
    • parents

      public List<StudyStep> parents()
    • parent

      public Optional<StudyStep> parent()
    • children

      public List<StudyStep> children()
      Returns immediate children of this study step.
    • descendants

      public List<StudyStep> descendants()
      Returns the result of the depth-first traversal of the study step tree, starting with the current study step.
      See Also:
    • replicationsCount

      public int replicationsCount()
    • parentScenarioStudyStep

      public Optional<ScenarioStudyStep> parentScenarioStudyStep()
    • addChild

      public void addChild(StudyStep childToAdd)
    • addChild

      public void addChild(StudyStep childToAdd, int index)
    • removeChild

      public void removeChild(StudyStep childToRemove)
    • changeReplicationsCount

      public abstract void changeReplicationsCount(int newReplicationsCount)
    • copy

      public abstract StudyStep copy(StudyStep parent)
      Creates a deep copy of this StudyStep and all its children, establishing the specified parent for the cloned StudyStep. This method performs a recursive clone of the entire subtree, maintaining the hierarchical structure.

      The cloning process includes:

      • Creating a new StudyStep instance with the same name and data as this node
      • Setting the specified parent for the cloned StudyStep
      • Creating deep copies of all child nodes, with each child having its parent set to the newly created clone of this node
      Parameters:
      parent - the StudyStep that will become the parent of the cloned StudyStep.
      Returns:
      a new StudyStep instance that is a deep copy of this StudyStep, with all child nodes recursively cloned and the specified parent set