pub struct Scenario<'a> { /* private fields */ }Expand description
The representation of a scenario. A moment consisting of various events, the present actors and any predicates that apply to either.
Implementations§
Source§impl<'a> Scenario<'a>
impl<'a> Scenario<'a>
Sourcepub fn parse(s: &'a str) -> Result<Self, ScenarioParsingError>
pub fn parse(s: &'a str) -> Result<Self, ScenarioParsingError>
Parses a scenario from a string.
let s = "<a (Red), b, c (Blue, Red); {(Green)}, {A: a}, {P: c (Blue)}> lambda a x pa_Blue(x); lambda a x pa_Red(x)";
let scenario = Scenario::parse(s).unwrap();
assert_eq!(scenario.to_string(), s);§Errors
Will return an error if the Scenario is incorrectly formatted.
Source§impl<'a> Scenario<'a>
impl<'a> Scenario<'a>
Sourcepub fn all_scenarios(
actors: &[Actor<'a>],
event_kinds: &[PossibleEvent<'a>],
actor_properties: &[&'a str],
max_number_of_events: Option<usize>,
max_number_of_actors: Option<usize>,
max_number_of_properties: Option<usize>,
) -> ScenarioIterator<'a> ⓘ
pub fn all_scenarios( actors: &[Actor<'a>], event_kinds: &[PossibleEvent<'a>], actor_properties: &[&'a str], max_number_of_events: Option<usize>, max_number_of_actors: Option<usize>, max_number_of_properties: Option<usize>, ) -> ScenarioIterator<'a> ⓘ
Returns a ScenarioIterator which goes over all possible scenarios with the provided
actors and event descriptions
Source§impl<'a> Scenario<'a>
impl<'a> Scenario<'a>
Sourcepub fn new(
actors: Vec<Actor<'a>>,
thematic_relations: Vec<ThetaRoles<'a>>,
properties: BTreeMap<&'a str, Vec<Entity<'a>>>,
) -> Scenario<'a>
pub fn new( actors: Vec<Actor<'a>>, thematic_relations: Vec<ThetaRoles<'a>>, properties: BTreeMap<&'a str, Vec<Entity<'a>>>, ) -> Scenario<'a>
Create a new scenario.
Sourcepub fn thematic_relations(&self) -> &[ThetaRoles<'a>]
pub fn thematic_relations(&self) -> &[ThetaRoles<'a>]
Get the representation of all events as a slice of ThetaRoles.
Sourcepub fn properties(&self) -> &BTreeMap<&'a str, Vec<Entity<'a>>>
pub fn properties(&self) -> &BTreeMap<&'a str, Vec<Entity<'a>>>
Get the properties (e.g. what predicates apply) of the entities in a scenario.
Sourcepub fn questions(&self) -> &[RootedLambdaPool<'a, Expr<'a>>]
pub fn questions(&self) -> &[RootedLambdaPool<'a, Expr<'a>>]
Get the questions associated with a scenario (which may be empty if there are no questions).
Questions are representated as RootedLambdaPool which return a truth value.
Sourcepub fn question_mut(&mut self) -> &mut Vec<RootedLambdaPool<'a, Expr<'a>>>
pub fn question_mut(&mut self) -> &mut Vec<RootedLambdaPool<'a, Expr<'a>>>
Get a mutable reference to the questions of a scenario.
See Scenario::questions
Trait Implementations§
Source§impl<'de: 'a, 'a> Deserialize<'de> for Scenario<'a>
impl<'de: 'a, 'a> Deserialize<'de> for Scenario<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl<'a> Eq for Scenario<'a>
impl<'a> StructuralPartialEq for Scenario<'a>
Auto Trait Implementations§
impl<'a> Freeze for Scenario<'a>
impl<'a> RefUnwindSafe for Scenario<'a>
impl<'a> Send for Scenario<'a>
impl<'a> Sync for Scenario<'a>
impl<'a> Unpin for Scenario<'a>
impl<'a> UnwindSafe for Scenario<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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>
Converts
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>
Converts
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§impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
impl<'src, T> IntoMaybe<'src, T> for Twhere
T: 'src,
§impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
impl<'p, T> Seq<'p, T> for Twhere
T: Clone,
§type Iter<'a> = Once<&'a T>
where
T: 'a
type Iter<'a> = Once<&'a T> where T: 'a
An iterator over the items within this container, by reference.
§fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
fn contains(&self, val: &T) -> boolwhere
T: PartialEq,
Check whether an item is contained within this sequence.
§fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
fn to_maybe_ref<'b>(item: <T as Seq<'p, T>>::Item<'b>) -> Maybe<T, &'p T>where
'p: 'b,
Convert an item of the sequence into a [
MaybeRef].