Commutation quality factor of two-state switchable devices