Esempio n. 1
0
            private IPGTerminalSet ComputeSetForNextBranch(KthSet[] kthSets, List <KthSet> thisBranch, IPGTerminalSet covered)
            {
                int            i;
                IPGTerminalSet set = null;

                for (i = 0; ; i++)
                {
                    if (i == kthSets.Length)
                    {
                        return(null);                        // done!
                    }
                    set = kthSets[i].Set.Subtract(covered);
                    if (!set.IsEmptySet)
                    {
                        if (_currentRule.FullLLk ?? LLPG.FullLLk)
                        {
                            set = NarrowDownToOneCase(set, kthSets[i].Cases);
                        }
                        break;
                    }
                }

                thisBranch.Add(kthSets[i]);
                for (i++; i < kthSets.Length; i++)
                {
                    var next = set.Intersection(kthSets[i].Set);
                    if (!next.IsEmptySet)
                    {
                        set = next;
                        if (_currentRule.FullLLk ?? LLPG.FullLLk)
                        {
                            set = NarrowDownToOneCase(set, kthSets[i].Cases);
                        }
                        thisBranch.Add(kthSets[i]);
                    }
                }

                return(set);
            }
Esempio n. 2
0
        public static bool Overlaps(this IPGTerminalSet @this, IPGTerminalSet other)
        {
            var tmp = @this.Intersection(other);

            return(!tmp.IsEmptySet);
        }