pub struct Observer<T = f32> { /* private fields */ }Expand description
Observer actors monitor the system without directly intervening. They collect data, analyze patterns, and build context but do not initiate transformations.
Implementations§
Source§impl<T> Observer<T>
impl<T> Observer<T>
Sourcepub fn new() -> Observer<T>where
T: FromPrimitive,
pub fn new() -> Observer<T>where
T: FromPrimitive,
Create a new observer
Sourcepub const fn is_initialized(&self) -> bool
pub const fn is_initialized(&self) -> bool
returns true if the observer is initialized
Sourcepub const fn is_uninitialized(&self) -> bool
pub const fn is_uninitialized(&self) -> bool
returns true if the observer is not initialized
Sourcepub const fn threshold_mut(&mut self) -> &mut T
pub const fn threshold_mut(&mut self) -> &mut T
returns a mutable reference to the observation threshold
Sourcepub const fn observations(&self) -> &VecDeque<(LPR, Triads, Triads)>
pub const fn observations(&self) -> &VecDeque<(LPR, Triads, Triads)>
returns an immutable reference to the observations
Sourcepub const fn observations_mut(&mut self) -> &mut VecDeque<(LPR, Triads, Triads)>
pub const fn observations_mut(&mut self) -> &mut VecDeque<(LPR, Triads, Triads)>
returns a mutable reference to the observations
Sourcepub const fn tonal_regions(&self) -> &HashMap<[usize; 3], String>
pub const fn tonal_regions(&self) -> &HashMap<[usize; 3], String>
returns an immutable reference to the tonal regions
Sourcepub const fn tonal_regions_mut(&mut self) -> &mut HashMap<[usize; 3], String>
pub const fn tonal_regions_mut(&mut self) -> &mut HashMap<[usize; 3], String>
returns a mutable reference to the tonal regions
Sourcepub fn set_id(&mut self, id: Id) -> &mut Observer<T>
pub fn set_id(&mut self, id: Id) -> &mut Observer<T>
update the current id and return a mutable reference to the observer
Sourcepub fn set_threshold(&mut self, threshold: T) -> &mut Observer<T>where
T: Float,
pub fn set_threshold(&mut self, threshold: T) -> &mut Observer<T>where
T: Float,
update the current threshold and return a mutable reference to the observer
Sourcepub fn set_observations(
&mut self,
observations: VecDeque<(LPR, Triads, Triads)>,
) -> &mut Observer<T>
pub fn set_observations( &mut self, observations: VecDeque<(LPR, Triads, Triads)>, ) -> &mut Observer<T>
update the current observations and return a mutable reference to the observer
Sourcepub fn set_tonal_regions(
&mut self,
tonal_regions: HashMap<[usize; 3], String>,
) -> &mut Observer<T>
pub fn set_tonal_regions( &mut self, tonal_regions: HashMap<[usize; 3], String>, ) -> &mut Observer<T>
update the current tonal regions and return a mutable reference to the observer
Sourcepub fn initialized(self) -> Observer<T>
pub fn initialized(self) -> Observer<T>
consumes the current instance to toggle the initialized flag
Sourcepub fn with_id(self, id: Id) -> Observer<T>
pub fn with_id(self, id: Id) -> Observer<T>
consumes the current instance to create another with the given ID
Sourcepub fn with_observations(
self,
observations: VecDeque<(LPR, Triads, Triads)>,
) -> Observer<T>
pub fn with_observations( self, observations: VecDeque<(LPR, Triads, Triads)>, ) -> Observer<T>
consumes the current instance to create another with the given observations
Sourcepub fn with_threshold(self, threshold: T) -> Observer<T>where
T: Float,
pub fn with_threshold(self, threshold: T) -> Observer<T>where
T: Float,
consumes the current instance to create another with the given threshold
Sourcepub fn with_tonal_regions(
self,
tonal_regions: HashMap<[usize; 3], String>,
) -> Observer<T>
pub fn with_tonal_regions( self, tonal_regions: HashMap<[usize; 3], String>, ) -> Observer<T>
consumes the current instance to create another with the given tonal regions
Sourcepub fn initialize(self) -> Observer<T>
pub fn initialize(self) -> Observer<T>
set the initialized flag to true
Sourcepub fn observation_count(&self) -> usize
pub fn observation_count(&self) -> usize
Get the number of transformations observed
Sourcepub fn analyze_patterns(&self, memory: &TopoLedger<T>) -> Vec<(Vec<LPR>, T)>where
T: Float + FromPrimitive,
pub fn analyze_patterns(&self, memory: &TopoLedger<T>) -> Vec<(Vec<LPR>, T)>where
T: Float + FromPrimitive,
Analyze recent transformations for patterns
Sourcepub fn analyze_critical_points<D>(&self, vnode: &VNode<D>) -> Vec<(String, T)>
pub fn analyze_critical_points<D>(&self, vnode: &VNode<D>) -> Vec<(String, T)>
Analyze critical points in relation to triad
Trait Implementations§
Source§impl<D, T> Actor<D, T> for Observer<T>
impl<D, T> Actor<D, T> for Observer<T>
Source§fn initialize(&mut self) -> Result<(), ActorError>
fn initialize(&mut self) -> Result<(), ActorError>
Source§fn process_transform(
&mut self,
transform: LPR,
plant: &mut D,
_memory: &mut TopoLedger<T>,
) -> Result<bool, ActorError>
fn process_transform( &mut self, transform: LPR, plant: &mut D, _memory: &mut TopoLedger<T>, ) -> Result<bool, ActorError>
Source§fn process_message(
&mut self,
_source: IndexBase<usize, EdgeIndex>,
_message: &[u8],
_memory: &mut TopoLedger<T>,
) -> Result<(), ActorError>
fn process_message( &mut self, _source: IndexBase<usize, EdgeIndex>, _message: &[u8], _memory: &mut TopoLedger<T>, ) -> Result<(), ActorError>
Source§fn on_activate(
&mut self,
_plant: &D,
_memory: &mut TopoLedger<T>,
) -> Result<(), ActorError>
fn on_activate( &mut self, _plant: &D, _memory: &mut TopoLedger<T>, ) -> Result<(), ActorError>
Source§fn on_deactivate(
&mut self,
_plant: &D,
memory: &mut TopoLedger<T>,
) -> Result<(), ActorError>
fn on_deactivate( &mut self, _plant: &D, memory: &mut TopoLedger<T>, ) -> Result<(), ActorError>
Source§fn resource_requirements(&self) -> (usize, usize)
fn resource_requirements(&self) -> (usize, usize)
Source§fn allows_pattern_sharing(&self) -> bool
fn allows_pattern_sharing(&self) -> bool
Source§fn contextualize(
&self,
plant: &D,
memory: &TopoLedger<T>,
) -> Result<ActorContext<T>, ActorError>
fn contextualize( &self, plant: &D, memory: &TopoLedger<T>, ) -> Result<ActorContext<T>, ActorError>
impl<T> Eq for Observer<T>
Auto Trait Implementations§
impl<T> Freeze for Observer<T>where
T: Freeze,
impl<T> RefUnwindSafe for Observer<T>where
T: RefUnwindSafe,
impl<T> Send for Observer<T>where
T: Send,
impl<T> Sync for Observer<T>where
T: Sync,
impl<T> Unpin for Observer<T>where
T: Unpin,
impl<T> UnwindSafe for Observer<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more