Overwrite the parent class add_state method

         Add automatic transition generation for the decider_state.

        :param state: The state to be added
        :return:
434809
def add_state(self, state, storage_load=False):
        
        state_id = super(BarrierConcurrencyState, self).add_state(state)
        if not storage_load and not self.__init_running and not state.state_id == UNIQUE_DECIDER_STATE_ID:
            # the transitions must only be created for the initial add_state call and not during each load procedure
            for o_id, o in list(state.outcomes.items()):
                if not o_id == -1 and not o_id == -2:
                    self.add_transition(state.state_id, o_id, self.states[UNIQUE_DECIDER_STATE_ID].state_id, None)
        return state_id
716349
def set_transition(self, p_self):
        '''
        '''
        if p_self is None:
            self.transition = None
        else:
            self.transition = transition_loop(len(self._classes), p_self)
405800
private void setState(State state) {
    if (this.state != state) {
      this.state = state;
      LOGGER.debug("State changed: {}", state);
      changeListeners.forEach(l -> l.accept(state));
    }
  }
1316386
function(state, transitionContext)
  {
    // this check is necessary to make sure we don't re-enter a transient state
    // like Renewing when we're already in it
    if (currentState !== state)
    {
      // if we have a current state, exit it; the null check is necessary
      // because the currentState is undefined at bootstrap time when we
      // transition to the first state
      if (currentState)
      {
        currentState.exit();
      }

      // update the current state
      currentState = state;

      // enter the new state
      currentState.enter(transitionContext);
    }
  }
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));
    }
950133
def set_start_state(self, state):
        
        if state is None:
            self.start_state_id = None
        elif isinstance(state, State):
            self.start_state_id = state.state_id
        else:
            self.start_state_id = state
909824
def add_parent(self, parent):
        
        parent.add_child(self)
        self.parent = parent
        return parent
999950
private void setState(State state) {
    if (this.state != state) {
      this.state = state;
      log.debug("State changed: {}", state);
    }
  }
330901
def step_over(self):
        
        logger.debug("Execution step over ...")
        self.run_to_states = []
        if self.finished_or_stopped():
            self.set_execution_mode(StateMachineExecutionStatus.FORWARD_OVER)
            self._run_active_state_machine()
        else:
            self.set_execution_mode(StateMachineExecutionStatus.FORWARD_OVER)
551155
def add_transitions_from_selected_state_to_parent():
    
    task_string = "create transition"
    sub_task_string = "to parent state"

    selected_state_m, msg = get_selected_single_state_model_and_check_for_its_parent()
    if selected_state_m is None:
        logger.warning("Can not {0} {1}: {2}".format(task_string, sub_task_string, msg))
        return
    logger.debug("Check to {0} {1} ...".format(task_string, sub_task_string))
    state = selected_state_m.state
    parent_state = state.parent

    # find all possible from outcomes
    from_outcomes = get_all_outcomes_except_of_abort_and_preempt(state)

    # find lowest valid outcome id
    possible_oc_ids = [oc_id for oc_id in state.parent.outcomes.keys() if oc_id >= 0]
    possible_oc_ids.sort()
    to_outcome = state.parent.outcomes[possible_oc_ids[0]]

    oc_connected_to_parent = [oc for oc in from_outcomes if is_outcome_connect_to_state(oc, parent_state.state_id)]
    oc_not_connected = [oc for oc in from_outcomes if not state.parent.get_transition_for_outcome(state, oc)]
    if all(oc in oc_connected_to_parent for oc in from_outcomes):
        logger.info("Remove transition {0} because all outcomes are connected to it.".format(sub_task_string))
        for from_outcome in oc_connected_to_parent:
            transition = parent_state.get_transition_for_outcome(state, from_outcome)
            parent_state.remove(transition)
    elif oc_not_connected:
        logger.debug("Create transition {0} ... ".format(sub_task_string))
        for from_outcome in from_outcomes:
            parent_state.add_transition(state.state_id, from_outcome.outcome_id,
                                        parent_state.state_id, to_outcome.outcome_id)
    else:
        if remove_transitions_if_target_is_the_same(from_outcomes):
            logger.info("Removed transitions origin from outcomes of selected state {0}"
                        "because all point to the same target.".format(sub_task_string))
            return add_transitions_from_selected_state_to_parent()
        logger.info("Will not create transition {0}: Not clear situation of connected transitions."
                    "There will be no transitions to other states be touched.".format(sub_task_string))

    return True
