示例#1
0
        /// <summary>
        /// Detects whether the specified node participates in a cycle.
        /// </summary>
        public Path FindCycle(Node participant)
        {
            StraightFactory factory         = new StraightFactory();
            FCNode          participantNode = factory.CreateNode(participant, false, false) as FCNode;

            foreach (FCNode node in graph.Nodes)
            {
                if (node == participantNode)
                {
                    participantNode = node;
                    break;
                }
            }

            MindFusion.LayoutSystem.Path path =
                MindFusion.LayoutSystem.PathFinder.FindCycle(graph, participantNode);

            if (path != null)
            {
                return(new Path(path));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
            public static void Main()
            {
                // Create and run the Straight Person world
                PersonFactory straight = new StraightFactory();
                PersonWorld world = new PersonWorld(straight);
                world.LoveIn();

                // Create and run the Gay Person world
                PersonFactory gay = new GayFactory();
                PersonWorld world1 = new PersonWorld(gay);
                world1.LoveIn();

                // Wait for user input
                Console.ReadKey();
            }