Пример #1
0
        public void CreateDependencies()
        {
            foreach (FixtureVertex v in this.graph.Vertices)
            {
                FixtureVertex target = this.typeVertices[v.FixtureType] as FixtureVertex;
                if (target == null)
                {
                    throw new InvalidOperationException("Could not find vertex for fixture " + v.FixtureType.FullName);
                }

                // get DependsOn attributes
                foreach (DependsOnAttribute dependsOn in v.FixtureType.GetCustomAttributes(typeof(DependsOnAttribute), true))
                {
                    FixtureVertex source = this.typeVertices[dependsOn.ParentFixtureType] as FixtureVertex;
                    if (source == null)
                    {
                        continue;
                    }

                    if (this.graph.ContainsEdge(source, target))
                    {
                        continue;
                    }

                    this.graph.AddEdge(source, target);
                }
            }
        }
Пример #2
0
        public void AddFixture(Fixture fixture)
        {
            if (fixture == null)
            {
                throw new ArgumentNullException("fixture");
            }
            FixtureVertex v = this.AddFixtureVertex(fixture.Type);

            v.Fixtures.Add(fixture);
        }
Пример #3
0
        private FixtureVertex AddFixtureVertex(Type fixtureType)
        {
            FixtureVertex v = this.typeVertices[fixtureType] as FixtureVertex;

            if (v != null)
            {
                return(v);
            }

            v             = (FixtureVertex)this.graph.AddVertex();
            v.FixtureType = fixtureType;
            this.typeVertices.Add(fixtureType, v);
            return(v);
        }
Пример #4
0
                public bool MoveNext()
                {
                    if (fixtureEn == null)
                    {
                        if (!vertexEn.MoveNext())
                        {
                            return(false);
                        }
                        FixtureVertex v = vertexEn.Current as FixtureVertex;
                        this.fixtureEn = v.Fixtures.GetEnumerator();
                    }

                    while (!this.fixtureEn.MoveNext())
                    {
                        if (!vertexEn.MoveNext())
                        {
                            return(false);
                        }
                        FixtureVertex v = vertexEn.Current as FixtureVertex;
                        this.fixtureEn = v.Fixtures.GetEnumerator();
                    }

                    return(true);
                }