Returns <code>true</code> if conversation is in one of the given states
430172
public boolean hasState(ConversationState... states) {
		for (ConversationState s : states) {
			if (s.equals(state)) {
				return true;
			}
		}
		return false;
	}
1029155
public boolean compareAndSet(T expectedState, T newState)
    {
        checkState(!Thread.holdsLock(lock), "Can not set state while holding the lock");
        requireNonNull(expectedState, "expectedState is null");
        requireNonNull(newState, "newState is null");

        FutureStateChange<T> futureStateChange;
        ImmutableList<StateChangeListener<T>> stateChangeListeners;
        synchronized (lock) {
            if (!state.equals(expectedState)) {
                return false;
            }

            // change to same state is not a change, and does not notify the notify listeners
            if (state.equals(newState)) {
                return false;
            }

            checkState(!isTerminalState(state), "%s can not transition from %s to %s", name, state, newState);

            state = newState;

            futureStateChange = this.futureStateChange.getAndSet(new FutureStateChange<>());
            stateChangeListeners = ImmutableList.copyOf(this.stateChangeListeners);

            // if we are now in a terminal state, free the listeners since this will be the last notification
            if (isTerminalState(state)) {
                this.stateChangeListeners.clear();
            }
        }

        fireStateChanged(newState, futureStateChange, stateChangeListeners);
        return true;
    }
254089
public boolean isAllowed(final DeviceState state) {
        boolean isAllowed = true;
        if (deniedStates.contains(state)) {
            isAllowed = false;
        }
        return isAllowed;
    }
795676
function isUSAState (state, strict) {
    state = state && NODE_RATIFY.isString(state) ? _toTitleCase(state) : null;
    var topLevel = (US_STATE_CODE_TO_NAME[state] || US_STATE_NAME_TO_CODE[state]);

    if(strict) {
        return topLevel ? true : false;
    } else {
        return (US_INHABITED_TERRITORIES_CODE_TO_NAME[state] || US_INHABITED_TERRITORIES_NAME_TO_CODE[state] || topLevel) ? true : false;
    }
}
168906
public boolean hasState() {
		for (OperatorSubtaskState operatorSubtaskState : subtaskStatesByOperatorID.values()) {
			if (operatorSubtaskState != null && operatorSubtaskState.hasState()) {
				return true;
			}
		}
		return false;
	}
229915
private State getNextState(State state) {

        State nextState = null;
        switch (state) {
            case off:
                nextState = State.on;
                break;
            case on:
                nextState = State.off;
                break;
            case middle:
            default:
                nextState = m_nextStateAfterMiddle;
        }
        return nextState;
    }
697974
@Override
    public List<T> returnItemsWithState(final List<Integer> states) {
        if (states == null) throw new IllegalArgumentException("states cannot be null");

        final List<T> retValue = new ArrayList<T>();

        for (final V item : getItems()) {
            if (states.contains(item.getState())) retValue.add(item.getItem());
        }

        return retValue;
    }
974534
def is?(state)
      if state.is_a?(Array)
        state.include? current
      else
        state == current
      end
    end
789241
function matchesState(state, desiredState) {
  if (desiredState === 'all') {
    return true;
  }
  if (desiredState[0] === '!') {
    return state !== desiredState.substring(1);
  }
  return state === desiredState;
}
1265482
private boolean checkIngestState() throws IOException {
    if (currentIngestState == StandbyIngestState.INGESTING_EDITS) {
      String msg = "";
      if (ingest == null) {
        msg = "Standby: Ingest instantiation failed, the state is "
            + currentIngestState + ", but the ingest is null";
      }
      if (currentSegmentTxId != ingest.getStartTxId()) {
        msg = "Standby: Ingest instantiation failed, trying to instantiate ingest for txid: "
            + currentSegmentTxId
            + ", but there is ingest for txid: "
            + ingest.getStartTxId();
      }
      if (currentIngestState == StandbyIngestState.NOT_INGESTING
          && ingest.isRunning()) {
        msg = "Standby: Ingest instantiation failed, the state is "
            + currentIngestState + " but the ingest is running";
      }
      if (!msg.isEmpty()) {
        LOG.warn(msg);
        throw new IOException(msg);
      }
      return true;
    }
    return false;
  }
308959
def find_state(self, state, best_match=True, min_similarity=70):
        
        result_state_short_list = list()

        # check if it is a abbreviate name
        if state.upper() in STATE_ABBR_SHORT_TO_LONG:
            result_state_short_list.append(state.upper())

        # if not, find out what is the state that user looking for
        else:
            if best_match:
                state_long, confidence = extractOne(state, self.state_list)
                if confidence >= min_similarity:
                    result_state_short_list.append(
                        STATE_ABBR_LONG_TO_SHORT[state_long])
            else:
                for state_long, confidence in extract(state, self.state_list):
                    if confidence >= min_similarity:
                        result_state_short_list.append(
                            STATE_ABBR_LONG_TO_SHORT[state_long])

        if len(result_state_short_list) == 0:
            message = ("'%s' is not a valid state name, use 2 letter "
                       "short name or correct full name please.")
            raise ValueError(message % state)

        return result_state_short_list
449020
public final Collection<State> acceptStates() {
	if(acceptStates == null) {
	    final Collection<State> states = this.states();
	    acceptStates = 
		DSUtil.filterColl(_acceptStates(),
				  new Predicate<State>() {
				      public boolean check(State state) {
					  return states.contains(state);
				      }
				  },
				  new LinkedHashSet<State>());
	}
	return acceptStates;
    }
336950
public static boolean isProto2MessageClass(VisitorState state, Type type) {
    checkNotNull(type);
    return isAssignableTo(type, MESSAGE_TYPE, state)
        && !isAssignableTo(type, PROTOCOL_MESSAGE_TYPE, state);
  }
809607
public Iterable<DOAuth2User> queryByState(java.lang.Integer state) {
    return queryByField(null, DOAuth2UserMapper.Field.STATE.getFieldName(), state);
  }
374037
public boolean hasTransitionTo(CharRange condition, NFAState<T> state)
    {
        Set<Transition<NFAState<T>>> set = transitions.get(condition);
        if (set != null)
        {
            for (Transition<NFAState<T>> tr : set)
            {
                if (state.equals(tr.getTo()))
                {
                    return true;
                }
            }
        }
        return false;
    }
762030
private boolean hasMessagesPending()
  {

    for (Map.Entry<MessageQueue, ConcurrentSkipListSet<MessageExt>> entry : messageQueueTreeSetMap.entrySet()) {
      if (!entry.getValue().isEmpty()) {
        return true;
      }
    }

    return false;
  }
169349
protected void checkState(InitializedState minState, InitializedState maxState) {
        PreconditionUtil.verify(initializedState.ordinal() >= minState.ordinal(), "not yet initialized, cannot yet be called");
        PreconditionUtil
                .verify(initializedState.ordinal() <= maxState.ordinal(), "already initialized, cannot be called anymore");
    }