Set the current GPIO digital output pin state
based on the supplied power state

@param state new power state to apply
429495
@Override
    public void setState(PowerState state) {
        switch(state) {
            case OFF: {
                if(!isOff()) {

                    // apply the new pin state
                    pin.setState(offState);
                }
                break;
            }
            case ON: {
                if(!isOn()) {

                    // apply the new pin state
                    pin.setState(onState);
                }
                break;
            }
            default: {
                throw new UnsupportedOperationException("Cannot set power state: " + state.toString());
            }
        }
    }
23628
@Override
    protected boolean onStateChange(int[] state) {
        final int color = state == null ? mColorStateList.getDefaultColor() : mColorStateList.getColorForState(state, mColor);
        boolean bFlag = mColor != color;
        if (bFlag) {
            mColor = color;
        }
        return bFlag;
    }
368509
def set_power_state(self, is_on, bulb=ALL_BULBS, timeout=None):
        
        with _blocking(self.lock, self.power_state, self.light_state_event,
                       timeout):
            self.send(REQ_SET_POWER_STATE,
                      bulb, '2s', '\x00\x01' if is_on else '\x00\x00')
            self.send(REQ_GET_LIGHT_STATE, ALL_BULBS, '')
        return self.power_state
216773
def setChecked(self, state):
        
        super(XLockButton, self).setChecked(state)
        self.updateState()
1061978
public synchronized void stateMachine(final DeviceState state) throws DevFailed {
        if (state != null) {
            this.state = state.getDevState();
            if (setStateMethod != null) {
                logger.debug("Changing state to {}", state);
                try {
                    if (setStateMethod.getParameterTypes()[0].equals(DeviceState.class)) {
                        setStateMethod.invoke(businessObject, state);
                    } else {
                        setStateMethod.invoke(businessObject, this.state);
                    }
                } catch (final IllegalArgumentException e) {
                    throw DevFailedUtils.newDevFailed(e);
                } catch (final IllegalAccessException e) {
                    throw DevFailedUtils.newDevFailed(e);
                } catch (final InvocationTargetException e) {
                    if (e.getCause() instanceof DevFailed) {
                        throw (DevFailed) e.getCause();
                    } else {
                        throw DevFailedUtils.newDevFailed(e.getCause());
                    }
                }
            }
        }
    }
1194340
function setState($state) {
		if($state == (self::SWITCH_ACTUATOR_STATE_ON or self::SWITCH_ACTUATOR_STATE_OFF))
			$this->state = $state;
		else
			throw new \Exception('Invalid SwitchActuator state "'.$state.'"');
	}
705045
def set_state(self, state):
        
        self.basicevent.SetBinaryState(BinaryState=int(state))
        self._state = int(state)
923605
public void setPin(int pin, boolean active) {
        Buffer buffer = new Buffer();
        buffer.writeIntLe(pin);
        buffer.writeByte(active ? 1 : 0);
        sendMessage(BeanMessageID.BT_SET_PIN, buffer);
    }
810745
private void dispatchState(State state) {
		for (MeasureDistanceHandler handler : handlers) {
			handler.onChange(state, context);
		}	
	}
230145
public void setPower(int power)
    {
        if (power < -128 || 127 < power)
        {
            throw new IllegalArgumentException("'power' is out of the valid range: " + power);
        }

        mPower = power;

        getData()[POWER_INDEX] = (byte)power;
    }
1317801
private synchronized void setState(int state) {
        mState = state;

        // Give the new state to the Handler so the UI Activity can update
        mHandler.obtainMessage(ISOBlueDemo.MESSAGE_STATE_CHANGE, state, -1)
                .sendToTarget();
    }
1291569
public function setCurrentState(CurrentState $state)
    {
        $outputStream = $this->_outputChannel->getOutputStream($this->_endpoint);
        $this->_serializer->serialize($state, $outputStream);
        fclose($outputStream);
    }
604372
def set_power(state)
      level = case state
      when :on
        1
      when :off
        0
      else
        raise ArgumentError.new("Must pass in either :on or :off")
      end
      send_message(Protocol::Device::SetPower.new(level: level))
      self
    end
1192576
def set(self, channel, state):
        """"""
        checked_val = self._check_dac_val(channel, state)
        self._dac_enabled = 0x40
        self.i2c.write8(self._dac_enabled, checked_val * 255)
980297
public void addState(GameState state) {
		states.put(new Integer(state.getID()), state);
		
		if (currentState.getID() == -1) {
			currentState = state;
		}
	}
1176792
public void initTraceState(Map<String, Object> state) {
        Object traceId = state.get(Constants.HAWKULAR_APM_TRACEID);
        Object transaction = state.get(Constants.HAWKULAR_APM_TXN);
        Object level = state.get(Constants.HAWKULAR_APM_LEVEL);
        if (traceId != null) {
            setTraceId(traceId.toString());
        } else {
            log.severe("Trace id has not been propagated");
        }
        if (transaction != null) {
            setTransaction(transaction.toString());
        }
        if (level != null) {
            setReportingLevel(ReportingLevel.valueOf(level.toString()));
        }
    }
1331128
def set_output(self, state, channel=2):
        """"""
        if state:
            self.instr.write(':OUTP{0} ON'.format(channel))
        else:
            self.instr.write(':OUTP{0} OFF'.format(channel))