DecisionTree

utils.DecisionTree
sealed trait DecisionTree[Ctx, Res]

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

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class DecisionNode[Ctx, Res]
class Leaf[Ctx, Res]
class MultiNode[Ctx, Key, Res]

Members list

Value members

Abstract methods

def eval(ctx: Ctx): Res

Evaluates the decision tree (or subtree) with the given context.

Evaluates the decision tree (or subtree) with the given context.

This method traverses the tree structure, applying predicates or key lookups until a leaf node is reached, which then produces the final result.

Value parameters

ctx

The context object used for evaluation.

Attributes

Returns

The result produced by the decision tree based on the context.