SimulationResultHandler

class SimulationResultHandler(name: String, callback: String => Unit) extends ResultHandler[Option[String]]

Listens for the end of a named simulation and handles its result.

Value Params
callback

A function to handle the results of the simulation when it completes.

name

The name of the SimulationRef to listen for.

trait ResultHandler[Option[String]]
class Object
trait Matchable
class Any

Value members

Concrete methods

override
def onEvent(evt: Event): Unit

Handles an Event in the stream.

Handles an Event in the stream.

If the event is ESimEnd and the simulation name matches then we record the simulation result in simResult, unsubscribe, and call the callback function.

Definition Classes
override
def onInit(publisher: Publisher): Unit

Handles the initialisation of a new event stream.

Handles the initialisation of a new event stream.

Sets the publisher.

Definition Classes
override
def result: Option[String]

The result of the handler.

The result of the handler.

Returns

The result of the simulation or None if we have not received one (yet).

Definition Classes

Inherited methods

def onDone(publisher: Publisher): Unit

Handles the end of a stream.

Handles the end of a stream.

Value Params
publisher

The Publisher that ended the stream.

Inherited from
EventHandler
def onFail(e: Throwable, publisher: Publisher): Unit

Handles an error in the stream.

Handles an error in the stream.

Value Params
e

The throwable error that occurred.

publisher

The Publisher that threw the error.

Inherited from
EventHandler

Concrete fields

var publisher: Option[Publisher]

The Publisher of the stream.

The Publisher of the stream.

We assume to be subscribed to a single publisher. We then keep track of it so we can unsubscribe as soon as we get our result.

var simResult: Option[String]

The result of the simulation when we get it.

The result of the simulation when we get it.

Inherited fields

val id: UUID

A unique identifier for the handler.

A unique identifier for the handler.

Returns

a unique identifier

Inherited from
EventHandler