Example #1
0
        /// <summary>
        /// The base constructor
        /// </summary>
        /// <param name="type">A logical operation's type</param>
        /// <param name="firstOp">The operand stores an integer value</param>
        /// <param name="secondOp">The operand is needed when modulo comparison is used (stores 1 or 0)</param>

        public CLambdaPredicateASTNode(E_LOGIC_OP_TYPE type, IValueASTNode firstOp, IValueASTNode secondOp) :
            base(E_NODE_TYPE.NT_LAMBDA_PREDICATE)
        {
            mLogicOpType = type;

            IASTNode firstOpNode  = firstOp as IASTNode;
            IASTNode secondOpNode = secondOp as IASTNode;

            firstOpNode.Parent = this;

            firstOpNode.NodeId = 0;

            mChildren.Add(firstOpNode);

            if (secondOpNode != null)
            {
                secondOpNode.Parent = this;

                secondOpNode.NodeId = 1;

                mChildren.Add(secondOpNode);
            }

            mAttributes = E_NODE_ATTRIBUTES.NA_IS_LEAF_NODE;
        }
Example #2
0
        public string VisitValueNode(IValueASTNode value)
        {
            StringBuilder arrayStr = new StringBuilder("[");

            int[] values = value.Value;

            int valuesCount = values.Length;

            if (valuesCount == 0)
            {
                return("NULL");
            }

            if (valuesCount == 1)
            {
                return(values[0].ToString());
            }

            for (int i = 0; i < valuesCount; ++i)
            {
                if (i < valuesCount - 1)
                {
                    arrayStr.AppendFormat("{0}, ", values[i]);

                    continue;
                }

                arrayStr.AppendFormat("{0}]", values[i]);
            }

            return(arrayStr.ToString());
        }
Example #3
0
        public Object VisitValueNode(IValueASTNode value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value", "The argument cannot equal to null");
            }

            return(value.Value);
        }
        public CReadInputASTNode(IValueASTNode index) :
            base(E_NODE_TYPE.NT_READ_INT_ARRAY)
        {
            IASTNode indexNode = index as IASTNode;

            mChildren.Add(indexNode);

            indexNode.Parent = this;
            indexNode.NodeId = 0;

            mAttributes = E_NODE_ATTRIBUTES.NA_IS_LEAF_NODE;
        }