operator * method

  1. @override
Expression operator *(
  1. EquationMember m
)
override

Creates a Expression by multiplying this member with the argument. Both members may need to be hoisted to expressions themselves before this can occur.

Warning: This operation may throw a ParserException if the resulting expression is no longer linear. This is because a non-linear Expression may not be used to create a constraint. At least one of the Expression members must evaluate to a constant.

For example: ((left + right) >= (cm(2.0) * mid) declares a midpoint constraint. Notice that at least one the members of the right hand Expression is a constant.

Implementation

@override
Expression operator *(EquationMember m) {
  final args = _findMultiplierAndMultiplicand(m);

  if (args == null) {
    throw ParserException(
      'Could not find constant multiplicand or multiplier',
      <EquationMember>[this, m],
    );
  }

  return args.multiplier._applyMultiplicand(args.multiplicand);
}