1351515
public void addOverwriteProperties(State state) {
    Map<String, String> propsMap = Maps.newHashMap();
    for (String key : state.getPropertyNames()) {
      propsMap.put(key, state.getProp(key));
    }
    addOverwriteProperties(propsMap);
  }
925003
public void setModificationState(ModificationState newModificationState)
    {
        if(newModificationState != modificationState)
        {
            if(log.isDebugEnabled())
            {
                log.debug("object state transition for object " + this.oid + " ("
                        + modificationState + " --> " + newModificationState + ")");
//                try{throw new Exception();}catch(Exception e)
//                {
//                e.printStackTrace();
//                }
            }
            modificationState = newModificationState;
        }
    }
555465
def set_state(self, updater=None, **kwargs):
        
        if callable(updater):
            state_change = updater(self)
        elif updater is not None:
            state_change = updater
        else:
            state_change = kwargs

        return [callback_result
                for k, v in state_change.items()
                for callback_result in self.set(k, v)]
792497
def expand_state_definition(source, loc, tokens):
    
    indent = " " * (pp.col(loc, source) - 1)
    statedef = []

    # build list of states
    states = set()
    fromTo = {}
    for tn in tokens.transitions:
        states.add(tn.from_state)
        states.add(tn.to_state)
        fromTo[tn.from_state] = tn.to_state

    # define base class for state classes
    baseStateClass = tokens.name
    statedef.extend([
        "class %s(object):" % baseStateClass,
        "    def __str__(self):",
        "        return self.__class__.__name__",

        "    @classmethod",
        "    def states(cls):",
        "        return list(cls.__subclasses__())",

        "    def next_state(self):",
        "        return self._next_state_class()",
    ])

    # define all state classes
    statedef.extend("class {0}({1}): pass".format(s, baseStateClass) for s in states)

    # define state->state transitions
    statedef.extend("{0}._next_state_class = {1}".format(s, fromTo[s]) for s in states if s in fromTo)

    statedef.extend([
        "class {baseStateClass}Mixin:".format(baseStateClass=baseStateClass),
        "    def __init__(self):",
        "        self._state = None",

        "    def initialize_state(self, init_state):",
        "        self._state = init_state",

        "    @property",
        "    def state(self):",
        "        return self._state",

        "    # get behavior/properties from current state",
        "    def __getattr__(self, attrname):",
        "        attr = getattr(self._state, attrname)",
        "        return attr",

        "    def __str__(self):",
        "       return '{0}: {1}'.format(self.__class__.__name__, self._state)",
        ])

    return indent + ("\n" + indent).join(statedef) + "\n"
284409
def setShowAddButton(self, state):
        
        self._showAddButton = state
        self._addButton.setVisible(state)
969265
def transition(self, state, message=""):
        
        with self.changes_squashed:
            initial_state = self.state.value
            if self.state_set.transition_allowed(
                    initial_state=initial_state, target_state=state):
                self.log.debug(
                    "%s: Transitioning from %s to %s",
                    self.mri, initial_state, state)
                if state == ss.DISABLED:
                    alarm = Alarm.invalid("Disabled")
                elif state == ss.FAULT:
                    alarm = Alarm.major(message)
                else:
                    alarm = Alarm()
                self.update_health(self, HealthInfo(alarm))
                self.state.set_value(state)
                self.state.set_alarm(alarm)
                for child, writeable in self._children_writeable[state].items():
                    if isinstance(child, AttributeModel):
                        child.meta.set_writeable(writeable)
                    elif isinstance(child, MethodModel):
                        child.set_writeable(writeable)
            else:
                raise TypeError("Cannot transition from %s to %s" %
                                (initial_state, state))
670846
void addState(State<S, L> state) {
        ElementReference ref = states.referencedAdd(state);
        state.setBlockReference(ref);
        state.setBlock(this);
    }