AgentDsl

io.github.srs.model.entity.dynamicentity.agent.dsl.AgentDsl
object AgentDsl

The DSL for creating and configuring an Agent entity.

Attributes

Example
 import io.github.srs.model.entity.dynamicentity.agent.dsl.AgentDsl.*
 val myAgent = agent at Point2D(1.0, 2.0) withShape ShapeType.Circle(0.5) withOrientation Orientation(90.0) containing WheelMotor() withSensors SensorSuite.empty
 myAgent.validate match
   case Right(validAgent) => println(s"Valid agent: $validAgent")
   case Left(error) => println(s"Validation error: $error.errorMessage")
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
AgentDsl.type

Members list

Value members

Concrete methods

def agent: Agent

Creates a new Agent with default properties.

Creates a new Agent with default properties.

Attributes

Validates an Agent entity to ensure it meets the domain constraints.

Validates an Agent entity to ensure it meets the domain constraints.

Value parameters

a

the Agent entity to validate.

Attributes

Returns

Right if the agent is valid, or Left with a validation

Validates a Sensor to ensure it meets the domain constraints.

Validates a Sensor to ensure it meets the domain constraints.

Value parameters

sensor

the Sensor to validate.

Attributes

Returns

Right if the sensor is valid, or Left with a validation error.

Extensions

Extensions

extension (agent: Agent)
infix def and(actuator: Actuator[Agent]): Agent

Another way to add an actuator to the agent.

Another way to add an actuator to the agent.

Value parameters

actuator

the actuator to add.

Attributes

Returns

a new Agent instance with the actuator added.

infix def and(sensor: Sensor[Agent, Environment]): Agent

Adds a sensor to the agent.

Adds a sensor to the agent.

Value parameters

sensor

the sensor to add.

Attributes

Returns

a new Agent instance with the sensor added.

infix def at(position: Point2D): Agent

Sets the position of the agent.

Sets the position of the agent.

Value parameters

position

the new position of the agent.

Attributes

Returns

a new Agent instance with the updated position.

infix def containing(actuator: Actuator[Agent]): Agent

Adds an actuator to the agent.

Adds an actuator to the agent.

Value parameters

actuator

the actuator to add.

Attributes

Returns

a new Agent instance with the actuator added.

infix def containing(sensor: Sensor[Agent, Environment]): Agent

Adds a sensor to the agent.

Adds a sensor to the agent.

Value parameters

sensor

the sensor to add.

Attributes

Returns

a new Agent instance with the sensor added.

Validates the agent entity to ensure it meets the domain constraints.

Validates the agent entity to ensure it meets the domain constraints.

Attributes

Returns

Right if the agent is valid, or Left with a validation error message if it is not.

infix def withActuator(actuator: Actuator[Agent]): Agent

Adds an actuator to the agent.

Adds an actuator to the agent.

Value parameters

actuator

the actuator to add.

Attributes

Returns

a new Agent instance with the actuator added.

infix def withActuators(actuators: Seq[Actuator[Agent]]): Agent

Sets the actuators of the agent.

Sets the actuators of the agent.

Value parameters

actuators

the new sequence of actuators for the agent.

Attributes

Returns

a new Agent instance with the updated actuators.

infix def withId(id: UUID): Agent

Extension methods for Agent to allow DSL-like configuration.

Extension methods for Agent to allow DSL-like configuration.

Attributes

Extension methods for Agent to allow DSL-like configuration.

Extension methods for Agent to allow DSL-like configuration.

Attributes

infix def withOrientation(orientation: Orientation): Agent

Sets the orientation of the agent.

Sets the orientation of the agent.

Value parameters

orientation

the new orientation of the agent.

Attributes

Returns

a new Agent instance with the updated orientation.

Extension methods for Agent to allow DSL-like configuration.

Extension methods for Agent to allow DSL-like configuration.

Attributes

infix def withReward(reward: Reward): Agent

Extension methods for Agent to allow DSL-like configuration.

Extension methods for Agent to allow DSL-like configuration.

Attributes

infix def withSensor(sensor: Sensor[Agent, Environment]): Agent

Adds a sensor to the agent.

Adds a sensor to the agent.

Value parameters

sensor

the sensor to add.

Attributes

Returns

a new Agent instance with the sensor added.

infix def withSensors(sensors: Seq[Sensor[Agent, Environment]]): Agent

Sets the sensors of the agent.

Sets the sensors of the agent.

Value parameters

sensors

the new sequence of sensors for the agent.

Attributes

Returns

a new Agent instance with the updated sensors.

infix def withShape(shape: Circle): Agent

Sets the shape of the agent.

Sets the shape of the agent.

Value parameters

shape

the new shape of the agent.

Attributes

Returns

a new Agent instance with the updated shape.

infix def withSpeed(speed: Double): Agent

Extension methods for Agent to allow DSL-like configuration.

Extension methods for Agent to allow DSL-like configuration.

Attributes

infix def withTermination(termination: Termination): Agent

Extension methods for Agent to allow DSL-like configuration.

Extension methods for Agent to allow DSL-like configuration.

Attributes

infix def withTruncation(truncation: Truncation): Agent

Extension methods for Agent to allow DSL-like configuration.

Extension methods for Agent to allow DSL-like configuration.

Attributes