Esempio n. 1
0
 public void SetLabel(Pred p)
 {
     label         = p;
     isAtomic      = false;
     hasBreakpoint = false;
     isAllUnifs    = false;
     if (p != null && p.HasAnnot())
     {
         foreach (ITerm t in label.GetAnnots())
         {
             if (t.Equals(TAtomic))
             {
                 isAtomic = true;
             }
             if (t.Equals(TBreakPoint))
             {
                 hasBreakpoint = true;
             }
             if (t.Equals(TAllUnifs))
             {
                 isAllUnifs = true;
             }
         }
     }
 }
Esempio n. 2
0
        public override int CompareTo(ITerm t)
        {
            int c = base.CompareTo(t);

            if (c != 0)
            {
                return(c);
            }
            if (t.IsPred())
            {
                Pred tAsPred = (Pred)t;
                if (GetAnnots() == null && tAsPred.GetAnnots() == null)
                {
                    return(0);
                }
                if (GetAnnots() == null)
                {
                    return(-1);
                }
                if (tAsPred.GetAnnots() == null)
                {
                    return(1);
                }
                IEnumerator <ITerm> pai = tAsPred.GetAnnots().ListTermIterator();
                foreach (ITerm a in GetAnnots())
                {
                    c = a.CompareTo(pai.Current);
                    if (c != 0)
                    {
                        return(c);
                    }
                }
                int ats = GetAnnots().Count;
                int ots = tAsPred.GetAnnots().Count;
                if (ats < ots)
                {
                    return(-1);
                }
                if (ats > ots)
                {
                    return(1);
                }
            }
            return(0);
        }