public override ITerm CApply(Unifier u) { if (u != null) { ITerm vl = u.Get(this); if (vl != null) { if (!vl.IsCyclicTerm() && vl.HasVar(this, u)) { u.Remove(this); ITerm tempVl = vl.CApply(u); u.Bind(this, vl); CyclicTerm ct = new CyclicTerm(tempVl as Literal, this); Unifier renamedVars = new Unifier(); ct.MakeVarsAnnon(renamedVars); renamedVars.Remove(this); u.Compose(renamedVars); vl = ct; } vl = vl.CApply(u); if (vl.IsLiteral()) { if (GetNS() != Literal.DefaultNS) { vl = (vl.CloneNS(GetNS().CApply(u) as Atom) as Literal); } if (Negated()) { ((Literal)vl).SetNegated(Literal.LNeg); } } if (vl.IsLiteral() && this.HasAnnot()) { vl = ((Literal)vl).ForceFullLiteralImpl().AddAnnots((IListTerm)this.GetAnnots().CApply(u)); } return(vl); } } return((ITerm)Clone()); // Como uso el Clone de C# lo que clono son object que luego hay que castear... }