Esempio n. 1
0
 public static CodeSentence Create(XElement xCodeSentence)
 {
     return(new CodeSentence(
                CodeCommentList.Create(xCodeSentence.Element(CodeCommentList.ElementName)),
                (CodeCompoundTerm)CodeTerm.Create(xCodeSentence.Element(CodeTerm.ElementName)),
                CodeCompoundTermList.Create(xCodeSentence.Element(CodeCompoundTermList.ElementName))));
 }
Esempio n. 2
0
        public CodeList(IEnumerable <CodeTerm> head, CodeTerm tail)
        {
            if (head == null)
            {
                throw new ArgumentNullException("head");
            }
            if (tail == null)
            {
                throw new ArgumentNullException("tail");
            }

            if (tail.IsCodeList)
            {
                List <CodeTerm> headTerms = new List <CodeTerm>(head);
                headTerms.AddRange(tail.AsCodeList.Head);

                m_head = new CodeTermList(headTerms);
                m_tail = tail.AsCodeList.Tail;
            }
            else
            {
                m_head = new CodeTermList(new List <CodeTerm>(head));
                m_tail = tail;
            }
        }
        public static CodeCompoundTermList Create(XElement xCodeCompoundTermList)
        {
            List <CodeCompoundTerm> codeCompoundTerms = new List <CodeCompoundTerm>();

            foreach (XElement xCodeCompoundTerm in xCodeCompoundTermList.Elements(CodeTerm.ElementName))
            {
                codeCompoundTerms.Add((CodeCompoundTerm)CodeTerm.Create(xCodeCompoundTerm));
            }

            return(new CodeCompoundTermList(codeCompoundTerms));
        }
Esempio n. 4
0
 public new static CodeList Create(XElement xCodeList)
 {
     return(new CodeList(
                CodeTermList.Create(xCodeList.Element(CodeTermList.ElementName)),
                CodeTerm.Create(xCodeList.Element(CodeTerm.ElementName))));
 }
Esempio n. 5
0
 public CodeList()
 {
     m_head = new CodeTermList(new List <CodeTerm>());
     m_tail = new CodeCompoundTerm(CodeFunctor.NilFunctor);
 }
Esempio n. 6
0
 public override bool Equals(CodeTerm other)
 {
     return(Equals(other as CodeList));
 }
 public override bool Equals(CodeTerm other)
 {
     return(Equals(other as CodeCompoundTerm));
 }
Esempio n. 8
0
 public override bool Equals(CodeTerm other)
 {
     return(Equals(other as CodeVariable));
 }