Package com.tnsai.annotations
Annotation Interface Effect
Defines a structured effect (state modification) for planning.
Effects describe how an action changes the agent's state. Used by the planner to predict action outcomes.
Operations
| Operation | Description | Example |
|---|---|---|
| SET | Assign a value | state = ALIVE |
| ADD | Add to numeric | count = count + 1 |
| SUBTRACT | Subtract from numeric | energy = energy - 10 |
| MULTIPLY | Multiply numeric | score = score * 2 |
| TOGGLE | Flip boolean | isActive = !isActive |
| CLEAR | Set to null/empty | error = null |
| INCREMENT | Add 1 | counter++ |
| DECREMENT | Subtract 1 | counter-- |
Usage
@ActionSpec(
type = ActionType.LOCAL,
description = "Consume energy to perform action",
effects = {
@Effect(state = "energy", operation = Operation.SUBTRACT, value = "10"),
@Effect(state = "lastAction", operation = Operation.SET, value = "consume")
}
)
public void consumeEnergy() { ... }
- Author:
- TnsAI Team
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEffect operations for state modification. -
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionThe operation to perform on the state.The state field that this effect modifies. -
Optional Element Summary
Optional Elements
-
Element Details
-
state
String stateThe state field that this effect modifies.Should match a field annotated with @State.
- Returns:
- state field name
-
operation
Effect.Operation operationThe operation to perform on the state.- Returns:
- operation type
-
value
String valueThe value to use in the operation.Can be a literal ("ALIVE", "10") or a reference to another state/parameter.
- Returns:
- value string
- Default:
""
-
condition
String conditionOptional condition for conditional effects.Effect only applies if condition is true.
@Effect( state = "cellState", operation = Operation.SET, value = "DEAD", condition = "neighborCount < 2" )- Returns:
- condition expression
- Default:
""
-