Пример #1
0
        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))));
        }
Пример #2
0
        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;
        }
Пример #3
0
        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.");
            }
        }