pub enum BricksDomain {
    Top,
    Value(Vec<BrickDomain>),
}
Expand description

The BricksDomain contains a sorted list of single normalized BrickDomains. It represents the composition of a string through sub sequences.

Variants§

§

Top

The Top value represents an invalid sequence.

§

Value(Vec<BrickDomain>)

This values represents a sequence of string subsequences.

Implementations§

source§

impl BricksDomain

source

pub fn widen(&self, other: &BricksDomain) -> Self

The widen function of the BricksDomain widens the values during a merge. If the two BrickDomain lists are not comparable or either list exceeds the length threshold, Top is returned. Otherwise, the shorter list is padded and the widen function of the BrickDomain is applied to each element in both lists. If after the widening all BrickDomain values are Top, return the Top value for the BricksDomain.

source

pub fn all_bricks_are_top(bricks: &[BrickDomain]) -> bool

Checks whether all bricks of the BricksDomain are Top values. If so, the BricksDomain itself should be converted into a Top value.

source

pub fn is_less_or_equal(&self, other: &BricksDomain) -> bool

Checks whether the current BricksDomain is less or equal than the other BricksDomain by definition of the partial order.

source§

impl BricksDomain

source

pub fn normalize(&self) -> Self

A set of strings can be built from multiple configurations of bricks e.g. [{abc}]^{1,1} <=> [{a}]^{1,1}[{b}]^{1,1}[{c}]^{1,1}

Introducing a normalized form [T]^{1,1} or [T]^{0, max>0} will keep string representations unambiguous.

Normalizing can be seen as some kind of fixpoint for a set of 5 rules that are applied to the list of bricks until the state stays unchanged:

  1. remove bricks of the form [{}]^{0,0} empty string
  2. merge successive bricks with the same indices max = 1, min = 1, in a new single brick. The new string set is the concatenation of the former two. e.g. B0 = [{a,cd}]^{1,1} and B1 = [{b,ef}]^{1,1} become B_new = [{ab, aef, cdb, cdef}]^{1,1}.
  3. transform a brick in which the number of applications is constant (min = max) into one in which min = max = 1. e.g. B = [{a,b}]^{2,2} => B_new = [{aa, ab, ba, bb}]^{1,1}.
  4. merge two successive bricks in which the set of strings is the same. e.g. B1 = [S]^{m1, M1} and B2 = [S]^{m2, M2} => B_new = [S]^{m1+m2, M1+M2}
  5. break a single brick with min >= 1 and max != min into two simpler bricks where B = [S]^{min,max} => B1 = [S^min]^{1,1}, B2 = [S]^{0, max-min}. e.g. B = [{a}]^{2,5} => B1 = [{aa}]^{1,1}, B2 = [{a}]^{0,3}

Since normalization is rather expensive w.r.t. runtime and since it could entail a precision loss, it is only computed after a merge or widening operation.

Trait Implementations§

source§

impl AbstractDomain for BricksDomain

source§

fn merge(&self, other: &Self) -> Self

Takes care of merging lists of bricks

source§

fn is_top(&self) -> bool

Check if the value is Top.

source§

fn merge_with(&mut self, other: &Self) -> &mut Self

Returns an upper bound (with respect to the partial order on the domain) for the two inputs self and other. Read more
source§

impl Clone for BricksDomain

source§

fn clone(&self) -> BricksDomain

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for BricksDomain

source§

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

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for BricksDomain

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for BricksDomain

source§

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

Formats the value using the given formatter. Read more
source§

impl DomainInsertion for BricksDomain

source§

fn append_string_domain(&self, string_domain: &Self) -> Self

Appends new bricks to the current BricksDomain. Used to insert format specifier in sprintf calls and for strcat call.

source§

fn create_float_value_domain() -> Self

Create a string domain that approximates float values.

source§

fn create_char_domain() -> Self

Create a string domain that approximates char values.

source§

fn create_integer_domain() -> Self

Create a string domain that approximates integer values.

source§

fn create_pointer_value_domain() -> Self

Create a string domain that approximates pointer values.

source§

fn create_top_value_domain() -> Self

Creates a top value of the domain.

source§

fn create_empty_string_domain() -> Self

Create a string domain that represents an empty string.

source§

impl From<String> for BricksDomain

source§

fn from(string: String) -> Self

Returns a new instance of the Bricks Domain

source§

impl HasTop for BricksDomain

source§

fn top(&self) -> Self

Return a Top value

source§

impl PartialEq for BricksDomain

source§

fn eq(&self, other: &BricksDomain) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for BricksDomain

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for BricksDomain

source§

impl StructuralEq for BricksDomain

source§

impl StructuralPartialEq for BricksDomain

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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>,

§

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<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,