public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            CodeCompoundTermList rhs = obj as CodeCompoundTermList;

            if (rhs == null)
            {
                return(false);
            }

            if (Count != rhs.Count)
            {
                return(false);
            }

            for (int idx = 0; idx < Count; ++idx)
            {
                if (this[idx] != rhs[idx])
                {
                    return(false);
                }
            }

            return(true);
        }
示例#2
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))));
 }
        public bool Equals(CodeCompoundTermList other)
        {
            if (object.ReferenceEquals(other, null))
            {
                return(false);
            }

            if (Count != other.Count)
            {
                return(false);
            }

            for (int idx = 0; idx < Count; ++idx)
            {
                if (this[idx] != other[idx])
                {
                    return(false);
                }
            }

            return(true);
        }
示例#4
0
        public CodeSentence(IEnumerable <CodeComment> comments, CodeCompoundTerm head, IEnumerable <CodeCompoundTerm> body)
        {
            if (comments == null)
            {
                m_comments = new CodeCommentList(new List <CodeComment>());
            }
            else
            {
                m_comments = new CodeCommentList(new List <CodeComment>(comments));
            }

            m_head = head;

            if (body == null)
            {
                m_body = new CodeCompoundTermList(new List <CodeCompoundTerm>());
            }
            else
            {
                m_body = new CodeCompoundTermList(new List <CodeCompoundTerm>(body));
            }
        }