Пример #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;
             }
         }
     }
 }
Пример #2
0
        public static Pred CreateSource(ITerm source)
        {
            Pred s;

            if (source.IsGround())
            {
                s = new PredImpl("source", 1);
            }
            else
            {
                s = new Pred("source", 1);
            }
            s.AddTerm(source);
            return(s);
        }
Пример #3
0
 public Plan(Pred label, Trigger te, ILogicalFormula ct, IPlanBody bd) : base("plan", 0)
 {
     tevent = te;
     tevent.SetAsTriggerTerm(false);
     SetLabel(label);
     SetContext(ct);
     if (bd == null)
     {
         body = new PlanBodyImpl();
     }
     else
     {
         body = bd;
         body.SetAsBodyTerm(false);
     }
 }
Пример #4
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);
        }
Пример #5
0
        public override void SetTerm(int i, ITerm t)
        {
            switch (i)
            {
            case 0:
                label = (Pred)t;
                break;

            case 1:
                tevent = (Trigger)t;
                break;

            case 2:
                context = (ILogicalFormula)t;
                break;

            case 3:
                body = (IPlanBody)t;
                break;
            }
        }
Пример #6
0
 public override bool Equals(object o)
 {
     if (o == null)
     {
         return(false);
     }
     if (o == this)
     {
         return(true);
     }
     if (o.GetType() == typeof(Pred))
     {
         Pred p = (Pred)o;
         return(base.Equals(o) && this.HasSubsetAnnot(p) && p.HasSubsetAnnot(this));
     }
     else if (o.GetType() == typeof(Atom) && !HasAnnot())
     {
         return(base.Equals(o));
     }
     return(false);
 }