/*
change canceled state
8855
public function SetStatusCanceled($bIsCanceled = true)
    {
        if ($this->fieldCanceled != $bIsCanceled) {
            $sDate = '';
            if ($bIsCanceled) {
                $sDate = date('Y-m-d H:i:s');
            }
            $aData = $this->sqlData;
            $aData['canceled_date'] = $sDate;
            if ($bIsCanceled) {
                $aData['canceled'] = '1';
            } else {
                $aData['canceled'] = '0';
            }
            $this->LoadFromRow($aData);
            $bEditState = $this->bAllowEditByAll;
            $this->AllowEditByAll(true);
            $this->Save();
            $this->UpdateUsedVouchers($bIsCanceled);
            // if we canceled the order, we need to update the stock for all articles
            if ($bIsCanceled) {
                $this->UpdateStock(false);
            } else {
                $this->UpdateStock(true);
            }
            $this->AllowEditByAll($bEditState);
        }
    }
632008
async def cancel_handler(message: types.Message, state: FSMContext, raw_state: Optional[str] = None):
    
    if raw_state is None:
        return

    # Cancel state and inform user about it
    await state.finish()
    # And remove keyboard (just in case)
    await message.reply('Canceled.', reply_markup=types.ReplyKeyboardRemove())
767509
def cancel(self):
        """"""
        if self in scoop._control.execQueue.movable:
            self.exceptionValue = CancelledError()
            scoop._control.futureDict[self.id]._delete()
            scoop._control.execQueue.remove(self)
            return True
        return False
1112659
private void changeStateTo(int newState) {
    synchronized (lockObject) {
      int oldState = this.status.getRunState();
      if (oldState == newState) {
        return; //old and new states are same
      }
      this.status.setRunState(newState);
    }
  }
743997
function (skipChangeState) {
            var state = "normal";
            var cfg = this._cfg;
            if (cfg.disabled) {
                state = "disabled";
            } else {
                if ((this._mousePressed && this._mouseOver) || this._keyPressed) {
                    state = "msdown";
                } else if (this._mouseOver && !this._focused) {
                    state = "msover";
                } else if (this._focused) {
                    if (this._mouseOver) {
                        state = "msoverFocused";
                    } else {
                        state = "normalFocused";
                    }
                }
            }
            this._state = state;
            if (!skipChangeState) {
                // force widget - DOM mapping
                this.getDom();
                if (!this._simpleHTML) {
                    this._frame.changeState(this._state);
                    if (state == "disabled") {
                        this._focusElt.className = "xButton xButtonDisabled";
                    } else {
                        this._focusElt.className = "xButton";
                    }
                }
                var disabledAttribute = cfg.focusableWhenDisabled ? (cfg.waiAria ? "aria-disabled" : null) : "disabled";
                if (disabledAttribute) {
                    if (state == "disabled") {
                        this._focusElt.setAttribute(disabledAttribute, "true");
                    } else {
                        this._focusElt.removeAttribute(disabledAttribute);
                    }
                }
            }
        }
1044113
function stopScan(stateChange, error) {
            if (node.scanning) {
                // send status message
                var msg = {
                    statusUpdate: true,
                    error: error,
                    stateChange: stateChange,
                    state: noble.state
                };
                node.send(msg);
                // stop the scan
                noble.stopScanning(function() {
                    node.log('BLE scanning stopped.');
                    node.status({fill:"red",shape:"ring",text:"stopped"});
                    node.scanning = false;
                });
                if (error) {
                    node.warn('BLE scanning stopped due to change in adapter state.');
                }
            }
        }
333498
public int setState(boolean state, boolean bDisplayOption, int iMoveMode)
    {       // Must be overidden
        if (this.getNextConverter() != null)
            return this.getNextConverter().setState(state, bDisplayOption, iMoveMode);
        else
            return super.setState(state, bDisplayOption, iMoveMode);
    }
810301
function setToggleState(ele, state) {
  const btn = "btn";
  const sel = "selected";

  if (ele.classList.contains(btn)) {
    if (state) {
      ele.classList.add(sel);
    } else {
      ele.classList.remove(sel);
    }
  }
}
956698
private void _shift(double[][] state) {
    double[] tmpState = state[0];
    state[0] = state[1];
    state[1] = state[2];
    state[2] = tmpState;
  }
1008187
public boolean setCancellerHandle(ScheduledFuture<?> cancellerHandle) {
		synchronized (lock) {
			if (this.cancellerHandle == null) {
				if (!discarded) {
					this.cancellerHandle = cancellerHandle;
					return true;
				} else {
					return false;
				}
			}
			else {
				throw new IllegalStateException("A canceller handle was already set");
			}
		}
	}
1372556
@Override
    public boolean cancel(boolean ignored) {
        boolean cancelled = false;
        if (latch.getCount() == 1) {
            latch.countDown();
            output = null;
            cancelled = true;
        }
        return cancelled;
    }
1283382
function cancelDecorator(cancelUrls = []) {
  return component => {
    component.prototype.prev_componentWillUnmount =
      component.prototype.componentWillUnmount;
    component.prototype.componentWillUnmount = function() {
      this.prev_componentWillUnmount && this.prev_componentWillUnmount();
      const dispatch = this.props.dispatch || this.context.store.dispatch;
      if (!dispatch) {
        throw new Error(
          'Expected the dispatch method from redux, you should use react-redux `connect()`'
        );
      }
      cancelUrls.forEach(v => {
        dispatch({
          type: `${v}/cancelAxios`,
          // 不触发 loading 插件
          [LOADINGNAMESPACE]: false,
        });
      });
    };
    return component;
  };
}
995404
function _switchState(state) {
            // clear previous interval if any
            _stopRunLoop();

            // call the stage destroy method
            if (_stages[_state]) {
                // just notify the object
                _stages[_state].stage.destroy();
            }

            if (_stages[state]) {
                // set the global variable
                _state = state;

                // call the reset function with _extraArgs as arguments
                _stages[_state].stage.reset.apply(_stages[_state].stage, _extraArgs);

                // and start the main loop of the
                // new requested state
                _startRunLoop();

                // execute callback if defined
                if (_onSwitchComplete) {
                    _onSwitchComplete();
                }

                // force repaint
                me.game.repaint();
            }
        }
1091219
def cancelled(self):
        """"""
        return self._state == self.S_EXCEPTION and isinstance(self._result, Cancelled)
341411
function cancel() {
        if (ended) {
            return;
        }

        ended = true;

        for (let i = ran; i < pending; i++) {
            const child = waitFor[i];
            child.removeEventListener(TRANSITION_END, listener);
        }

        if (cancelFrame) {
            cancelFrame();
            classList.remove(initClass);
        } else {
            classList.remove(className);
        }
    }
166636
public function cancel() {
        switch ($this->state) {
            case self::STATE_SHEDULED:
                $this->state = self::STATE_NONE;
                $this->counter = 0;
                break;
        }
        return false;
    }
1360466
function unwrapBlock(removedLength, state) {
  let change = state.change();
  change = unwrapBlockForChange(removedLength, change);
  return change.state;
}