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 Objecttrait Matchableclass Any
- Self type
-
RobotDsl.type
Members list
Value members
Concrete methods
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
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.
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.
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.
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.
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.
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.
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.
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
Extension methods for Robot to allow DSL-like configuration.
Extension methods for Robot to allow DSL-like configuration.
Attributes
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
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.
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.
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.