Ejemplo n.º 1
0
        /// <summary>
        /// Extends the lfp with a symbolic element equivalent to t.
        /// </summary>
        private SymElement ExtendLFP(Term t)
        {
            SymElement e;

            if (lfp.TryFindValue(t, out e))
            {
                return(e);
            }

            Term normalized;
            var  enc = Encoder.GetTerm(t, out normalized);

            if (lfp.TryFindValue(normalized, out e))
            {
                return(e);
            }

            //// Neither t nor a normalized version of t has been seen.
            e = new SymElement(normalized, enc, Solver.Context);
            lfp.Add(normalized, e);
            if (normalized != t)
            {
                lfp.Add(t, e);
            }

            return(e);
        }
Ejemplo n.º 2
0
        private Entry GetEntry(SymElement t)
        {
            Entry e;

            if (!entryMap.TryFindValue(t, out e))
            {
                e = new Entry(t);
                entryMap.Add(t, e);
            }

            return(e);
        }
Ejemplo n.º 3
0
        public static int Compare(Activation a1, Activation a2)
        {
            var cmp = SymElement.Compare(a1.Binding1, a2.Binding1);

            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = SymElement.Compare(a1.Binding2, a2.Binding2);
            if (cmp != 0)
            {
                return(cmp);
            }

            return(a1.Rule.RuleId - a2.Rule.RuleId);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// "null" is the smallest symbolic element.
 /// </summary>
 public static int Compare(SymElement e1, SymElement e2)
 {
     if (e1 == null && e2 == null)
     {
         return(0);
     }
     else if (e1 == null && e2 != null)
     {
         return(-1);
     }
     else if (e1 != null && e2 == null)
     {
         return(1);
     }
     else
     {
         return(Term.Compare(e1.Term, e2.Term));
     }
 }
Ejemplo n.º 5
0
 public Activation(CoreRule rule, SymElement binding1, SymElement binding2)
 {
     Rule     = rule;
     Binding1 = binding1;
     Binding2 = binding2;
 }
Ejemplo n.º 6
0
 public Activation(CoreRule rule, SymElement binding)
 {
     Rule     = rule;
     Binding1 = binding;
     Binding2 = null;
 }
Ejemplo n.º 7
0
 public Activation(CoreRule rule)
 {
     Rule     = rule;
     Binding1 = Binding2 = null;
 }
Ejemplo n.º 8
0
 public static int Compare(Entry e1, Entry e2)
 {
     return(SymElement.Compare(e1.Element, e2.Element));
 }
Ejemplo n.º 9
0
 public Entry(SymElement t)
 {
     Contract.Requires(t != null);
     Element = t;
 }