IterativeProcess

abstract class IterativeProcess<T>(name: String? = null) : Observable<T> , IdentityIfc, IterativeProcessIfc

Constructors

Link copied to clipboard
constructor(name: String? = null)

Types

Link copied to clipboard
open inner class IterativeState(name: String)

Properties

Link copied to clipboard

The iterative process may end by a variety of means, this checks if the iterative process ended because it ran all of its steps, true if all completed

Link copied to clipboard
open override var beginExecutionTime: Instant

Returns system time in nanoseconds that the iterative process started

Link copied to clipboard

Gets the clock time as a Duration since the iterative process was initialized

Link copied to clipboard
open override var endExecutionTime: Instant

Returns system time in nanoseconds that the iterative process ended

Link copied to clipboard

Indicates the status of the iterative process

Link copied to clipboard
open override val id: Int
Link copied to clipboard
open override val isCreated: Boolean

Checks if the iterative process is in the created state. If the iterative process is in the created state this method will return true

Link copied to clipboard
open override var isDone: Boolean

A flag to indicate whether the iterative process is done A iterative process can be done if: 1) it ran all of its steps 2) it was ended by a client prior to completing all of its steps 3) it ended because it exceeded its maximum allowable execution time before completing all of its steps. 4) its end condition was satisfied

Link copied to clipboard
open override val isEnded: Boolean

Checks if the iterative process is in the ended state. After the iterative process has been ended this property will return true

Link copied to clipboard

Returns if the elapsed execution time exceeds the maximum time allowed. Only true if the maximum was set and elapsed time is greater than or equal to getMaximumAllowedExecutionTime()

Link copied to clipboard
open override val isInitialized: Boolean

Checks if the iterative process is in the initialized state After the iterative process has been initialized this method will return true

Link copied to clipboard
open override var isRunning: Boolean

An iterative process is running if it has been told to run (i.e. runNext()) but has not yet been told to end().

Link copied to clipboard
open override var isRunningStep: Boolean

Indicates that the iterative process is currently running an individual step

Link copied to clipboard
open override val isStepCompleted: Boolean

Checks if the iterative process is in the completed step state After the iterative process has successfully completed a step this property will be true

Link copied to clipboard

The iterative process may end by a variety of means, this method checks if the iterative process ended but was unfinished, not all steps completed

Link copied to clipboard
open override var label: String?
Link copied to clipboard

The maximum allotted (suggested) execution (real) clock for the entire iterative process in nanoseconds. This is a suggested time because the execution time requirement is only checked after the completion of an individual step After it is discovered that cumulative time for executing the step has exceeded the maximum time, then the iterative process will be ended (perhaps) not completing other steps.

Link copied to clipboard
open override val name: String
Link copied to clipboard

Indicates that the iterative process ended because of no steps

Link copied to clipboard
open override var numberStepsCompleted: Int

Returns the number of steps completed since the iterative process was last initialized

Link copied to clipboard

The iterative process may end by a variety of means, this method checks if the iterative process ended because it was stopped, true if it was stopped via stop()

Link copied to clipboard
open override var stopping: Boolean

Returns the stopping flag

Link copied to clipboard
open override var stoppingMessage: String?

A string message for why stop() was called.

Functions

Link copied to clipboard
open override fun attachObserver(observer: ObserverIfc<T>)

Allows the adding (attaching) of an observer to the observable

Link copied to clipboard
open override fun countObservers(): Int

Returns how many observers are currently attached to the observable

Link copied to clipboard
open override fun detachAllObservers()

Detaches all the observers from the observable

Link copied to clipboard
open override fun detachObserver(observer: ObserverIfc<T>)

Allows the deletion (removing) of an observer from the observable

Link copied to clipboard
override fun end(msg: String?)

The iterative process will continue until there are no more steps or its maximum execution time has been reached, whichever comes first. If this method is called the iterative process will stop processing (terminate) before the next step and not process the next step in the process. The current step will be completed. This method can be used to stop the process at an arbitrary step. Once stopped, the process must be restarted.

Link copied to clipboard
abstract fun hasNextStep(): Boolean

This method should check to see if another step is necessary for the iterative process. True means that the process has another step to be executed. False, means that no more steps are available for execution.

Link copied to clipboard
override fun initialize()

Initializes the iterative process prior to running any steps This must be done prior to calling runNext();

Link copied to clipboard
open override fun isAttached(observer: ObserverIfc<T>): Boolean

Returns true if the observer is already attached

Link copied to clipboard
fun <T> Observable<T>.observe(block: (T?) -> Unit)
Link copied to clipboard
override fun run()

Runs all the steps of the iterative process.

Link copied to clipboard
override fun runNext()

Runs the next step in the iterative process

Link copied to clipboard
override fun stop(msg: String?)

This sets a flag to indicate to the process that is should stop after the next step is completed. This is different than end(). Calling end() immediately places the process in the End state. The process needs to be in a valid state before end() can be used. Calling stop tells the process to eventually get into the end state. stop() can be used to arbitrarily stop the process based on some user defined condition.

Link copied to clipboard
open override fun toString(): String