示例#1
0
        /// <summary>Initializes a new instance of the ExprNode class</summary>
        /// <param name="termNode">Term object</param>
        /// <param name="termsWithOperators">Terms with Operators</param>
        public ExprNode(TermNode termNode, ReadOnlyCollection <TermWithOperatorNode> termsWithOperators, ReadOnlyCollection <ImportantCommentNode> importantComments)
        {
            Contract.Requires(termNode != null);

            this.TermNode           = termNode;
            this.TermsWithOperators = termsWithOperators ?? (new List <TermWithOperatorNode>()).AsReadOnly();
            this.ImportantComments  = importantComments ?? (new List <ImportantCommentNode>()).AsReadOnly();
            this.UsesBinary         = false;
        }
示例#2
0
        /// <summary>Initializes a new instance of the TermWithOperatorNode class</summary>
        /// <param name="op">Operator string</param>
        /// <param name="termNode">Term object</param>
        public TermWithOperatorNode(string op, TermNode termNode)
        {
            Contract.Requires(termNode != null);

            if (string.IsNullOrWhiteSpace(op))
            {
                op = CssConstants.SingleSpace.ToString();
            }

            // Member Initialization
            this.Operator = op;
            this.TermNode = termNode;
        }
示例#3
0
        /// <summary>
        /// Determines if the node is equal to another node
        /// </summary>
        /// <param name="termNode"> another term node</param>
        /// <returns> Equal or not.</returns>
        public bool Equals(TermNode termNode)
        {
            bool equals = termNode.IsBinary == this.IsBinary &&
                          termNode.UnaryOperator == this.UnaryOperator &&
                          termNode.NumberBasedValue == this.NumberBasedValue &&
                          termNode.StringBasedValue == this.StringBasedValue &&
                          termNode.Hexcolor == this.Hexcolor;

            if (this.FunctionNode != null && termNode.FunctionNode != null)
            {
                return(equals && termNode.FunctionNode.Equals(this.FunctionNode));
            }
            else if (this.FunctionNode == null && termNode.FunctionNode == null)
            {
                return(equals);
            }
            else
            {
                return(false);
            }
        }