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
impl BricksDomain
sourcepub fn widen(&self, other: &BricksDomain) -> Self
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.
sourcepub fn all_bricks_are_top(bricks: &[BrickDomain]) -> bool
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.
sourcepub fn is_less_or_equal(&self, other: &BricksDomain) -> bool
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
impl BricksDomain
sourcepub fn normalize(&self) -> Self
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:
- remove bricks of the form [{}]^{0,0} empty string
- 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}.
- 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}.
- 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}
- 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
impl AbstractDomain for BricksDomain
source§impl Clone for BricksDomain
impl Clone for BricksDomain
source§fn clone(&self) -> BricksDomain
fn clone(&self) -> BricksDomain
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BricksDomain
impl Debug for BricksDomain
source§impl<'de> Deserialize<'de> for BricksDomain
impl<'de> Deserialize<'de> for BricksDomain
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>,
source§impl Display for BricksDomain
impl Display for BricksDomain
source§impl DomainInsertion for BricksDomain
impl DomainInsertion for BricksDomain
source§fn append_string_domain(&self, string_domain: &Self) -> Self
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
fn create_float_value_domain() -> Self
Create a string domain that approximates float values.
source§fn create_char_domain() -> Self
fn create_char_domain() -> Self
Create a string domain that approximates char values.
source§fn create_integer_domain() -> Self
fn create_integer_domain() -> Self
Create a string domain that approximates integer values.
source§fn create_pointer_value_domain() -> Self
fn create_pointer_value_domain() -> Self
Create a string domain that approximates pointer values.
source§fn create_top_value_domain() -> Self
fn create_top_value_domain() -> Self
Creates a top value of the domain.
source§fn create_empty_string_domain() -> Self
fn create_empty_string_domain() -> Self
Create a string domain that represents an empty string.
source§impl From<String> for BricksDomain
impl From<String> for BricksDomain
source§impl PartialEq for BricksDomain
impl PartialEq for BricksDomain
source§fn eq(&self, other: &BricksDomain) -> bool
fn eq(&self, other: &BricksDomain) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for BricksDomain
impl Serialize for BricksDomain
impl Eq for BricksDomain
impl StructuralEq for BricksDomain
impl StructuralPartialEq for BricksDomain
Auto Trait Implementations§
impl RefUnwindSafe for BricksDomain
impl Send for BricksDomain
impl Sync for BricksDomain
impl Unpin for BricksDomain
impl UnwindSafe for BricksDomain
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
§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
§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
key
and return true
if they are equal.