utils
Members list
Type members
Classlikes
Represents a binary decision node in the decision tree.
Represents a binary decision node in the decision tree.
A DecisionNode evaluates a predicate against the context and branches to either a trueBranch or a falseBranch accordingly.
Type parameters
- Ctx
-
The context type.
- Res
-
The result type.
Value parameters
- falseBranch
-
The DecisionTree to evaluate if the predicate returns false.
- predicate
-
A function that takes the context and returns a boolean, determining the branch to follow.
- trueBranch
-
The DecisionTree to evaluate if the predicate returns true.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents a generic decision tree structure.
Represents a generic decision tree structure.
This sealed trait provides the common interface for all nodes within the decision tree, ensuring that any concrete node can evaluate a given context to produce a result. The use of a sealed trait ensures that all possible implementations are known at compile time, enabling exhaustive pattern matching and enhancing type safety.
Type parameters
- Ctx
-
The type of the context (input) on which the decision tree operates.
- Res
-
The type of the result (output) produced by the decision tree.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Represents a leaf node in the decision tree.
Represents a leaf node in the decision tree.
A Leaf node is a terminal point in the tree, directly providing a result based on an associated action function without further branching.
Type parameters
- Ctx
-
The context type.
- Res
-
The result type.
Value parameters
- action
-
A function that takes the context and produces the final result for this leaf.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Represents a multi-way decision node in the decision tree.
Represents a multi-way decision node in the decision tree.
A MultiNode dispatches to one of several branches based on a key extracted from the context. It includes a default branch for keys that do not have a specific corresponding branch.
Type parameters
- Ctx
-
The context type.
- Key
-
The type of the key extracted from the context.
- Res
-
The result type.
Value parameters
- branches
-
A map associating keys with their respective decision tree branches.
- default
-
The default DecisionTree to evaluate if no matching key is found in 'branches'.
- keyOf
-
A function that extracts a key from the context to select a branch.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A type representing either a successful value or an error.
A type representing either a successful value or an error.
Result[T, E] is similar to Either[E, T] but with more intuitive naming where T represents the success type and E represents the error type. This is commonly used for error handling without exceptions.
Type parameters
- E
-
the type of the error value
- T
-
the type of the success value
Attributes
- Example
-
val success: Result[Int, String] = Result.Success(42) val failure: Result[Int, String] = Result.Failure("Something went wrong") val doubled = success.map(_ * 2) // Result.Success(84) val errorResult = failure.map(_ * 2) // Result.Failure("Something went wrong") - Companion
- object
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Object containing the Domain-Specific Language (DSL) for defining dynamic triggers.
Object containing the Domain-Specific Language (DSL) for defining dynamic triggers.
This DSL allows for the creation of clear, readable, and composable conditions used within the simulation's decision-making logic, such as in the DecisionManager.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
TriggerDSL.type
A 2D vector with double precision coordinates.
A 2D vector with double precision coordinates.
Represents a point or direction in 2D space with x and y components. Provides common vector operations including arithmetic, dot product, magnitude calculation, and normalization.
Value parameters
- x
-
the x-coordinate component
- y
-
the y-coordinate component
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all