Click PairQuantity ticker on global mask change.

This fixes invalid results when changing from masked to no-mask
state with optimized evaluator.
Click PairQuantity ticker when type mask changes.

And also click it when changing from type to pair masking mode.
Unit test this.
Add PairQuantity methods hasPairMask, hasTypeMask.
Support OPTIMIZED evaluation for type-masking mode.