Packages

  • package root
    Definition Classes
    root
  • package se
    Definition Classes
    root
  • package sics
    Definition Classes
    se
  • package kompics
    Definition Classes
    sics
  • package sl

    This package contains the Scala DSL for Kompics.

    This package contains the Scala DSL for Kompics.

    It is recommended to import this as import se.sics.kompics.sl._, since it contains a number of implicit conversions and convenience methods that are good to have in scope.

    Definition Classes
    kompics
  • package simulator

    The Kompics Simulator DSL for Scala

    The Kompics Simulator DSL for Scala

    Definition Classes
    sl
    Example:
    1. case object SimpleSimulation {
      
        import Distributions._
        // needed for the distributions, but needs to be initialised after setting the seed
        implicit val random = JSimulationScenario.getRandom();
      
        private def intToAddress(i: Int): Address = {
          try {
            new TAddress(new InetSocketAddress(InetAddress.getByName("192.193.0." + i), 10000));
          } catch {
            case ex: UnknownHostException => throw new RuntimeException(ex);
          }
        }
      
        val startResultSetterOp = Op { (self: Integer) =>
          val selfAddr = intToAddress(self);
          StartNode(selfAddr, Init[ResultSetter](selfAddr))
        };
        val startPongerOp = Op { (self: Integer) =>
          val selfAddr = intToAddress(self)
          StartNode(selfAddr, Init[PongerParent](selfAddr))
        };
        val startPingerOp = Op { (self: Integer, ponger: Integer) =>
          val selfAddr = intToAddress(self);
          val pongerAddr = intToAddress(ponger);
          StartNode(selfAddr, Init[PingerParent](selfAddr, pongerAddr))
        };
      
        val scenario = raise(5, startPongerOp, 1.toN)
          .arrival(constant(1000.millis))
          .andThen(1000.millis)
          .afterTermination(raise(5, startPingerOp, 6.toN, 1.toN).arrival(constant(1000.millis)))
          .inParallel(raise(1, startResultSetterOp, 1.toN).arrival(constant(1000.millis)))
          .andThen(10000.millis)
          .afterTermination(Terminate);
      }
  • ChangeNetwork
  • Distributions
  • IntDistributions
  • KillNode
  • Op
  • Setup
  • SimulationResult
  • StartNode
  • StochasticProcess
  • StochasticProcessBuilder
  • StochasticProcessChain
  • Terminate
o

se.sics.kompics.sl.simulator

SimulationResult

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.

Example:
  1. 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 */
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SimulationResult
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. 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

    Example:
    1. SimulationResult += ("test" -> 1);
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. def apply[V](key: String)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[V]): V

    Get the value at key from the map cast to V

    Get the value at key from the map cast to V

    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 to V

    See also

    get

  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  8. 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 to V, if possible

    Get the value at key from the map and try convert it to V, if possible

    This 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 to V wrapped into an Try

    See also

    get

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  11. def get[V](key: String)(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[V]): Option[V]

    Get the value at key from the map cast to V, if possible

    Get the value at key from the map cast to V, if possible

    Returns 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 to V wrapped into an Option

    See also

    get

  12. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  13. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from AnyRef

Inherited from Any

Ungrouped