示例#1
0
        // Ritorna una relazione contenente coppie (xi, yi) tali per cui in solution.assignments
        // esiste una variabile il cui valore assegnato è xi
        private Relation FulfilledRelation(Solution solution, Relation rel)
        {
            Relation fulRel = new Relation();

            foreach (KeyValuePair <string, string> assignment in solution.assignments)
            {
                foreach (Tuple <string, string> pair in rel.relation)
                {
                    if (assignment.Value == pair.Item1)
                    {
                        fulRel.AddPair(pair.Item1, pair.Item2);
                    }
                }
            }
            return(fulRel);
        }
示例#2
0
        // Pair ::= "(" val "," val ")"
        void Pair(Relation r)
        {
            if (ts.Current.kind != Kind.LEFT_PARENT)
            {
                return;
            }
            Expect(Kind.LEFT_PARENT);
            string x = ts.Current.value;

            Expect(Kind.VALUE);
            Expect(Kind.COMMA);
            string y = ts.Current.value;

            Expect(Kind.VALUE);
            Expect(Kind.RIGHT_PARENT);
            r.AddPair(x, y);
        }
示例#3
0
 // Pair ::= "(" val "," val ")"
 void Pair(Relation r)
 {
     if (ts.Current.kind != Kind.LEFT_PARENT) return;
     Expect(Kind.LEFT_PARENT);
     string x = ts.Current.value;
     Expect(Kind.VALUE);
     Expect(Kind.COMMA);
     string y = ts.Current.value;
     Expect(Kind.VALUE);
     Expect(Kind.RIGHT_PARENT);
     r.AddPair(x, y);
 }