- override
Creates a Expression by subtracting the argument from this member. Both
members may need to be hoisted to expressions themselves before this can
occur.
For example: right - left can be used as an Expression
equivalent of the width property.
Source
@override
Expression operator -(EquationMember m) {
if (m is ConstantMember)
return new Expression(new List<Term>.from(terms), constant - m.value);
if (m is Param) {
return new Expression(
new List<Term>.from(terms)..add(new Term(m.variable, -1.0)),
constant
);
}
if (m is Term) {
return new Expression(new List<Term>.from(terms)
..add(new Term(m.variable, -m.coefficient)), constant);
}
if (m is Expression) {
List<Term> copiedTerms = new List<Term>.from(terms);
for (Term t in m.terms)
copiedTerms.add(new Term(t.variable, -t.coefficient));
return new Expression(copiedTerms, constant - m.constant);
}
assert(false);
return null;
}