Struct CEStructure

Source
pub struct CEStructure { /* private fields */ }
Expand description

A single c-e structure.

Internally, instances of this type own structural information (the cause and effect polynomials), the intermediate content representation from which a c-e structure originated (optionally), and some auxiliary recomputable data. Other properties are available indirectly: CEStructure instance owns a ContextHandle which resolves to a shared Context object.

Implementations§

Source§

impl CEStructure

Source

pub fn new( ctx: &Arc<Mutex<Context>>, origin: Rc<dyn ContentFormat>, ) -> CEStructure

Creates an empty c-e structure in a Context given by a ContextHandle.

See also a specialized variant of this method, new_interactive().

Source

pub fn new_interactive(ctx: &Arc<Mutex<Context>>) -> CEStructure

Creates an empty c-e structure in a Context given by a ContextHandle, and sets content origin to InteractiveFormat.

This is a specialized variant of the new() method.

Source

pub fn add_causes<'a, I>( &mut self, node_id: NodeID, poly_ids: I, ) -> Result<(), AcesError>
where I: IntoIterator + 'a, <I as IntoIterator>::Item: IntoIterator<Item = &'a NodeID>,

Constructs new Polynomial from a sequence of sequences of NodeIDs and adds it to causes of a node of this CEStructure.

This method is incremental: new polynomial is added to old polynomial that is already attached to the node_id as node’s causes (there is always some polynomial attached, if not explicitly, then implicitly, as the default θ).

Source

pub fn add_effects<'a, I>( &mut self, node_id: NodeID, poly_ids: I, ) -> Result<(), AcesError>
where I: IntoIterator + 'a, <I as IntoIterator>::Item: IntoIterator<Item = &'a NodeID>,

Constructs new Polynomial from a sequence of sequences of NodeIDs and adds it to effects of a node of this CEStructure.

This method is incremental: new polynomial is added to old polynomial that is already attached to the node_id as node’s effects (there is always some polynomial attached, if not explicitly, then implicitly, as the default θ).

Source

pub fn add_from_content( &mut self, content: Box<dyn Content>, ) -> Result<(), AcesError>

Extends this c-e structure with another one, which is created in the Context of the old c-e structure from a given Content trait object.

Source

pub fn with_content( self, content: Box<dyn Content>, ) -> Result<CEStructure, AcesError>

Extends this c-e structure with another one, which is created in the Context of the old c-e structure from a given Content trait object.

Source

pub fn add_from_str<S>( &mut self, script: S, formats: &[Rc<dyn ContentFormat>], ) -> Result<Rc<dyn ContentFormat>, Box<dyn Error>>
where S: AsRef<str>,

Extends this c-e structure with another one, which is created in the Context of the old c-e structure from a given textual description.

The script is interpreted according to an appropriate format of content description listed in the formats array.

On success, returns the chosen format as a ContentFormat trait object.

Source

pub fn add_from_str_as_origin<S>( &mut self, script: S, formats: &[Rc<dyn ContentFormat>], ) -> Result<(), Box<dyn Error>>
where S: AsRef<str>,

Extends this c-e structure with another one, which is created in the Context of the old c-e structure from a given textual description.

The script is interpreted according to an appropriate format of content description listed in the formats array.

On success, stores the chosen format as the new content origin.

Source

pub fn from_str<S>( ctx: &Arc<Mutex<Context>>, script: S, formats: &[Rc<dyn ContentFormat>], ) -> Result<CEStructure, Box<dyn Error>>
where S: AsRef<str>,

Creates a new c-e structure from a textual description, in a Context given by a ContextHandle.

Source

pub fn add_from_file<P>( &mut self, path: P, formats: &[Rc<dyn ContentFormat>], ) -> Result<Rc<dyn ContentFormat>, Box<dyn Error>>
where P: AsRef<Path>,

Extends this c-e structure with another one, which is created in the Context of the old c-e structure from a script file to be found along the path.

The script file is interpreted according to an appropriate format of content description listed in the formats array.

On success, returns the chosen format as a ContentFormat trait object.

Source

pub fn add_from_file_as_origin<P>( &mut self, path: P, formats: &[Rc<dyn ContentFormat>], ) -> Result<(), Box<dyn Error>>
where P: AsRef<Path>,

Extends this c-e structure with another one, which is created in the Context of the old c-e structure from a script file to be found along the path.

The script file is interpreted according to an appropriate format of content description listed in the formats array.

On success, stores the chosen format as the new content origin.

Source

pub fn from_file<P>( ctx: &Arc<Mutex<Context>>, path: P, formats: &[Rc<dyn ContentFormat>], ) -> Result<CEStructure, Box<dyn Error>>
where P: AsRef<Path>,

Creates a new c-e structure from a script file to be found along the path, in a Context given by a ContextHandle.

Source

pub fn get_context(&self) -> &Arc<Mutex<Context>>

Source

pub fn get_name(&self) -> Option<&str>

Source

pub fn is_coherent(&self) -> bool

Returns link coherence status indicating whether this object represents a proper c-e structure.

C-e structure is coherent iff it has no thin links, where a link is thin iff it occurs either in causes or in effects, but not in both. Internally, there is a thin links counter associated with each CEStructure object. This counter is updated whenever a polynomial is added to the structure.

Source

pub fn get_fork_join_formula(&self) -> Result<Formula, AcesError>

Source

pub fn get_formula(&self) -> Result<Formula, AcesError>

Source

pub fn check_coherence(&self) -> Result<(), AcesError>

Source

pub fn solve(&mut self) -> Result<(), AcesError>

Source

pub fn get_firing_set(&self) -> Option<&FiringSet>

Trait Implementations§

Source§

impl Debug for CEStructure

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<Reference, Outer, OuterFieldType, Inner> HasPart<Nested<Outer, Inner>> for Reference
where Reference: HasPart<Outer> + ?Sized, Outer: Part<PartType = Field<OuterFieldType>>, Inner: Part, OuterFieldType: HasPart<Inner, RawTarget = OuterFieldType> + PartialRefTarget + ?Sized,

Source§

unsafe fn part_ptr( ptr: *const <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::Ptr

Given a constant pointer to a target, produce a constant pointer to a part of it.
Source§

unsafe fn part_ptr_mut( ptr: *mut <Reference as PartialRefTarget>::RawTarget, ) -> <<Inner as Part>::PartType as PartType>::PtrMut

Given a mutable pointer to a target, produce a mutable pointer to a part of it.
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V