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

    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);
      }
  • AnyPort
  • ComponentAndPort
  • ComponentDefinition
  • Config
  • Init
  • Kompics
  • NegativePort
  • NegativeWrapper
  • Port
  • PortAndComponent
  • PortAndPort
  • PositivePort
  • PositiveWrapper
  • PrimitiveConverters
  • SConv
  • ScalaComponent
  • ScalaComponentWrapper
  • ScalaPort

package sl

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.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. sl
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Package Members

  1. package simulator

    The Kompics Simulator DSL for Scala

    The Kompics Simulator DSL for Scala

    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);
      }

Type Members

  1. trait AnyPort extends AnyRef

    Methods for any kind of port no matter the direction

  2. case class ComponentAndPort[P <: PortType](posC: Component, neg: NegativePort[P]) extends Product with Serializable

    A named tuple for a port and a component

    A named tuple for a port and a component

    P

    the port type shared by the port and the component

  3. abstract class ComponentDefinition extends kompics.ComponentDefinition

    A Component Definition

  4. class Config extends AnyRef

    A convenience DSL wrapper around se.sics.kompics.config.Config

  5. type Handler = PartialFunction[KompicsEvent, Unit]

    The type returned by an uponEvent block.

  6. case class Init[T <: ComponentDefinition](params: Any*) extends kompics.Init[T] with Product with Serializable

    A convenient case class for matchable init events

    A convenient case class for matchable init events

    To assign values of the init instance to fields in a component use, for example:

    val (field1: String, field2: Int) = init;
    T

    the type of the component definition the init event is supposed to be used in

    params

    all init arguments for the component

  7. type Kill = kompics.Kill

  8. type Killed = kompics.Killed

  9. type KompicsEvent = kompics.KompicsEvent

    The supertype for any event.

    The supertype for any event.

    See also

    se.sics.kompics.KompicsEvent

  10. trait NegativePort[P <: PortType] extends Negative[P] with AnyPort

    Scala trait for a Negative port

  11. class NegativeWrapper[P <: PortType] extends NegativePort[P]

    A wrapper for java ports to implement NegativePort

  12. abstract class Port extends PortType

    The base class for a port type.

    The base class for a port type.

    To declare a new port type, extend this class in an object and then define the signature for the port, for example:

    object TestPort extends Port {
      request[TestEventClass];
      request(TestEventObject);
      indication[TestEventClass2];
      indication(TestEventObject2);
    }
  13. case class PortAndComponent[P <: PortType](pos: PositivePort[P], negC: Component) extends Product with Serializable

    A named tuple for a port and a component

    A named tuple for a port and a component

    P

    the port type shared by the port and the component

  14. case class PortAndPort[P <: PortType](pos: PositivePort[P], neg: NegativePort[P]) extends Product with Serializable

    A named tuple for two ports in opposite directions

    A named tuple for two ports in opposite directions

    P

    the port type shared by both ports

  15. trait PositivePort[P <: PortType] extends Positive[P] with AnyPort

    Scala trait for a Positive port

  16. class PositiveWrapper[P <: PortType] extends PositivePort[P]

    A wrapper for java ports to implement PositivePort

  17. abstract class SConv[T] extends Converter[T]

    A Scala converter variant of se.sics.kompics.config.Converter

    A Scala converter variant of se.sics.kompics.config.Converter

    T

    the target type of the converter

  18. class ScalaComponent extends ComponentCoreScala

    The Scala implementation of se.sics.kompics.Component

    The Scala implementation of se.sics.kompics.Component

    Attributes
    protected
  19. class ScalaComponentWrapper extends AnyRef

    A wrapper to augment java component with Scala DSL

    A wrapper to augment java component with Scala DSL

    An implicit converion is available in the companion object.

  20. class ScalaPort[P <: PortType] extends PortCore[P] with NegativePort[P] with PositivePort[P]

    A Scala implementation of the se.sics.kompics.PortCore

  21. type Start = kompics.Start

  22. type Started = kompics.Started

  23. type Stop = kompics.Stop

  24. type Stopped = kompics.Stopped

