Skip to content

Commit

Permalink
Merge branch 'fix/substitute-library-with-hierarchy-state' into 'deve…
Browse files Browse the repository at this point in the history
…lop'

do not create already existing transitions

Closes DLR-RM#31

See merge request dev/sys/tci/rafcon!27
  • Loading branch information
vahidm1993 committed Nov 9, 2021
2 parents 8fdf2fd + 54c3402 commit 5b589ba
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions source/rafcon/core/states/container_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,22 +1042,25 @@ def substitute_state(self, state_id, state):
act_output_data_port_by_name = {op.name: op for op in state.output_data_ports.values()}

for t in related_transitions['external']['self']:
new_t_id = self.add_transition(state_id, t.from_outcome, state_id, t.to_outcome, t.transition_id)
re_create_io_going_t_ids.append(new_t_id)
assert new_t_id == t.transition_id
if t.transition_id not in self._transitions:
new_t_id = self.add_transition(state_id, t.from_outcome, state_id, t.to_outcome, t.transition_id)
re_create_io_going_t_ids.append(new_t_id)
assert new_t_id == t.transition_id

for t in related_transitions['external']['ingoing']:
new_t_id = self.add_transition(t.from_state, t.from_outcome, state_id, t.to_outcome, t.transition_id)
re_create_io_going_t_ids.append(new_t_id)
assert new_t_id == t.transition_id

for t in related_transitions['external']['outgoing']:
from_outcome = act_outcome_ids_by_name.get(old_outcome_names[t.from_outcome], None)
if from_outcome is not None:
new_t_id = self.add_transition(state_id, from_outcome, t.to_state, t.to_outcome, t.transition_id)
if t.transition_id not in self._transitions:
new_t_id = self.add_transition(t.from_state, t.from_outcome, state_id, t.to_outcome, t.transition_id)
re_create_io_going_t_ids.append(new_t_id)
assert new_t_id == t.transition_id

for t in related_transitions['external']['outgoing']:
if t.transition_id not in self._transitions:
from_outcome = act_outcome_ids_by_name.get(old_outcome_names[t.from_outcome], None)
if from_outcome is not None:
new_t_id = self.add_transition(state_id, from_outcome, t.to_state, t.to_outcome, t.transition_id)
re_create_io_going_t_ids.append(new_t_id)
assert new_t_id == t.transition_id

for old_ip in old_input_data_ports.values():
ip = act_input_data_port_by_name.get(old_input_data_ports[old_ip.data_port_id].name, None)
if ip is not None and ip.data_type == old_input_data_ports[old_ip.data_port_id].data_type:
Expand Down

0 comments on commit 5b589ba

Please sign in to comment.