Example #1
0
    /// <summary>
    /// Checks wether <paramref name="start"/> could ever reach <paramref name="end"/> in the <see cref="UtilitySystem"/> execution
    /// </summary>
    /// <param name="start"></param>
    /// <param name="end"></param>
    /// <returns></returns>
    public bool ConnectedCheck(UtilityNode start, UtilityNode end)
    {
        foreach (TransitionGUI transition in transitions.FindAll(t => !t.isExit && start.Equals(t.toNode)))
        {
            if (end.Equals((UtilityNode)transition.fromNode))
            {
                return(true);
            }
            if (ConnectedCheck((UtilityNode)transition.fromNode, end))
            {
                return(true);
            }
        }

        return(false);
    }
Example #2
0
    /// <summary>
    /// Deletes the <paramref name="node"/>
    /// </summary>
    /// <param name="node"></param>
    public void DeleteNode(UtilityNode node, bool deleteTransitions = true)
    {
        if (nodes.Remove(node))
        {
            if (deleteTransitions)
            {
                foreach (TransitionGUI transition in transitions.FindAll(t => node.Equals(t.fromNode) || node.Equals(t.toNode)))
                {
                    DeleteConnection(transition);
                }
            }

            if (node.subElem == null)
            {
                elementNamer.RemoveName(node.identificator);
            }
            else
            {
                elementNamer.RemoveName(node.subElem.identificator);
            }
        }
    }