public override Boolean IsAppear(_Term p) { Boolean flag = false; if (p.GetType() == _TypeOfTerm.COMPOSITE) { return(false); } for (int i = 0; i < mComponents.Count; ++i) { _Term temp = (_Term)mComponents[i]; if (temp.GetType() == _TypeOfTerm.COMPOSITE) { flag = temp.IsAppear(p); } else { flag = temp.CompareTo(p); } if (flag == true) { return(true); } } return(false); }
private Boolean Unify_var(_Variable var, _Term x, ref _MGU s) { _Element val; if ((val = s.Find(var)) != null) { return(Run(val.Arg2, x, ref s)); } else if ((val = s.Find(x)) != null) { return(Run(var, val.Arg1, ref s)); } else if (x.IsAppear(var) == true) { return(false); } else { s.Add(new _Element(var, x)); return(true); } }