object SimulationResult
A helper to share values between the simluation and the testing code
Since simulations run with a different classloader than the code that spawns them, it is usually difficult to share values between them. This class allows doing so, using a string-indexed map.
The underlying implementation is se.sics.kompics.simulator.result.SimulationResultSingleton.
SimulationResult += ("test" -> 1); /* Pass 1 to the simulation */ SimpleSimulation.scenario.simulate(classOf[LauncherComp]); /* The simulation runs and sets "test" to 2 */ SimulationResult[Int]("test") should be(2); /* Get the new value from the simulation */
- Alphabetic
- By Inheritance
- SimulationResult
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- def +=[V](t: (String, V)): Unit
Put a value into the map
Put a value into the map
Overrides existing values, if any.
- V
the type of the value to be put
- t
a key-value tuple
SimulationResult += ("test" -> 1);
Example: - final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply[V](key: String)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[V]): V
Get the value at
key
from the map cast toV
Get the value at
key
from the map cast toV
Throws an exception, if the actual value can't be cast to
V
or the key doesn't exist.This only works for basic JVM types. If you need to pass a custom type, use convert instead.
- V
the type to cast the value to
- key
the key to look up
- returns
the value at
key
cast toV
- See also
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def convert[V <: Serializable](key: String)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[V]): Try[V]
Get the value at
key
from the map and try convert it toV
, if possibleGet the value at
key
from the map and try convert it toV
, if possibleThis method tries to use Serializable when the object can't simply be cast to
V
. This happens in particular when it is of a custom class, with its instances loaded by two different classloaders.- V
the type to convert the value to
- key
the key to look up
- returns
the value at
key
converted toV
wrapped into an Try
- See also
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def get[V](key: String)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[V]): Option[V]
Get the value at
key
from the map cast toV
, if possibleGet the value at
key
from the map cast toV
, if possibleReturns None, if the actual value can't be cast to
V
or the key doesn't exist.This only works for basic JVM types. If you need to pass a custom type, use convert instead.
- V
the type to cast the value to
- key
the key to look up
- returns
the value at
key
cast toV
wrapped into an Option
- See also
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])