RobotDsl

io.github.srs.model.entity.dynamicentity.dsl.RobotDsl
object RobotDsl

The DSL for creating and configuring a Robot entity.

Attributes

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

Members list

Value members

Concrete methods

def robot: Robot

Creates a new Robot with default properties.

Creates a new Robot with default properties.

Attributes

Validates a Robot entity to ensure it meets the domain constraints.

Validates a Robot entity to ensure it meets the domain constraints.

Value parameters

r

the Robot entity to validate.

Attributes

Returns

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

Extensions

Extensions

extension (robot: Robot)
infix def and(actuator: Actuator[Robot]): Robot

Another way to add an actuator to the robot.

Another way to add an actuator to the robot.

Value parameters

actuator

the actuator to add.

Attributes

Returns

a new Robot instance with the actuator added.

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

Adds a sensor to the robot.

Adds a sensor to the robot.

Value parameters

sensor

the sensor to add.

Attributes

Returns

a new Robot instance with the sensor added.

infix def at(position: Point2D): Robot

Sets the position of the robot.

Sets the position of the robot.

Value parameters

position

the new position of the robot.

Attributes

Returns

a new Robot instance with the updated position.

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

Adds an actuator to the robot.

Adds an actuator to the robot.

Value parameters

actuator

the actuator to add.

Attributes

Returns

a new Robot instance with the actuator added.

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

Adds a sensor to the robot.

Adds a sensor to the robot.

Value parameters

sensor

the sensor to add.

Attributes

Returns

a new Robot instance with the sensor added.

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

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

Attributes

Returns

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

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

Adds an actuator to the robot.

Adds an actuator to the robot.

Value parameters

actuator

the actuator to add.

Attributes

Returns

a new Robot instance with the actuator added.

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

Sets the actuators of the robot.

Sets the actuators of the robot.

Value parameters

actuators

the new sequence of actuators for the robot.

Attributes

Returns

a new Robot instance with the updated actuators.

infix def withBehavior(behavior: Policy): Robot

Extension methods for Robot to allow DSL-like configuration.

Extension methods for Robot to allow DSL-like configuration.

Attributes

infix def withId(id: UUID): Robot

Extension methods for Robot to allow DSL-like configuration.

Extension methods for Robot to allow DSL-like configuration.

Attributes

Extension methods for Robot to allow DSL-like configuration.

Extension methods for Robot to allow DSL-like configuration.

Attributes

infix def withOrientation(orientation: Orientation): Robot

Sets the orientation of the robot.

Sets the orientation of the robot.

Value parameters

orientation

the new orientation of the robot.

Attributes

Returns

a new Robot instance with the updated orientation.

Extension methods for Robot to allow DSL-like configuration.

Extension methods for Robot to allow DSL-like configuration.

Attributes

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

Adds a sensor to the robot.

Adds a sensor to the robot.

Value parameters

sensor

the sensor to add.

Attributes

Returns

a new Robot instance with the sensor added.

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

Sets the sensors of the robot.

Sets the sensors of the robot.

Value parameters

sensors

the new sequence of sensors for the robot.

Attributes

Returns

a new Robot instance with the updated sensors.

infix def withShape(shape: Circle): Robot

Sets the shape of the robot.

Sets the shape of the robot.

Value parameters

shape

the new shape of the robot.

Attributes

Returns

a new Robot instance with the updated shape.

infix def withSpeed(speed: Double): Robot

Extension methods for Robot to allow DSL-like configuration.

Extension methods for Robot to allow DSL-like configuration.

Attributes