コード例 #1
0
        //*
        // * Creates a new look-ahead set that is the intersection of
        // * this set with another set. The token sequences in the net
        // * set will only have the repeat flag set if it was set in
        // * both the identical token sequences.
        // *
        // * @param set the set to intersect with
        // *
        // * @return a new look-ahead set containing the intersection
        //

        public LookAheadSet CreateIntersection(LookAheadSet @set)
        {
            LookAheadSet result = new LookAheadSet(maxLength);
            Sequence     seq1   = default(Sequence);
            Sequence     seq2   = default(Sequence);

            for (int i = 0; i <= elements.Count - 1; i++)
            {
                seq1 = (Sequence)elements[i];
                seq2 = @set.FindSequence(seq1);
                if (seq2 != null && seq1.IsRepetitive())
                {
                    result.Add(seq2);
                }
                else if (seq2 != null)
                {
                    result.Add(seq1);
                }
            }
            return(result);
        }