Пример #1
0
        public override object Evaluate(MessageEvaluationContext message)
        {
            object rvalue = Right.Evaluate(message);

            bool answer = false;

            if (rvalue != null && (rvalue is string))
            {
                answer = hashset.Contains((string)rvalue);
            }

            return(notNot ? answer : !answer);
        }
Пример #2
0
        public override object Evaluate(MessageEvaluationContext message)
        {
            object lvalue = Left.Evaluate(message);

            if (lvalue != null && (bool)lvalue)
            {
                return(true);
            }

            object rvalue = Right.Evaluate(message);

            return(rvalue == null ? null : rvalue);
        }
Пример #3
0
        public override object Evaluate(MessageEvaluationContext message)
        {
            object lvalue = Left.Evaluate(message);

            if (lvalue == null)
            {
                return(null);
            }

            object rvalue = Right.Evaluate(message);

            if (lvalue is string)
            {
                return((string)lvalue + rvalue);
            }
            if (rvalue == null)
            {
                return(null);
            }

            AlignedNumericValues values = new AlignedNumericValues(lvalue, rvalue);

            object result = null;

            switch (values.TypeEnum)
            {
            case AlignedNumericValues.T.SByteType: result = (sbyte )values.Left + (sbyte )values.Right; break;

            case AlignedNumericValues.T.ByteType: result = (byte  )values.Left + (byte  )values.Right; break;

            case AlignedNumericValues.T.CharType: result = (char  )values.Left + (char  )values.Right; break;

            case AlignedNumericValues.T.ShortType: result = (short )values.Left + (short )values.Right; break;

            case AlignedNumericValues.T.UShortType: result = (ushort)values.Left + (ushort)values.Right; break;

            case AlignedNumericValues.T.IntType: result = (int   )values.Left + (int   )values.Right; break;

            case AlignedNumericValues.T.UIntType: result = (uint  )values.Left + (uint  )values.Right; break;

            case AlignedNumericValues.T.LongType: result = (long  )values.Left + (long  )values.Right; break;

            case AlignedNumericValues.T.ULongType: result = (ulong )values.Left + (ulong )values.Right; break;

            case AlignedNumericValues.T.FloatType: result = (float )values.Left + (float )values.Right; break;

            case AlignedNumericValues.T.DoubleType: result = (double)values.Left + (double)values.Right; break;
            }

            return(result);
        }
        public override object Evaluate(MessageEvaluationContext message)
        {
            object rvalue = Right.Evaluate(message);

            if (rvalue == null)
            {
                return(null);
            }
            if (rvalue is bool)
            {
                return((bool)rvalue);
            }
            return(false);
        }
Пример #5
0
        public override object Evaluate(MessageEvaluationContext message)
        {
            object rvalue = this.Right.Evaluate(message);

            bool answer = false;

            if (rvalue != null)
            {
                if (rvalue is string)
                {
                    answer = pattern.IsMatch((string)rvalue);
                }
                else
                {
                    //throw new ApplicationException("LIKE can only operate on string identifiers. LIKE attemped on " + rvalue.GetType().ToString());
                }
            }

            return(notNot ? answer : !answer);
        }
Пример #6
0
        public override object Evaluate(MessageEvaluationContext message)
        {
            object rvalue = Right.Evaluate(message);

            if (rvalue == null)
            {
                return(null);
            }
            if (rvalue is int)
            {
                return(-(int    )rvalue);
            }
            if (rvalue is long)
            {
                return(-(long   )rvalue);
            }
            if (rvalue is double)
            {
                return(-(double )rvalue);
            }
            if (rvalue is float)
            {
                return(-(float  )rvalue);
            }
            if (rvalue is decimal)
            {
                return(-(decimal)rvalue);
            }
            if (rvalue is short)
            {
                return(-(short  )rvalue);
            }
            if (rvalue is byte)
            {
                return(-(byte   )rvalue);
            }
            return(null);
        }
 public object Evaluate(MessageEvaluationContext message)
 {
     return(message.GetProperty(name));
 }
Пример #8
0
 public object Evaluate(MessageEvaluationContext message)
 {
     return(value);
 }
        public bool Matches(MessageEvaluationContext message)
        {
            object value = Evaluate(message);

            return(value != null && (bool)value);
        }
Пример #10
0
 public abstract object Evaluate(MessageEvaluationContext message);