Returns the canonical state for the given state's signature, or registers the state as canonical if no state with
that signature exists.

@param state
the state

@return the canonical state for the given state's signature
500988
protected State replaceOrRegister(State state) {
        StateSignature sig = state.getSignature();
        State other = register.get(sig);
        if (other != null) {
            if (state != other) {
                for (int i = 0; i < sig.successors.array.length; i++) {
                    State succ = sig.successors.array[i];
                    if (succ != null) {
                        succ.decreaseIncoming();
                    }
                }
            }
            return other;
        }

        register.put(sig, state);
        return state;
    }
305482
private String getRepositoryBackupToFullState(int state)
   {
      String st = "";
      switch (state)
      {

         case RepositoryBackupChain.FINISHED :
            st = "finished";
            break;

         case RepositoryBackupChain.WORKING :
            st = "working";
            break;

         case RepositoryBackupChain.INITIALIZED :
            st = "initialized";
            break;

         case RepositoryBackupChain.FULL_BACKUP_FINISHED_INCREMENTAL_BACKUP_WORKING :
            st = "finished";
            break;
         default :
            break;
      }

      return st;
   }
951639
public static function state($state) {

        $result = new \sb\Validate\Results();
        $result->value = $state;

        if (in_array($state, self::states)) {

            $result->is_valid = true;
            $result->message = 'Valid state code';
        } else {

            $result->is_valid = false;
            $result->message = 'Invalid state code, are you sure you are using a two letter abbreviation';
        }

        return $result;
    }
1253659
def used_states(self):
        ''
        c = itertools.count()
        canonical_ids = collections.defaultdict(lambda: next(c))
        for s in self.states_list:
            for state in s.stateseq:
                canonical_ids[state]
        return list(map(operator.itemgetter(0),
                sorted(canonical_ids.items(),key=operator.itemgetter(1))))
267015
public static CmsResourceState valueOf(int state) {

        switch (state) {
            case 0:
                return CmsResource.STATE_UNCHANGED;
            case 1:
                return CmsResource.STATE_CHANGED;
            case 2:
                return CmsResource.STATE_NEW;
            case 3:
                return CmsResource.STATE_DELETED;
            case 99:
            default:
                return CmsResource.STATE_KEEP;
        }
    }
545766
@Override
    public StateContract getStateFromName(String countryAlternateCode, String stateName) {
        CountryContract country = getCountryFromCode(countryAlternateCode);

        return getKcStateService().getState(country.getCode(), stateName);
    }
1251205
public com.google.protobuf.ByteString
      getStateBytes() {
    java.lang.Object ref = state_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      state_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
1122264
public function setState($state)
		{
		$r = array_pop($this->states);
		array_push($this->states, $state);
		$this->state = $this->states[count($this->states) - 1];
		return $r;
		}
1154937
function( state ) {
			var key,
				clonedState = {};

			for( key in state ) {
				if( key !== LOCAL ) {
					clonedState[ key ] = state[ key ];
				}
			}

			return clonedState;
		}
554417
private TTTState<I, D> getAnyState(Iterable<? extends I> suffix) {
        return getAnySuccessor(hypothesis.getInitialState(), suffix);
    }
1179894
public void setState(State state) {
    this.state = state;
    setText(state.isPrimary() ? text1 : text2);
  }
238835
public static Symbol findIdent(String name, VisitorState state) {
    return findIdent(name, state, KindSelector.VAR);
  }
851425
public Set<T> getTransitions(S state) {
		getStateId(state);
		return validTransitions.get(state);
	}
707124
ServerStatus getState() {
        final InternalState requiredState = this.requiredState;
        final InternalState state = internalState;
        if(requiredState == InternalState.FAILED) {
            return ServerStatus.FAILED;
        }
        switch (state) {
            case STOPPED:
                return ServerStatus.STOPPED;
            case SERVER_STARTED:
                return  ServerStatus.STARTED;
            default: {
                if(requiredState == InternalState.SERVER_STARTED) {
                    return ServerStatus.STARTING;
                } else {
                    return ServerStatus.STOPPING;
                }
            }
        }
    }
1261352
public void addState(String name, S state)
    {
        AbstractState old = states.put(name, new StateWrapper(name, state));
        if (old != null)
        {
            throw new IllegalArgumentException("state "+name+" exists already");
        }
    }
250798
public boolean isState(Class<? extends State> state)
    {
        if (current != null)
        {
            return current.getClass().equals(state);
        }
        return false;
    }
1016421
public static WindowState getWindowState(String state) {
        if (state == null) {
            return null;
        }

        final WindowState windowState = WINDOW_STATES.get(state);
        if (windowState != null) {
            return windowState;
        }

        return new WindowState(state);
    }