MultiNode

utils.MultiNode
case class MultiNode[Ctx, Key, Res](keyOf: Ctx => Key, branches: Map[Key, DecisionTree[Ctx, Res]], default: DecisionTree[Ctx, Res]) extends DecisionTree[Ctx, Res]

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

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait DecisionTree[Ctx, Res]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

override def eval(ctx: Ctx): Res

Evaluates the MultiNode by determining a key from the context and selecting the corresponding branch. If no specific branch matches the key, the default branch is evaluated.

Evaluates the MultiNode by determining a key from the context and selecting the corresponding branch. If no specific branch matches the key, the default branch is evaluated.

Value parameters

ctx

The context object.

Attributes

Returns

The result from the selected branch.

Definition Classes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product