Struct espr::ir::Instantiables [−][src]
pub struct Instantiables {
pub parts: Vec<PartialComplexEntity>,
}
Expand description
Instantiable subtypes described by a list of partial complex entity, e.g. $[A, B & C]$
This has several operation described in ISO-10303-11 annex B, $+$, $-$, $\And$, and $/$.
- $A + [B_1, B_2] = [B_1, B_2] + A = [A, B_1, B_2]$
let a = PartialComplexEntity::new(&[1]);
let b1 = PartialComplexEntity::new(&[2]);
let b2 = PartialComplexEntity::new(&[3]);
let ce = Instantiables::new(&[b1.clone(), b2.clone()]);
assert_eq!(a.clone() + ce, Instantiables::new(&[
a.clone(),
b1.clone(),
b2.clone(),
]));
- $A \And [B_1, B_2] = [B_1, B_2] \And A = [A \And B_1, A \And B_2]$
let a = PartialComplexEntity::new(&[1]);
let b1 = PartialComplexEntity::new(&[2]);
let b2 = PartialComplexEntity::new(&[3]);
let ce = Instantiables::new(&[b1.clone(), b2.clone()]);
assert_eq!(a.clone() & ce, Instantiables::new(&[
a.clone() & b1.clone(),
a.clone() & b2.clone(),
]));
- $[A_1, A_2] + [B_1, B_2] = [A_1, A_2, B_1, B_2]$
let a1 = PartialComplexEntity::new(&[1]);
let a2 = PartialComplexEntity::new(&[2]);
let b1 = PartialComplexEntity::new(&[3]);
let b2 = PartialComplexEntity::new(&[4]);
let ce1 = Instantiables::new(&[a1.clone(), a2.clone()]);
let ce2 = Instantiables::new(&[b1.clone(), b2.clone()]);
assert_eq!(ce1 + ce2, Instantiables::new(&[
a1.clone(),
a2.clone(),
b1.clone(),
b2.clone(),
]));
- $[A_1, A_2] \And [B_1, B_2] = [A_1 \And B_1, A_1 \And B_2, A_2 \And B_1, A_2 \And B_2]$
let a1 = PartialComplexEntity::new(&[1]);
let a2 = PartialComplexEntity::new(&[2]);
let b1 = PartialComplexEntity::new(&[3]);
let b2 = PartialComplexEntity::new(&[4]);
let ce1 = Instantiables::new(&[a1.clone(), a2.clone()]);
let ce2 = Instantiables::new(&[b1.clone(), b2.clone()]);
assert_eq!(ce1 & ce2, Instantiables::new(&[
a1.clone() & b1.clone(),
a1.clone() & b2.clone(),
a2.clone() & b1.clone(),
a2.clone() & b2.clone(),
]));
- $[A, A \And B, A \And C, A \And B \And D, B \And C, D] / A = [A, A \And B, A \And C, A \And B \And D]$
let a = PartialComplexEntity::new(&[1]);
let b = PartialComplexEntity::new(&[2]);
let c = PartialComplexEntity::new(&[3]);
let d = PartialComplexEntity::new(&[4]);
let ce = Instantiables::new(&[
a.clone(),
a.clone() & b.clone(),
a.clone() & c.clone(),
a.clone() & b.clone() & d.clone(),
b.clone() & c.clone(),
d.clone()
]);
assert_eq!(ce / a.clone(), Instantiables::new(&[
a.clone(),
a.clone() & b.clone(),
a.clone() & c.clone(),
a.clone() & b.clone() & d.clone(),
]));
- $ [A, A \And B, A \And C, A \And B \And D, B \And C, D]/[B, D] = [A \And B, A \And B \And D, B \And C, D] $
let a = PartialComplexEntity::new(&[1]);
let b = PartialComplexEntity::new(&[2]);
let c = PartialComplexEntity::new(&[3]);
let d = PartialComplexEntity::new(&[4]);
let ce1 = Instantiables::new(&[
a.clone(),
a.clone() & b.clone(),
a.clone() & c.clone(),
a.clone() & b.clone() & d.clone(),
b.clone() & c.clone(),
d.clone()
]);
let ce2 = Instantiables::new(&[
b.clone(),
d.clone()
]);
assert_eq!(ce1 / ce2, Instantiables::new(&[
a.clone() & b.clone(),
a.clone() & b.clone() & d.clone(),
b.clone() & c.clone(),
d.clone()
]));
- $[A_1, A_2, B_1, B_2] − [A_2, B_1] = [A_1, B_2]$
let a1 = PartialComplexEntity::new(&[1]);
let a2 = PartialComplexEntity::new(&[2]);
let b1 = PartialComplexEntity::new(&[3]);
let b2 = PartialComplexEntity::new(&[4]);
let ce1 = Instantiables::new(&[
a1.clone(),
a2.clone(),
b1.clone(),
b2.clone(),
]);
let ce2 = Instantiables::new(&[
a2.clone(),
b1.clone()
]);
assert_eq!(ce1 - ce2, Instantiables::new(&[
a1.clone(),
b2.clone()
]));
Fields
parts: Vec<PartialComplexEntity>
Sorted and non-duplicated list of partial complex entities
Implementations
A ANDOR B ANDOR C -> [A, B, C, A & B, B & C, A & C, A & B & C]
pub fn from_constraint_expr(
ns: &Namespace<'_>,
expr: &ConstraintExpr
) -> Result<Self, SemanticError>
Trait Implementations
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the +
operator.
Performs the +
operation. Read more
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the &
operator.
Performs the &
operation. Read more
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the &
operator.
Performs the &
operation. Read more
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the &
operator.
Performs the &
operation. Read more
Returns the “default value” for a type. Read more
type Output = Instantiables
type Output = Instantiables
The resulting type after applying the /
operator.
Performs the /
operation. Read more
Creates a value from an iterator. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for Instantiables
impl Send for Instantiables
impl Sync for Instantiables
impl Unpin for Instantiables
impl UnwindSafe for Instantiables
Blanket Implementations
Mutably borrows from an owned value. Read more