Exemplo n.º 1
0
        protected Operator(String op, int precedence, OperatorSubType subType)
        {
            if (subType != OperatorSubType.None && subType != OperatorSubType.Any && subType != OperatorSubType.All)
            {
                throw new ArgumentException("Invalid sub type.", "subType");
            }

            this.op         = op;
            this.precedence = precedence;
            this.subType    = subType;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Returns the ANY or ALL form of this operator.
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public Operator GetSubQueryForm(OperatorSubType type)
        {
            Operator resultOp = null;

            if (type == OperatorSubType.Any)
            {
                AnyMap.TryGetValue(op, out resultOp);
            }
            else if (type == OperatorSubType.All)
            {
                AllMap.TryGetValue(op, out resultOp);
            }
            else if (type == OperatorSubType.None)
            {
                resultOp = Get(op);
            }

            if (resultOp == null)
            {
                throw new ApplicationException("Couldn't change the form of operator '" + op + "'.");
            }

            return(resultOp);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Given a parameter of either NONE, ANY, ALL or SINGLE, this returns true
 /// if this operator is of the given type.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public bool IsSubQueryForm(OperatorSubType type)
 {
     return type == subType;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Returns the ANY or ALL form of this operator.
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public Operator GetSubQueryForm(OperatorSubType type)
        {
            Operator resultOp = null;
            if (type == OperatorSubType.Any) {
                AnyMap.TryGetValue(op, out resultOp);
            } else if (type == OperatorSubType.All) {
                AllMap.TryGetValue(op, out resultOp);
            } else if (type == OperatorSubType.None) {
                resultOp = Get(op);
            }

            if (resultOp == null)
                throw new ApplicationException("Couldn't change the form of operator '" + op + "'.");

            return resultOp;
        }
Exemplo n.º 5
0
        protected Operator(String op, int precedence, OperatorSubType subType)
        {
            if (subType != OperatorSubType.None && subType != OperatorSubType.Any && subType != OperatorSubType.All)
                throw new ArgumentException("Invalid sub type.", "subType");

            this.op = op;
            this.precedence = precedence;
            this.subType = subType;
        }
Exemplo n.º 6
0
 /// <summary>
 /// Given a parameter of either NONE, ANY, ALL or SINGLE, this returns true
 /// if this operator is of the given type.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public bool IsSubQueryForm(OperatorSubType type)
 {
     return(type == subType);
 }