示例#1
0
        static void SplitListOnCharSet(List <CharSet> list, CharSet set)
        {
            for (var i = list.Count - 1; i >= 0; i--)
            {
                var existing = list[i];

                if (set.Intersects(existing))
                {
                    var intersect    = existing.Intersection(set);
                    var existingOnly = existing.Subtract(intersect);
                    var newOnly      = set.Subtract(intersect);

                    list[i] = intersect;
                    if (!existingOnly.IsEmptySet)
                    {
                        list.Add(existingOnly);
                    }

                    set = newOnly;
                }
            }

            if (!set.IsEmptySet)
            {
                list.Add(set);
            }
        }
示例#2
0
        static Graph.State NextState(Graph.State state, CharSet charSet)
        {
            foreach (var transition in state.ToTransitions)
            {
                if (charSet.Intersects(transition.Label))
                {
                    return(transition.ToState);
                }
            }

            return(null);
        }