Sets the new state of the given type.

@param type The type to change.
@param state The state to set.
@return The current instance in order to chain call methods.
518825
public PermissionsBuilder setState(PermissionType type, PermissionState state) {
        delegate.setState(type, state);
        return this;
    }
1194811
public void setType(String type) {
        if (type == null) {
            _properties.remove(AMQP_PROP_TYPE);
            return;
        }
        
        _properties.put(AMQP_PROP_TYPE, type);
    }
403298
def set_state(self, new_state):
        
        # Make sure it's a valid state
        if new_state not in self.STATES:
            raise ValueError('Invalid state value: %r' % new_state)

        # Set the state
        LOGGER.debug('State changing from %s to %s', self.STATES[self.state],
                     self.STATES[new_state])
        self.state = new_state
        self.state_start = time.time()
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);
    }
  }
719571
public <T> T newInstance (Class<T> type) {
		Registration registration = getRegistration(type);
		ObjectInstantiator instantiator = registration.getInstantiator();
		if (instantiator == null) {
			instantiator = newInstantiator(type);
			registration.setInstantiator(instantiator);
		}
		return (T)instantiator.newInstance();
	}
763244
public void setType(final Type type) {
		getOrCreateComponentModel().type = type == null ? Type.TABLE : type;
	}
977852
@Override
    public void init(final Class<? extends State> stateClass) throws InitializationException {
        try {
            currentState = getState(stateClass);
            change.firePropertyChange(STATE_CHANGE, null, currentState.getClass());
        } catch (NotAvailableException ex) {
            throw new InitializationException(this, ex);
        }
    }
758610
public void setState(PrimitiveState state) {
    if (this.state != state) {
      if (this.state != PrimitiveState.EXPIRED && this.state != PrimitiveState.CLOSED) {
        this.state = state;
        if (state == PrimitiveState.SUSPENDED) {
          if (suspendedTime == null) {
            suspendedTime = System.currentTimeMillis();
          }
        } else {
          suspendedTime = null;
        }
        changeListeners.forEach(l -> l.accept(state));
      }
    } else if (this.state == PrimitiveState.SUSPENDED) {
      if (System.currentTimeMillis() - suspendedTime > timeout) {
        setState(PrimitiveState.EXPIRED);
      }
    }
  }
981718
private synchronized void changeState(PrimitiveState state) {
    if (this.state != state) {
      this.state = state;
      stateChangeListeners.forEach(l -> threadContext.execute(() -> l.accept(state)));
    }
  }
202437
function setCurrent (state, type, value) {
  let dest
  if (type === 'file') {
    dest = utils.getRefFilePath(value)
  }

  if (dest) {
    state.current = dest
  }
}
50302
@Override
    public void setState(TransferState state) {
        super.setState(state);

        switch (state) {
        case Waiting:
            fireProgressEvent(ProgressEventType.TRANSFER_PREPARING_EVENT);
            break;
        case InProgress:
            if ( subTransferStarted.compareAndSet(false, true) ) {
                /* The first InProgress signal */
                fireProgressEvent(ProgressEventType.TRANSFER_STARTED_EVENT);
            }
            /* Don't need any event code update for subsequent InProgress signals */
            break;
        case Completed:
            fireProgressEvent(ProgressEventType.TRANSFER_COMPLETED_EVENT);
            break;
        case Canceled:
            fireProgressEvent(ProgressEventType.TRANSFER_CANCELED_EVENT);
            break;
        case Failed:
            fireProgressEvent(ProgressEventType.TRANSFER_FAILED_EVENT);
            break;
        default:
            break;
        }
    }
839906
public int setState(boolean state, boolean bDisplayOption, int iMoveMode)
    {       // Must be overidden
        m_bSetData = true;  // Make sure getNextConverter is called correctly (if it is called).
        int iErrorCode = super.setState(state, bDisplayOption, iMoveMode);
        m_bSetData = false;
        return iErrorCode;
    }
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();
    }
1031169
public static synchronized <T> ConstructorExpectationSetup<T> whenNew(Class<T> type) {
        return new DefaultConstructorExpectationSetup<T>(type);
    }
444815
public void setType(int type) {
        this.type = type;
        if (level == LEVEL_UNDEFINED) {
            switch (type) {
                case TYPE_INT:
                case TYPE_LONG:
                case TYPE_DOUBLE:
                    level = LEVEL_LOW;
                    break;
                case TYPE_STAT:
                    level = LEVEL_MEDIUM;
                    unit = "unit.ms";
                    break;
                case TYPE_LOAD:
                    level = LEVEL_HIGH;
                    break;
                case TYPE_SUBMODULE:
                    level = LEVEL_MAX;
                    break;
                default:
                    break;
            }
        }
    }
354420
public function setState(State $state = null): AbstractTable
    {
        $this->current = new State($this->initial->getName());

        if (!empty($state)) {
            $this->current->setName($state->getName());
            $this->current->syncState($state);
        }

        return $this;
    }
220910
public void changeState(Class<? extends State> next)
    {
        Check.notNull(next);

        final State from = current;
        if (current != null)
        {
            last = current.getClass();
            current.exit();
        }
        if (!states.containsKey(next))
        {
            final State state = create(next);
            states.put(next, state);
        }
        current = states.get(next);
        current.enter();

        listeners.forEach(l -> l.notifyStateTransition(from != null ? from.getClass() : null, next));
    }