コード例 #1
0
ファイル: DependencyFilter.cs プロジェクト: codyn-net/rawc
        // Returns a set of @this which depends on any state in @states.
        // In addition, @rest will contain the inverse set (i.e. everyting in
        // @this which did _not_ depend on any state in @states).
        public DependencyFilter DependsOn(IEnumerable <State> states)
        {
            DependencyFilter ret = (d_filter ? this : new DependencyFilter(d_graph, this));

            ret.d_not = null;

            // Check for each state if it depends on a state in states. If so, it should
            // be in the result set, if not it should be in the rest set
            ret.RemoveWhere((s) => {
                bool doesdepend = false;

                foreach (State other in states)
                {
                    if (d_graph.DependsOn(s, other.Object))
                    {
                        doesdepend = true;
                        break;
                    }
                }

                if (!doesdepend)
                {
                    if (ret.d_not == null)
                    {
                        ret.d_not = new DependencyFilter(d_graph);
                    }

                    ret.d_not.Add(s);
                }

                return(!doesdepend);
            });

            return(ret);
        }
コード例 #2
0
ファイル: DependencyFilter.cs プロジェクト: codyn-net/rawc
        public DependencyFilter DependencyOf(IEnumerable <State> states)
        {
            DependencyFilter ret = (d_filter ? this : new DependencyFilter(d_graph, this));

            ret.d_not = null;

            ret.RemoveWhere((s) => {
                bool doesdepend = false;

                foreach (State other in states)
                {
                    if (d_graph.DependsOn(other, s.Object))
                    {
                        doesdepend = true;
                        break;
                    }
                }

                if (!doesdepend)
                {
                    if (ret.d_not == null)
                    {
                        ret.d_not = new DependencyFilter(d_graph);
                    }

                    ret.d_not.Add(s);
                }

                return(!doesdepend);
            });

            return(ret);
        }
コード例 #3
0
ファイル: DependencyFilter.cs プロジェクト: codyn-net/rawc
        public DependencyFilter Copy()
        {
            var ret = new DependencyFilter(d_graph, this);

            if (d_not != null)
            {
                ret.d_not = d_not.Copy();
            }

            return(ret);
        }
コード例 #4
0
ファイル: DependencyFilter.cs プロジェクト: codyn-net/rawc
        public DependencyFilter Not()
        {
            if (d_filter)
            {
                var n = d_not;

                if (Count == 0)
                {
                    d_not = null;
                }
                else
                {
                    d_not = new DependencyFilter(d_graph, this);
                }

                Clear();

                if (n != null)
                {
                    UnionWith(n);
                }

                return(this);
            }
            else
            {
                if (d_not != null)
                {
                    return(d_not);
                }
                else
                {
                    return(new DependencyFilter(d_graph));
                }
            }
        }