public override ITerm CApply(Unifier u) { if (ns.IsVar()) { return(new Atom(this, u)); } else { return(this); } }
public VarTerm VarToReplace(ITerm t, Unifier u) { VarTerm v = (VarTerm)t; VarTerm deref = u.Deref(v); if (deref.Equals(v)) { Atom a = v.GetNS(); if (a.IsVar()) { a = VarToReplace(a, u); } //UnnamedVar uv = useShortUnnamedVars ? new UnnamedVar(a) : UnnamedVar.Create(a, t.ToString()); UnnamedVar uv = UnnamedVar.Create(a, t.ToString()); if (deref.HasAnnot()) { uv.SetAnnots(deref.GetAnnots().CloneLT()); uv.MakeVarsAnnon(u); } u.Bind(deref, v); return(v); } else { Atom a = v.GetNS(); if (a.IsVar()) { a = VarToReplace(a, u); } deref = (VarTerm)deref.CloneNS(a); if (v.HasAnnot() && !deref.HasAnnot()) { deref.SetAnnots(v.GetAnnots().CloneLT()); deref.MakeVarsAnnon(u); } return(deref); } }