Value Members

  1. def !connect[P <: PortType](portType: P)(t: (Component, Component)): Channel[P]

    Connect two components on a Scala port object P.

    Connect two components on a Scala port object P.

    P

    the type of the port to connect on

    portType

    the instance object of the port type

    t

    a tuple of two components which povide P in opposite directions

    returns

    the newly created channel

    Example:
    1. `!connect`(P)(c1 -> c2)
  2. def !connect[P <: PortType](t: (Component, Component))(implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[P]): Channel[P]

    Connect two components on a Java port type P.

    Connect two components on a Java port type P.

    P

    the type of the port to connect on

    t

    a tuple of two components which povide P in opposite directions

    returns

    the newly created channel

    Example:
    1. `!connect`[P](c1 -> c2)
  3. def !connect[P <: PortType](t: ComponentAndPort[P]): Channel[P]

    Connect a component c to a negative port p of type P.

    Connect a component c to a negative port p of type P.

    P

    the type of the port to connect on

    t

    a tuple of a component and a port instance of type P

    returns

    the newly created channel

    Example:
    1. `!connect`[P](c -> p)
  4. def !connect[P <: PortType](t: PortAndComponent[P]): Channel[P]

    Connect a component c to a positive port p of type P.

    Connect a component c to a positive port p of type P.

    P

    the type of the port to connect on

    t

    a tuple of a port instance of type P and a component

    returns

    the newly created channel

    Example:
    1. `!connect`[P](p -> c)
  5. def !connect[P <: PortType](t: PortAndPort[P]): Channel[P]

    Connect a positive port p to a negative port n, both of type P.

    Connect a positive port p to a negative port n, both of type P.

    P

    the type of the port to connect on

    t

    two port instances of type P in opposite directions as a PortAndPort object

    returns

    the newly created channel

    Example:
    1. `!connect`[P](p -> n)
  6. def !trigger[P <: PortType](t: (KompicsEvent, kompics.Port[P]))(implicit cd: kompics.ComponentDefinition): Unit

    Trigger an event on a port via a component proxy.

    Trigger an event on a port via a component proxy.

    Must be used with a ComponentDefinition implicitly in context.

    P

    the port type of the port to trigger on

    t

    a tuple of a KompicsEvent and a port

    Example:
    1. `!trigger`(myEvent -> p)
  7. val Kill: kompics.Kill

  8. val Start: kompics.Start

  9. val Stop: kompics.Stop

  10. def asJavaClass[T](te: scala.reflect.api.JavaUniverse.Type): Class[T]

    Give the java class for a type

    Give the java class for a type

    T

    the target type

    te

    the type instance

    returns

    the java class for T

  11. def handler(matcher: Handler): Handler

    Conveniently create a Handler instance from a partial function of the right type

    Conveniently create a Handler instance from a partial function of the right type

    Does nothing really, and is only meant to enhance readability when handlers aren't subscribed immediately with uponEvent.

    matcher

    the partial function that forms the handler's body

    returns

    really just the partial function again

  12. implicit def option2optional[T](o: Option[T]): Optional[T]
  13. implicit def tuple2cnp[P <: PortType](t: (Component, NegativePort[P])): ComponentAndPort[P]

    Automatically create a ComponentAndPort from port instance and a component

    Automatically create a ComponentAndPort from port instance and a component

    P

    the shared port type for both port and component

    returns

    the new ComponentAndPort instance

  14. implicit def tuple2pnc[P <: PortType](t: (PositivePort[P], Component)): PortAndComponent[P]

    Automatically create a PortAndComponent from port instance and a component

    Automatically create a PortAndComponent from port instance and a component

    P

    the shared port type for both port and component

    returns

    the new PortAndComponent instance

  15. implicit def tuple2pnp[P <: PortType](t: (PositivePort[P], NegativePort[P])): PortAndPort[P]

    Automatically create a PortAndPort from two port instances of opposite directions

    Automatically create a PortAndPort from two port instances of opposite directions

    P

    the shared port type for both port instances

    returns

    the new PortAndPort instance

  16. object Config
  17. object Init extends Serializable

    Provides access to variants of empty init events.

  18. object Kompics

    Convenient object to forward static members of se.sics.kompics.Kompics.

  19. object NegativePort

    Companion object providing utilities to create a NegativePort from a se.sics.kompics.PortCore

  20. object PositivePort

    Companion object providing utilities to create a PositivePort from a se.sics.kompics.PortCore

  21. object PrimitiveConverters

    A collection of converters for Scala primitives for use with the configuration utilities of Kompics

  22. object ScalaComponent extends Serializable

    A companion with utilities.

  23. object ScalaPort

    Companion utilities for the ScalaPort

Deprecated Value Members

  1. def handle(closure: => Unit): Unit

    Does nothing in Kompics Scala 2.x.

    Does nothing in Kompics Scala 2.x.

    Simply remove it wherever encountered.

    Only provided for source compatibility with legacy Kompics Scala 1.x code.

    Annotations
    @deprecated
    Deprecated

    (Since version Kompics Scala 2.0.0) This is a no-op now and can safely be removed.

Inherited from AnyRef

Inherited from Any

Ungrouped