Find state_copy of uppermost LibraryState

        Method checks if there is a parent library root state and assigns it to be the current library root state till
        there is no further parent library root state.
559349
def get_uppermost_library_root_state(self):
        

        library_root_state = self.get_next_upper_library_root_state()
        parent_library_root_state = library_root_state
        # initial a library root state has to be found and if there is no further parent root state
        # parent_library_root_state and library_root_state are no more identical
        while parent_library_root_state and library_root_state is parent_library_root_state:
            if library_root_state:
                parent_library_root_state = library_root_state.parent.get_next_upper_library_root_state()

            if parent_library_root_state:
                library_root_state = parent_library_root_state

        return library_root_state
1027197
def _handle_backward_execution_before_child_execution(self):
        
        self.backward_execution = True
        last_history_item = self.execution_history.pop_last_item()
        if last_history_item.state_reference is self:
            # if the the next child_state in the history is self exit this hierarchy-state
            if self.child_state:
                # do not set the last state to inactive before executing the new one
                self.child_state.state_execution_status = StateExecutionStatus.INACTIVE
            return True
        assert isinstance(last_history_item, ReturnItem)
        self.scoped_data = last_history_item.scoped_data
        self.child_state = last_history_item.state_reference
        return False
375556
private void evaluateState()
    {
        synchronized (this.callList)
        {
            // Get the highest prioirty state from the set of calls.
            PeerState newState = PeerState.NOTSET;
            for (CallTracker call : this.callList)
            {
                if (call.getState().getPriority() > newState.getPriority())
                    newState = call.getState();
            }

            this._state = newState;
        }
    }
1006213
def root_snapshot
      return nil if current_snapshot.nil?

      current = current_snapshot
      current = current.parent while current.parent != nil
      current
    end
1263679
def get_library_instance(self, library_path, library_name):
        """"""
        if self.is_library_in_libraries(library_path, library_name):
            from rafcon.core.states.library_state import LibraryState
            return LibraryState(library_path, library_name, "0.1")
        else:
            logger.warning("Library manager will not create a library instance which is not in the mounted libraries.")
232333
def parent_machine
      current = parent
      current = current.parent while current && !current.is_a?(VM)
      current
    end
1248185
def _check_lib(self, remake, compiler, debug, profile):
        
        from os import path
        if self.link is None or not path.isfile(self.link):
            self.makelib(remake, True, compiler, debug, profile)
989000
public static <T> void checkAreDescendentsOf(Set<T> inputSet, T root, Deps<T> deps) {
        // Check that all modules in the input set are descendents of the output module.
        HashSet<T> visited = new HashSet<T>();
        dfs(root, visited, deps);
        if (!visited.containsAll(inputSet)) {
            throw new IllegalStateException("Input set contains modules which are not descendents of the output module: " + inputSet);
        }
    }
292770
def check_node_parent(
        cls, resource_id, new_parent_id, db_session=None, *args, **kwargs
    ):
        
        db_session = get_db_session(db_session)
        new_parent = ResourceService.lock_resource_for_update(
            resource_id=new_parent_id, db_session=db_session
        )
        # we are not moving to "root" so parent should be found
        if not new_parent and new_parent_id is not None:
            raise ZigguratResourceTreeMissingException("New parent node not found")
        else:
            result = cls.path_upper(new_parent_id, db_session=db_session)
            path_ids = [r.resource_id for r in result]
            if resource_id in path_ids:
                raise ZigguratResourceTreePathException(
                    "Trying to insert node into itself"
                )
1091782
def _store_expansion_state(self):
        """"""

        def store_tree_expansion(child_tree_iter, expansion_state):

            tree_item_path = self.history_tree_store.get_path(child_tree_iter)
            history_item = self.get_history_item_for_tree_iter(child_tree_iter)

            # store expansion state if tree item path is valid and expansion state was not stored already
            if tree_item_path is not None:
                # if first element of sub-tree has same history_item as the parent ignore it's expansion state
                if history_item not in expansion_state:
                    expansion_state[history_item] = self.history_tree.row_expanded(tree_item_path)

            for n in range(self.history_tree_store.iter_n_children(child_tree_iter)):
                child_iter = self.history_tree_store.iter_nth_child(child_tree_iter, n)
                store_tree_expansion(child_iter, expansion_state)

        root_iter = self.history_tree_store.get_iter_first()
        if not root_iter:
            return
        current_expansion_state = {}
        # this can be the case when the execution history tree is currently being deleted
        if not self.get_history_item_for_tree_iter(root_iter).state_reference:
            return
        state_machine = self.get_history_item_for_tree_iter(root_iter).state_reference.get_state_machine()
        self._expansion_state[state_machine.state_machine_id] = current_expansion_state
        while root_iter:
            store_tree_expansion(root_iter, current_expansion_state)
            root_iter = self.history_tree_store.iter_next(root_iter)
957011
public boolean containsSubflowState(final Flow flow, final String stateId) {
        if (containsFlowState(flow, stateId)) {
            return getState(flow, stateId, SubflowState.class) != null;
        }
        return false;
    }
1228484
def recursively_register_child_states(self, state):
        
        self.logger.info("Execution status observer add new state {}".format(state))
        if isinstance(state, ContainerState):
            state.add_observer(self, "add_state",
                               notify_after_function=self.on_add_state)
            for state in list(state.states.values()):
                self.recursively_register_child_states(state)
                state.add_observer(self, "state_execution_status",
                                   notify_after_function=self.on_state_execution_status_changed_after)

        if isinstance(state, LibraryState):
            self.recursively_register_child_states(state.state_copy)
            state.add_observer(self, "state_execution_status",
                               notify_after_function=self.on_state_execution_status_changed_after)
851365
public boolean isReferencedByRoot() {
        if(rootBean) {
            return true;
        }
        for(Reference reference : references) {
            Instance parent = reference.getParent();
            if(parent.isReferencedByRoot()) {
                return true;
            }
        }
        return false;
    }
1295590
def define_state_accessor
      attribute = self.attribute

      @helper_modules[:instance].class_eval { attr_reader attribute } unless owner_class_ancestor_has_method?(:instance, attribute)
      @helper_modules[:instance].class_eval { attr_writer attribute } unless owner_class_ancestor_has_method?(:instance, "#{attribute}=")
    end
1105341
private static List<Resource> getAncestors(Resource currentResource, Resource rootResource) {
    List<Resource> results = new ArrayList<Resource>();

    if (currentResource == null || rootResource == null || StringUtils.equals(currentResource.getPath(), rootResource.getPath())) {
      return results;
    }

    Resource parent = currentResource.getParent();
    while (parent != null) {
      results.add(0, parent);
      if (parent.getPath().equals(rootResource.getPath())) {
        break;
      }
      parent = parent.getParent();
    }
    return results;
  }
605511
def root_context
      context = parent
      context = context.parent until context.is_a? Symbol
      return context
    end
413101
def find_state(self, container, start=None, end=None, avoid=None, initial_state=None, final_state=None):
        
        self.__set_cpu_state(initial_state)

        # Convert input native addresses to reil addresses.
        start = to_reil_address(start) if start else None
        end = to_reil_address(end) if end else None
        avoid = [to_reil_address(addr) for addr in avoid] if avoid else []

        # Load instruction pointer.
        ip = start if start else container[0].address

        execution_state = Queue()

        trace_current = []
        trace_final = []

        self.__fs_process_container(container, final_state, ip, end, avoid, initial_state, execution_state,
                                    trace_current, trace_final)

        # Only returns when all paths have been visited.
        assert execution_state.empty()

        return trace_final