cognition.decision.state¶
Re-usable state components
Classes¶
State that internally handles reinitialization. |
|
State that self-serves elaboration. |
|
Container for state that... |
|
Convenience special case of |
Module Contents¶
- class cognition.decision.state.SelfReinitState¶
State that internally handles reinitialization.
Supply a subclass instance to a decision process as a
state_initializerand the result will be internal control about dp reinit.- _reinit()¶
Override to implement custom reinit logic
- Return type:
None
- __call__()¶
- Return type:
Self
- class cognition.decision.state.SelfElaborationState¶
Bases:
SelfReinitStateState that self-serves elaboration.
A decision process that uses an instance’s
elaboratorproperty will provide it an opportunity for elaboration (during the phase), whose read-only results are then accessible via a protected property (that can then be exposed via state-designer preference).- ELABORATOR_NAME: str = 'self_elab'¶
Name of the resulting elaborator
- property elaborator: cognition.decision.core.Elaborator[Self]¶
- Returns:
fixed elaborator for this instance
- Return type:
- _elaborate(io)¶
Override to implement custom elaboration logic
- Parameters:
io (cognition.decision.core.IOContainer) – access to current IO
- Returns:
name=value set for current elaboration
- Return type:
collections.abc.Mapping[str, Any]
- class cognition.decision.state.PTEState[P, T](p_init_value, t_init)¶
Bases:
SelfElaborationStateContainer for state that…
is (P)ersistant across dp reinitialization;
is (T)ransient, and so is reset each dp reinit; and
is (E)laborated each cycle based upon P/T state + IO via a custom implementation of _elaborate
- Parameters:
p_init_value (P) – initial value of persistent state
t_init (cognition.util.functypes.Supplier[T]) – function to (re)initialize transient state
- property p: P¶
- Returns:
persistent state
- Return type:
P
- property t: T¶
- Returns:
transient state
- Return type:
T
- property e: cognition.util.misc.AttrReferral¶
- Returns:
elaborated state
- Return type:
- __str__()¶
- Return type:
str