public new static CodeCompoundTerm Create(XElement xCodeCompoundTerm) { CodeFunctor codeFunctor = CodeFunctor.Create(xCodeCompoundTerm.Element(CodeFunctor.ElementName)); if (codeFunctor.Arity == 0) { return(new CodeCompoundTerm(codeFunctor)); } return(new CodeCompoundTerm( codeFunctor, CodeTermList.Create(xCodeCompoundTerm.Element(CodeTermList.ElementName)))); }
public CodeCompoundTerm(CodeFunctor functor) { if (functor == null) { throw new ArgumentNullException("functor"); } if (functor.Arity != 0) { throw new ArgumentException("Functor with non-zero arity specified."); } m_functor = functor; m_children = s_emptyList; }
public CodeCompoundTerm(CodeFunctor functor, IEnumerable <CodeTerm> children) { if (functor == null) { throw new ArgumentNullException("functor"); } if (children == null) { throw new ArgumentNullException("children"); } if (functor.Arity == 0) { throw new ArgumentException("Functor with zero arity specified."); } m_functor = functor; m_children = new CodeTermList(new List <CodeTerm>(children)); if (m_children.Count != m_functor.Arity) { throw new ArgumentException("Number of arguments does not match functor arity."); } }