You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2017/03/07 19:39:28 UTC
[48/50] [abbrv] activemq-nms-msmq git commit: Apply patch for
AMQNET-556 from Stephane Ramet. Thanks Stephane!
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/AlignedNumericValues.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/AlignedNumericValues.cs b/src/main/csharp/Selector/AlignedNumericValues.cs
index 96e2eeb..b8bfa50 100644
--- a/src/main/csharp/Selector/AlignedNumericValues.cs
+++ b/src/main/csharp/Selector/AlignedNumericValues.cs
@@ -1,175 +1,174 @@
-\ufeffusing System;
-using System.Globalization;
-using System.Collections.Generic;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// A couple of numeric values converted to the type of the largest type.
- /// </summary>
- public class AlignedNumericValues
- {
- private object left;
- public object Left
- {
- get { return left; }
- }
-
- private object right;
- public object Right
- {
- get { return right; }
- }
-
- private T type;
- public T TypeEnum
- {
- get { return type; }
- }
-
- public Type Type
- {
- get { return GetType(type); }
- }
-
- public AlignedNumericValues(object lvalue, object rvalue)
- {
- if(lvalue == null || rvalue == null)
- {
- return;
- }
-
- T ltypeEnum = GetTypeEnum(lvalue);
- T rtypeEnum = GetTypeEnum(rvalue);
-
- type = targetType[(int)ltypeEnum][(int)rtypeEnum];
-
- left = (ltypeEnum == type ? lvalue : ConvertValue(lvalue, type));
- right = (rtypeEnum == type ? rvalue : ConvertValue(rvalue, type));
- }
-
- public enum T
- {
- SByteType = 0, // Signed 8-bit integer (-128 to 127)
- ByteType = 1, // Unsigned 8-bit integer (0 to 255)
- CharType = 2, // Unicode 16-bit character (U+0000 to U+ffff)
- ShortType = 3, // Signed 16-bit integer (-32 768 to 32 767)
- UShortType = 4, // Unsigned 16-bit integer (0 to 65 535)
- IntType = 5, // Signed 32-bit integer (-2 147 483 648 to 2 147 483 647)
- UIntType = 6, // Unsigned 32-bit integer (0 to 4 294 967 295)
- LongType = 7, // Signed 64-bit integer (-9 223 372 036 854 775 808 to 9 223 372 036 854 775 807)
- ULongType = 8, // Unsigned 64-bit integer (0 to 18 446 744 073 709 551 615)
- FloatType = 9, // 7 digits (�1.5e\u221245 to �3.4e38)
- DoubleType = 10 // 15-16 digits (�5.0e\u2212324 to �1.7e308)
- }
-
- private static Dictionary<Type, T> typeEnums
- = new Dictionary<Type, T>
- {
- { typeof(sbyte ), T.SByteType },
- { typeof(byte ), T.ByteType },
- { typeof(char ), T.CharType },
- { typeof(short ), T.ShortType },
- { typeof(ushort), T.UShortType },
- { typeof(int ), T.IntType },
- { typeof(uint ), T.UIntType },
- { typeof(long ), T.LongType },
- { typeof(ulong ), T.ULongType },
- { typeof(float ), T.FloatType },
- { typeof(double), T.DoubleType }
- };
-
- private static T[][] targetType = new T[][]
- {
- // SByteType , ByteType , CharType , ShortType , UShortType, IntType , UIntType , LongType , ULongType , FloatType , DoubleType
- /*SByteType */new T[] { T.SByteType , T.ShortType , T.IntType , T.ShortType , T.IntType , T.IntType , T.LongType , T.LongType , T.LongType , T.FloatType , T.DoubleType },
- /*ByteType */new T[] { T.ShortType , T.ByteType , T.UShortType, T.ShortType , T.UShortType, T.IntType , T.UIntType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
- /*CharType */new T[] { T.IntType , T.UShortType, T.CharType , T.IntType , T.UShortType, T.IntType , T.LongType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
- /*ShortType */new T[] { T.ShortType , T.ShortType , T.IntType , T.ShortType , T.IntType , T.IntType , T.LongType , T.LongType , T.LongType , T.FloatType , T.DoubleType },
- /*UShortType*/new T[] { T.IntType , T.UShortType, T.UShortType, T.IntType , T.UShortType, T.IntType , T.UIntType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
- /*IntType */new T[] { T.IntType , T.IntType , T.IntType , T.IntType , T.IntType , T.IntType , T.LongType , T.LongType , T.LongType , T.FloatType , T.DoubleType },
- /*UIntType */new T[] { T.LongType , T.UIntType , T.LongType , T.LongType , T.UIntType , T.LongType , T.UIntType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
- /*LongType */new T[] { T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.FloatType , T.DoubleType },
- /*ULongType */new T[] { T.LongType , T.ULongType , T.ULongType , T.LongType , T.ULongType , T.LongType , T.ULongType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
- /*FloatType */new T[] { T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.DoubleType },
- /*DoubleType*/new T[] { T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType }
- };
-
- private T GetTypeEnum(object value)
- {
- return GetTypeEnum(value.GetType());
- }
-
- private T GetTypeEnum(Type type)
- {
- try
- {
- return typeEnums[type];
- }
- catch
- {
- throw new NotSupportedException(
- string.Format("Unsupported data type {0}.", type));
- }
- }
-
- private Type GetType(T typeEnum)
- {
- switch(typeEnum)
- {
- case T.SByteType : return typeof(sbyte );
- case T.ByteType : return typeof(byte );
- case T.CharType : return typeof(char );
- case T.ShortType : return typeof(short );
- case T.UShortType: return typeof(ushort);
- case T.IntType : return typeof(int );
- case T.UIntType : return typeof(uint );
- case T.LongType : return typeof(long );
- case T.ULongType : return typeof(ulong );
- case T.FloatType : return typeof(float );
- case T.DoubleType: return typeof(double);
- default:
- throw new NotSupportedException(
- string.Format("Unsupported data type {0}.", typeEnum));
- }
- }
-
- private object ConvertValue(object value, T targetTypeEnum)
- {
- switch(targetTypeEnum)
- {
- case T.SByteType : return Convert.ToSByte (value);
- case T.ByteType : return Convert.ToByte (value);
- case T.CharType : return Convert.ToChar (value);
- case T.ShortType : return Convert.ToInt16 (value);
- case T.UShortType: return Convert.ToUInt16(value);
- case T.IntType : return Convert.ToInt32 (value);
- case T.UIntType : return Convert.ToUInt32(value);
- case T.LongType : return Convert.ToInt64 (value);
- case T.ULongType : return Convert.ToUInt64(value);
- case T.FloatType : return Convert.ToSingle(value);
- case T.DoubleType: return Convert.ToDouble(value);
- default:
- throw new NotSupportedException(
- string.Format("Unsupported data type {0}.", targetTypeEnum));
- }
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Globalization;
+using System.Collections.Generic;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// A couple of numeric values converted to the type of the largest type.
+ /// </summary>
+ public class AlignedNumericValues
+ {
+ private object left;
+ public object Left
+ {
+ get { return left; }
+ }
+
+ private object right;
+ public object Right
+ {
+ get { return right; }
+ }
+
+ private T type;
+ public T TypeEnum
+ {
+ get { return type; }
+ }
+
+ public Type Type
+ {
+ get { return GetType(type); }
+ }
+
+ public AlignedNumericValues(object lvalue, object rvalue)
+ {
+ if(lvalue == null || rvalue == null)
+ {
+ return;
+ }
+
+ T ltypeEnum = GetTypeEnum(lvalue);
+ T rtypeEnum = GetTypeEnum(rvalue);
+
+ type = targetType[(int)ltypeEnum][(int)rtypeEnum];
+
+ left = (ltypeEnum == type ? lvalue : ConvertValue(lvalue, type));
+ right = (rtypeEnum == type ? rvalue : ConvertValue(rvalue, type));
+ }
+
+ public enum T
+ {
+ SByteType = 0, // Signed 8-bit integer (-128 to 127)
+ ByteType = 1, // Unsigned 8-bit integer (0 to 255)
+ CharType = 2, // Unicode 16-bit character (U+0000 to U+ffff)
+ ShortType = 3, // Signed 16-bit integer (-32 768 to 32 767)
+ UShortType = 4, // Unsigned 16-bit integer (0 to 65 535)
+ IntType = 5, // Signed 32-bit integer (-2 147 483 648 to 2 147 483 647)
+ UIntType = 6, // Unsigned 32-bit integer (0 to 4 294 967 295)
+ LongType = 7, // Signed 64-bit integer (-9 223 372 036 854 775 808 to 9 223 372 036 854 775 807)
+ ULongType = 8, // Unsigned 64-bit integer (0 to 18 446 744 073 709 551 615)
+ FloatType = 9, // 7 digits (�1.5e\u221245 to �3.4e38)
+ DoubleType = 10 // 15-16 digits (�5.0e\u2212324 to �1.7e308)
+ }
+
+ private static Dictionary<Type, T> typeEnums
+ = new Dictionary<Type, T>
+ {
+ { typeof(sbyte ), T.SByteType },
+ { typeof(byte ), T.ByteType },
+ { typeof(char ), T.CharType },
+ { typeof(short ), T.ShortType },
+ { typeof(ushort), T.UShortType },
+ { typeof(int ), T.IntType },
+ { typeof(uint ), T.UIntType },
+ { typeof(long ), T.LongType },
+ { typeof(ulong ), T.ULongType },
+ { typeof(float ), T.FloatType },
+ { typeof(double), T.DoubleType }
+ };
+
+ private static T[][] targetType = new T[][]
+ {
+ // SByteType , ByteType , CharType , ShortType , UShortType, IntType , UIntType , LongType , ULongType , FloatType , DoubleType
+ /*SByteType */new T[] { T.SByteType , T.ShortType , T.IntType , T.ShortType , T.IntType , T.IntType , T.LongType , T.LongType , T.LongType , T.FloatType , T.DoubleType },
+ /*ByteType */new T[] { T.ShortType , T.ByteType , T.UShortType, T.ShortType , T.UShortType, T.IntType , T.UIntType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
+ /*CharType */new T[] { T.IntType , T.UShortType, T.CharType , T.IntType , T.UShortType, T.IntType , T.LongType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
+ /*ShortType */new T[] { T.ShortType , T.ShortType , T.IntType , T.ShortType , T.IntType , T.IntType , T.LongType , T.LongType , T.LongType , T.FloatType , T.DoubleType },
+ /*UShortType*/new T[] { T.IntType , T.UShortType, T.UShortType, T.IntType , T.UShortType, T.IntType , T.UIntType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
+ /*IntType */new T[] { T.IntType , T.IntType , T.IntType , T.IntType , T.IntType , T.IntType , T.LongType , T.LongType , T.LongType , T.FloatType , T.DoubleType },
+ /*UIntType */new T[] { T.LongType , T.UIntType , T.LongType , T.LongType , T.UIntType , T.LongType , T.UIntType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
+ /*LongType */new T[] { T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.LongType , T.FloatType , T.DoubleType },
+ /*ULongType */new T[] { T.LongType , T.ULongType , T.ULongType , T.LongType , T.ULongType , T.LongType , T.ULongType , T.LongType , T.ULongType , T.FloatType , T.DoubleType },
+ /*FloatType */new T[] { T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.FloatType , T.DoubleType },
+ /*DoubleType*/new T[] { T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType, T.DoubleType }
+ };
+
+ private T GetTypeEnum(object value)
+ {
+ return GetTypeEnum(value.GetType());
+ }
+
+ private T GetTypeEnum(Type type)
+ {
+ try
+ {
+ return typeEnums[type];
+ }
+ catch
+ {
+ throw new NotSupportedException(
+ string.Format("Unsupported data type {0}.", type));
+ }
+ }
+
+ private Type GetType(T typeEnum)
+ {
+ switch(typeEnum)
+ {
+ case T.SByteType : return typeof(sbyte );
+ case T.ByteType : return typeof(byte );
+ case T.CharType : return typeof(char );
+ case T.ShortType : return typeof(short );
+ case T.UShortType: return typeof(ushort);
+ case T.IntType : return typeof(int );
+ case T.UIntType : return typeof(uint );
+ case T.LongType : return typeof(long );
+ case T.ULongType : return typeof(ulong );
+ case T.FloatType : return typeof(float );
+ case T.DoubleType: return typeof(double);
+ default:
+ throw new NotSupportedException(
+ string.Format("Unsupported data type {0}.", typeEnum));
+ }
+ }
+
+ private object ConvertValue(object value, T targetTypeEnum)
+ {
+ switch(targetTypeEnum)
+ {
+ case T.SByteType : return Convert.ToSByte (value);
+ case T.ByteType : return Convert.ToByte (value);
+ case T.CharType : return Convert.ToChar (value);
+ case T.ShortType : return Convert.ToInt16 (value);
+ case T.UShortType: return Convert.ToUInt16(value);
+ case T.IntType : return Convert.ToInt32 (value);
+ case T.UIntType : return Convert.ToUInt32(value);
+ case T.LongType : return Convert.ToInt64 (value);
+ case T.ULongType : return Convert.ToUInt64(value);
+ case T.FloatType : return Convert.ToSingle(value);
+ case T.DoubleType: return Convert.ToDouble(value);
+ default:
+ throw new NotSupportedException(
+ string.Format("Unsupported data type {0}.", targetTypeEnum));
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/ArithmeticExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/ArithmeticExpression.cs b/src/main/csharp/Selector/ArithmeticExpression.cs
index a0524ee..0da9129 100644
--- a/src/main/csharp/Selector/ArithmeticExpression.cs
+++ b/src/main/csharp/Selector/ArithmeticExpression.cs
@@ -1,57 +1,56 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// An expression which performs an operation on two expression values.
- /// </summary>
- public abstract class ArithmeticExpression : BinaryExpression
- {
- public ArithmeticExpression(IExpression left, IExpression right)
- : base(left, right)
- {
- }
-
- public static IExpression CreatePlus(IExpression left, IExpression right)
- {
- return new PlusExpression(left, right);
- }
-
- public static IExpression CreateMinus(IExpression left, IExpression right)
- {
- return new MinusExpression(left, right);
- }
-
- public static IExpression CreateMultiply(IExpression left, IExpression right)
- {
- return new MultiplyExpression(left, right);
- }
-
- public static IExpression CreateDivide(IExpression left, IExpression right)
- {
- return new DivideExpression(left, right);
- }
-
- public static IExpression CreateMod(IExpression left, IExpression right)
- {
- return new ModExpression(left, right);
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// An expression which performs an operation on two expression values.
+ /// </summary>
+ public abstract class ArithmeticExpression : BinaryExpression
+ {
+ public ArithmeticExpression(IExpression left, IExpression right)
+ : base(left, right)
+ {
+ }
+
+ public static IExpression CreatePlus(IExpression left, IExpression right)
+ {
+ return new PlusExpression(left, right);
+ }
+
+ public static IExpression CreateMinus(IExpression left, IExpression right)
+ {
+ return new MinusExpression(left, right);
+ }
+
+ public static IExpression CreateMultiply(IExpression left, IExpression right)
+ {
+ return new MultiplyExpression(left, right);
+ }
+
+ public static IExpression CreateDivide(IExpression left, IExpression right)
+ {
+ return new DivideExpression(left, right);
+ }
+
+ public static IExpression CreateMod(IExpression left, IExpression right)
+ {
+ return new ModExpression(left, right);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/BinaryExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/BinaryExpression.cs b/src/main/csharp/Selector/BinaryExpression.cs
index 9206f8c..0cb506d 100644
--- a/src/main/csharp/Selector/BinaryExpression.cs
+++ b/src/main/csharp/Selector/BinaryExpression.cs
@@ -1,59 +1,58 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// An expression which performs an operation on two expression values.
- /// </summary>
- public abstract class BinaryExpression : IExpression
- {
- protected IExpression leftExpression;
- public IExpression Left
- {
- get { return leftExpression; }
- set { leftExpression = value; }
- }
-
- protected IExpression rightExpression;
- public IExpression Right
- {
- get { return rightExpression; }
- set { rightExpression = value; }
- }
-
- protected abstract string ExpressionSymbol
- {
- get;
- }
-
- public BinaryExpression(IExpression left, IExpression right)
- {
- leftExpression = left;
- rightExpression = right;
- }
-
- public abstract object Evaluate(MessageEvaluationContext message);
-
- public override string ToString()
- {
- return "(" + leftExpression.ToString() + " " + ExpressionSymbol + " " + rightExpression.ToString() + ")";
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// An expression which performs an operation on two expression values.
+ /// </summary>
+ public abstract class BinaryExpression : IExpression
+ {
+ protected IExpression leftExpression;
+ public IExpression Left
+ {
+ get { return leftExpression; }
+ set { leftExpression = value; }
+ }
+
+ protected IExpression rightExpression;
+ public IExpression Right
+ {
+ get { return rightExpression; }
+ set { rightExpression = value; }
+ }
+
+ protected abstract string ExpressionSymbol
+ {
+ get;
+ }
+
+ public BinaryExpression(IExpression left, IExpression right)
+ {
+ leftExpression = left;
+ rightExpression = right;
+ }
+
+ public abstract object Evaluate(MessageEvaluationContext message);
+
+ public override string ToString()
+ {
+ return "(" + leftExpression.ToString() + " " + ExpressionSymbol + " " + rightExpression.ToString() + ")";
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/BooleanCastExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/BooleanCastExpression.cs b/src/main/csharp/Selector/BooleanCastExpression.cs
index 26a6e9e..ea5bf05 100644
--- a/src/main/csharp/Selector/BooleanCastExpression.cs
+++ b/src/main/csharp/Selector/BooleanCastExpression.cs
@@ -1,45 +1,44 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// An expression which casts an expression value to a boolean.
- /// </summary>
- public class BooleanCastExpression : BooleanUnaryExpression
- {
- protected override string ExpressionSymbol
- {
- get { return ""; }
- }
-
- public BooleanCastExpression(IExpression left)
- : base(left)
- {
- }
-
- 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;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// An expression which casts an expression value to a boolean.
+ /// </summary>
+ public class BooleanCastExpression : BooleanUnaryExpression
+ {
+ protected override string ExpressionSymbol
+ {
+ get { return ""; }
+ }
+
+ public BooleanCastExpression(IExpression left)
+ : base(left)
+ {
+ }
+
+ 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;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/BooleanConstantExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/BooleanConstantExpression.cs b/src/main/csharp/Selector/BooleanConstantExpression.cs
index eb6447a..1859436 100644
--- a/src/main/csharp/Selector/BooleanConstantExpression.cs
+++ b/src/main/csharp/Selector/BooleanConstantExpression.cs
@@ -1,38 +1,37 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// Represents a boolean constant expression.
- /// </summary>
- public class BooleanConstantExpression : ConstantExpression, IBooleanExpression
- {
- public BooleanConstantExpression(object value)
- : base(value)
- {
- }
-
- public bool Matches(MessageEvaluationContext message)
- {
- object value = Evaluate(message);
- return value != null && (bool)value;
- }
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// Represents a boolean constant expression.
+ /// </summary>
+ public class BooleanConstantExpression : ConstantExpression, IBooleanExpression
+ {
+ public BooleanConstantExpression(object value)
+ : base(value)
+ {
+ }
+
+ public bool Matches(MessageEvaluationContext message)
+ {
+ object value = Evaluate(message);
+ return value != null && (bool)value;
+ }
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/BooleanUnaryExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/BooleanUnaryExpression.cs b/src/main/csharp/Selector/BooleanUnaryExpression.cs
index 3873050..00489d5 100644
--- a/src/main/csharp/Selector/BooleanUnaryExpression.cs
+++ b/src/main/csharp/Selector/BooleanUnaryExpression.cs
@@ -1,39 +1,38 @@
-using System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// An expression which performs an operation on one expression value
- /// and returns a boolean value.
- /// </summary>
- public abstract class BooleanUnaryExpression : UnaryExpression, IBooleanExpression
- {
- public BooleanUnaryExpression(IExpression left)
- : base(left)
- {
- }
-
- public bool Matches(MessageEvaluationContext message)
- {
- object value = Evaluate(message);
- return value != null && (bool)value;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// An expression which performs an operation on one expression value
+ /// and returns a boolean value.
+ /// </summary>
+ public abstract class BooleanUnaryExpression : UnaryExpression, IBooleanExpression
+ {
+ public BooleanUnaryExpression(IExpression left)
+ : base(left)
+ {
+ }
+
+ public bool Matches(MessageEvaluationContext message)
+ {
+ object value = Evaluate(message);
+ return value != null && (bool)value;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/ComparisonExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/ComparisonExpression.cs b/src/main/csharp/Selector/ComparisonExpression.cs
index 4024271..ca9a9fe 100644
--- a/src/main/csharp/Selector/ComparisonExpression.cs
+++ b/src/main/csharp/Selector/ComparisonExpression.cs
@@ -1,162 +1,161 @@
-\ufeffusing System;
-using System.Collections;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// A filter performing a comparison of two or more expressions or objects.
- /// </summary>
- public abstract class ComparisonExpression : BinaryExpression, IBooleanExpression
- {
- public ComparisonExpression(IExpression left, IExpression right)
- : base(left, right)
- {
- }
-
- public override object Evaluate(MessageEvaluationContext message)
- {
- object lvalue = Left.Evaluate(message);
- object rvalue = Right.Evaluate(message);
-
- int? compared = null;
-
- if(lvalue == null || rvalue == null)
- {
- if(lvalue == null && rvalue == null)
- {
- compared = 0;
- }
- }
- else
- {
- if(lvalue == rvalue)
- {
- compared = 0;
- }
- else if(lvalue is string && rvalue is string)
- {
- compared = ((string)lvalue).CompareTo(rvalue);
- }
- else
- {
- AlignedNumericValues values = new AlignedNumericValues(lvalue, rvalue);
-
- switch(values.TypeEnum)
- {
- case AlignedNumericValues.T.SByteType : compared = ((sbyte )values.Left).CompareTo((sbyte )values.Right); break;
- case AlignedNumericValues.T.ByteType : compared = ((byte )values.Left).CompareTo((byte )values.Right); break;
- case AlignedNumericValues.T.CharType : compared = ((char )values.Left).CompareTo((char )values.Right); break;
- case AlignedNumericValues.T.ShortType : compared = ((short )values.Left).CompareTo((short )values.Right); break;
- case AlignedNumericValues.T.UShortType: compared = ((ushort)values.Left).CompareTo((ushort)values.Right); break;
- case AlignedNumericValues.T.IntType : compared = ((int )values.Left).CompareTo((int )values.Right); break;
- case AlignedNumericValues.T.UIntType : compared = ((uint )values.Left).CompareTo((uint )values.Right); break;
- case AlignedNumericValues.T.LongType : compared = ((long )values.Left).CompareTo((long )values.Right); break;
- case AlignedNumericValues.T.ULongType : compared = ((ulong )values.Left).CompareTo((ulong )values.Right); break;
- case AlignedNumericValues.T.FloatType : compared = ((float )values.Left).CompareTo((float )values.Right); break;
- case AlignedNumericValues.T.DoubleType: compared = ((double)values.Left).CompareTo((double)values.Right); break;
- }
- }
- }
-
- return AsBoolean(compared);
- }
-
- public abstract bool AsBoolean(int? compared);
-
- public bool Matches(MessageEvaluationContext message)
- {
- object value = Evaluate(message);
- return value != null && (bool)value;
- }
-
- // Equality expressions
- public static IBooleanExpression CreateEqual(IExpression left, IExpression right)
- {
- return new EqualExpression(left, right, true);
- }
-
- public static IBooleanExpression CreateNotEqual(IExpression left, IExpression right)
- {
- return new EqualExpression(left, right, false);
- }
-
- public static IBooleanExpression CreateIsNull(IExpression left)
- {
- return new IsNullExpression(left, true);
- }
-
- public static IBooleanExpression CreateIsNotNull(IExpression left)
- {
- return new IsNullExpression(left, false);
- }
-
- // Binary comparison expressions
- public static IBooleanExpression CreateGreaterThan(IExpression left, IExpression right)
- {
- return new GreaterExpression(left, right);
- }
-
- public static IBooleanExpression CreateGreaterThanOrEqual(IExpression left, IExpression right)
- {
- return new GreaterOrEqualExpression(left, right);
- }
-
- public static IBooleanExpression CreateLesserThan(IExpression left, IExpression right)
- {
- return new LesserExpression(left, right);
- }
-
- public static IBooleanExpression CreateLesserThanOrEqual(IExpression left, IExpression right)
- {
- return new LesserOrEqualExpression(left, right);
- }
-
- // Other comparison expressions
- public static IBooleanExpression CreateLike(IExpression left, string right, string escape)
- {
- return new LikeExpression(left, right, escape, true);
- }
-
- public static IBooleanExpression CreateNotLike(IExpression left, string right, string escape)
- {
- return new LikeExpression(left, right, escape, false);
- }
-
- public static IBooleanExpression CreateBetween(IExpression value, IExpression left, IExpression right)
- {
- return LogicExpression.CreateAND(CreateGreaterThanOrEqual(value, left), CreateLesserThanOrEqual(value, right));
- }
-
- public static IBooleanExpression CreateNotBetween(IExpression value, IExpression left, IExpression right)
- {
- return LogicExpression.CreateOR(CreateLesserThan(value, left), CreateGreaterThan(value, right));
- }
-
- public static IBooleanExpression CreateIn(IExpression left, ArrayList elements)
- {
- return new InExpression(left, elements, true);
- }
-
- public static IBooleanExpression CreateNotIn(IExpression left, ArrayList elements)
- {
- return new InExpression(left, elements, false);
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Collections;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// A filter performing a comparison of two or more expressions or objects.
+ /// </summary>
+ public abstract class ComparisonExpression : BinaryExpression, IBooleanExpression
+ {
+ public ComparisonExpression(IExpression left, IExpression right)
+ : base(left, right)
+ {
+ }
+
+ public override object Evaluate(MessageEvaluationContext message)
+ {
+ object lvalue = Left.Evaluate(message);
+ object rvalue = Right.Evaluate(message);
+
+ int? compared = null;
+
+ if(lvalue == null || rvalue == null)
+ {
+ if(lvalue == null && rvalue == null)
+ {
+ compared = 0;
+ }
+ }
+ else
+ {
+ if(lvalue == rvalue)
+ {
+ compared = 0;
+ }
+ else if(lvalue is string && rvalue is string)
+ {
+ compared = ((string)lvalue).CompareTo(rvalue);
+ }
+ else
+ {
+ AlignedNumericValues values = new AlignedNumericValues(lvalue, rvalue);
+
+ switch(values.TypeEnum)
+ {
+ case AlignedNumericValues.T.SByteType : compared = ((sbyte )values.Left).CompareTo((sbyte )values.Right); break;
+ case AlignedNumericValues.T.ByteType : compared = ((byte )values.Left).CompareTo((byte )values.Right); break;
+ case AlignedNumericValues.T.CharType : compared = ((char )values.Left).CompareTo((char )values.Right); break;
+ case AlignedNumericValues.T.ShortType : compared = ((short )values.Left).CompareTo((short )values.Right); break;
+ case AlignedNumericValues.T.UShortType: compared = ((ushort)values.Left).CompareTo((ushort)values.Right); break;
+ case AlignedNumericValues.T.IntType : compared = ((int )values.Left).CompareTo((int )values.Right); break;
+ case AlignedNumericValues.T.UIntType : compared = ((uint )values.Left).CompareTo((uint )values.Right); break;
+ case AlignedNumericValues.T.LongType : compared = ((long )values.Left).CompareTo((long )values.Right); break;
+ case AlignedNumericValues.T.ULongType : compared = ((ulong )values.Left).CompareTo((ulong )values.Right); break;
+ case AlignedNumericValues.T.FloatType : compared = ((float )values.Left).CompareTo((float )values.Right); break;
+ case AlignedNumericValues.T.DoubleType: compared = ((double)values.Left).CompareTo((double)values.Right); break;
+ }
+ }
+ }
+
+ return AsBoolean(compared);
+ }
+
+ public abstract bool AsBoolean(int? compared);
+
+ public bool Matches(MessageEvaluationContext message)
+ {
+ object value = Evaluate(message);
+ return value != null && (bool)value;
+ }
+
+ // Equality expressions
+ public static IBooleanExpression CreateEqual(IExpression left, IExpression right)
+ {
+ return new EqualExpression(left, right, true);
+ }
+
+ public static IBooleanExpression CreateNotEqual(IExpression left, IExpression right)
+ {
+ return new EqualExpression(left, right, false);
+ }
+
+ public static IBooleanExpression CreateIsNull(IExpression left)
+ {
+ return new IsNullExpression(left, true);
+ }
+
+ public static IBooleanExpression CreateIsNotNull(IExpression left)
+ {
+ return new IsNullExpression(left, false);
+ }
+
+ // Binary comparison expressions
+ public static IBooleanExpression CreateGreaterThan(IExpression left, IExpression right)
+ {
+ return new GreaterExpression(left, right);
+ }
+
+ public static IBooleanExpression CreateGreaterThanOrEqual(IExpression left, IExpression right)
+ {
+ return new GreaterOrEqualExpression(left, right);
+ }
+
+ public static IBooleanExpression CreateLesserThan(IExpression left, IExpression right)
+ {
+ return new LesserExpression(left, right);
+ }
+
+ public static IBooleanExpression CreateLesserThanOrEqual(IExpression left, IExpression right)
+ {
+ return new LesserOrEqualExpression(left, right);
+ }
+
+ // Other comparison expressions
+ public static IBooleanExpression CreateLike(IExpression left, string right, string escape)
+ {
+ return new LikeExpression(left, right, escape, true);
+ }
+
+ public static IBooleanExpression CreateNotLike(IExpression left, string right, string escape)
+ {
+ return new LikeExpression(left, right, escape, false);
+ }
+
+ public static IBooleanExpression CreateBetween(IExpression value, IExpression left, IExpression right)
+ {
+ return LogicExpression.CreateAND(CreateGreaterThanOrEqual(value, left), CreateLesserThanOrEqual(value, right));
+ }
+
+ public static IBooleanExpression CreateNotBetween(IExpression value, IExpression left, IExpression right)
+ {
+ return LogicExpression.CreateOR(CreateLesserThan(value, left), CreateGreaterThan(value, right));
+ }
+
+ public static IBooleanExpression CreateIn(IExpression left, ArrayList elements)
+ {
+ return new InExpression(left, elements, true);
+ }
+
+ public static IBooleanExpression CreateNotIn(IExpression left, ArrayList elements)
+ {
+ return new InExpression(left, elements, false);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/ConstantExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/ConstantExpression.cs b/src/main/csharp/Selector/ConstantExpression.cs
index 90dfd69..b71683d 100644
--- a/src/main/csharp/Selector/ConstantExpression.cs
+++ b/src/main/csharp/Selector/ConstantExpression.cs
@@ -1,157 +1,156 @@
-\ufeffusing System;
-using System.Text;
-using System.Globalization;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// Represents a constant expression.
- /// </summary>
- public class ConstantExpression : IExpression
- {
- private object value;
- public object Value
- {
- get { return value; }
- }
-
- public ConstantExpression(object value)
- {
- this.value = value;
- }
-
- public static ConstantExpression CreateFromDecimal(string text)
- {
- // Long integer specified ?
- object value;
- if(text.EndsWith("l") || text.EndsWith("L"))
- {
- text = text.Substring(0, text.Length - 1);
- value = Int64.Parse(text, CultureInfo.InvariantCulture);
- }
- else
- {
- long lvalue = Int64.Parse(text, CultureInfo.InvariantCulture);
- if(lvalue >= Int32.MinValue && lvalue <= Int32.MaxValue)
- {
- value = (int)lvalue;
- }
- else
- {
- value = lvalue;
- }
- }
- return new ConstantExpression(value);
- }
-
- public static ConstantExpression CreateFromHex(string text)
- {
- long lvalue = Convert.ToInt64(text.Substring(2), 16);
-
- object value;
- if(lvalue >= Int32.MinValue && lvalue <= Int32.MaxValue)
- {
- value = (int)lvalue;
- }
- else
- {
- value = lvalue;
- }
- return new ConstantExpression(value);
- }
-
-
- public static ConstantExpression CreateFromOctal(string text)
- {
- long lvalue = Convert.ToInt64(text, 8);
-
- object value;
- if(lvalue >= Int32.MinValue && lvalue <= Int32.MaxValue)
- {
- value = (int)lvalue;
- }
- else
- {
- value = lvalue;
- }
- return new ConstantExpression(value);
- }
-
- public static ConstantExpression CreateFloat(string text)
- {
- double value = Double.Parse(text, CultureInfo.InvariantCulture);
- return new ConstantExpression(value);
- }
-
- public object Evaluate(MessageEvaluationContext message)
- {
- return value;
- }
-
- public override string ToString()
- {
- if(value == null)
- {
- return "NULL";
- }
- if(value is bool)
- {
- return (bool)value ? "TRUE" : "FALSE";
- }
- if(value is string)
- {
- return EncodeString((string)value);
- }
- return value.ToString();
- }
-
- public override int GetHashCode()
- {
- return (value == null ? 0 : value.GetHashCode());
- }
-
- /// <summary>
- /// Encodes the value of string so that it looks like it would look like
- /// when it was provided in a selector.
- /// </summary>
- /// <param name="s">String to be encoded.</param>
- /// <return>Encoded string.</return>
- public static string EncodeString(string s)
- {
- StringBuilder b = new StringBuilder();
- b.Append('\'');
- for(int c = 0; c < s.Length; c++)
- {
- char ch = s[c];
- if(ch == '\'')
- {
- b.Append(ch);
- }
- b.Append(ch);
- }
- b.Append('\'');
- return b.ToString();
- }
-
- public static readonly BooleanConstantExpression NULL = new BooleanConstantExpression(null);
- public static readonly BooleanConstantExpression TRUE = new BooleanConstantExpression(true);
- public static readonly BooleanConstantExpression FALSE = new BooleanConstantExpression(false);
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.Text;
+using System.Globalization;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// Represents a constant expression.
+ /// </summary>
+ public class ConstantExpression : IExpression
+ {
+ private object value;
+ public object Value
+ {
+ get { return value; }
+ }
+
+ public ConstantExpression(object value)
+ {
+ this.value = value;
+ }
+
+ public static ConstantExpression CreateFromDecimal(string text)
+ {
+ // Long integer specified ?
+ object value;
+ if(text.EndsWith("l") || text.EndsWith("L"))
+ {
+ text = text.Substring(0, text.Length - 1);
+ value = Int64.Parse(text, CultureInfo.InvariantCulture);
+ }
+ else
+ {
+ long lvalue = Int64.Parse(text, CultureInfo.InvariantCulture);
+ if(lvalue >= Int32.MinValue && lvalue <= Int32.MaxValue)
+ {
+ value = (int)lvalue;
+ }
+ else
+ {
+ value = lvalue;
+ }
+ }
+ return new ConstantExpression(value);
+ }
+
+ public static ConstantExpression CreateFromHex(string text)
+ {
+ long lvalue = Convert.ToInt64(text.Substring(2), 16);
+
+ object value;
+ if(lvalue >= Int32.MinValue && lvalue <= Int32.MaxValue)
+ {
+ value = (int)lvalue;
+ }
+ else
+ {
+ value = lvalue;
+ }
+ return new ConstantExpression(value);
+ }
+
+
+ public static ConstantExpression CreateFromOctal(string text)
+ {
+ long lvalue = Convert.ToInt64(text, 8);
+
+ object value;
+ if(lvalue >= Int32.MinValue && lvalue <= Int32.MaxValue)
+ {
+ value = (int)lvalue;
+ }
+ else
+ {
+ value = lvalue;
+ }
+ return new ConstantExpression(value);
+ }
+
+ public static ConstantExpression CreateFloat(string text)
+ {
+ double value = Double.Parse(text, CultureInfo.InvariantCulture);
+ return new ConstantExpression(value);
+ }
+
+ public object Evaluate(MessageEvaluationContext message)
+ {
+ return value;
+ }
+
+ public override string ToString()
+ {
+ if(value == null)
+ {
+ return "NULL";
+ }
+ if(value is bool)
+ {
+ return (bool)value ? "TRUE" : "FALSE";
+ }
+ if(value is string)
+ {
+ return EncodeString((string)value);
+ }
+ return value.ToString();
+ }
+
+ public override int GetHashCode()
+ {
+ return (value == null ? 0 : value.GetHashCode());
+ }
+
+ /// <summary>
+ /// Encodes the value of string so that it looks like it would look like
+ /// when it was provided in a selector.
+ /// </summary>
+ /// <param name="s">String to be encoded.</param>
+ /// <return>Encoded string.</return>
+ public static string EncodeString(string s)
+ {
+ StringBuilder b = new StringBuilder();
+ b.Append('\'');
+ for(int c = 0; c < s.Length; c++)
+ {
+ char ch = s[c];
+ if(ch == '\'')
+ {
+ b.Append(ch);
+ }
+ b.Append(ch);
+ }
+ b.Append('\'');
+ return b.ToString();
+ }
+
+ public static readonly BooleanConstantExpression NULL = new BooleanConstantExpression(null);
+ public static readonly BooleanConstantExpression TRUE = new BooleanConstantExpression(true);
+ public static readonly BooleanConstantExpression FALSE = new BooleanConstantExpression(false);
+ }
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/DivideExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/DivideExpression.cs b/src/main/csharp/Selector/DivideExpression.cs
index e280ec8..63f13aa 100644
--- a/src/main/csharp/Selector/DivideExpression.cs
+++ b/src/main/csharp/Selector/DivideExpression.cs
@@ -1,67 +1,66 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// A filter performing a division of two expressions.
- /// </summary>
- public class DivideExpression : ArithmeticExpression
- {
- protected override string ExpressionSymbol
- {
- get { return "/"; }
- }
-
- public DivideExpression(IExpression left, IExpression right)
- : base(left, right)
- {
- }
-
- public override object Evaluate(MessageEvaluationContext message)
- {
- object lvalue = Left.Evaluate(message);
- if(lvalue == null) return null;
-
- object rvalue = Right.Evaluate(message);
- 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;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// A filter performing a division of two expressions.
+ /// </summary>
+ public class DivideExpression : ArithmeticExpression
+ {
+ protected override string ExpressionSymbol
+ {
+ get { return "/"; }
+ }
+
+ public DivideExpression(IExpression left, IExpression right)
+ : base(left, right)
+ {
+ }
+
+ public override object Evaluate(MessageEvaluationContext message)
+ {
+ object lvalue = Left.Evaluate(message);
+ if(lvalue == null) return null;
+
+ object rvalue = Right.Evaluate(message);
+ 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;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/EqualExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/EqualExpression.cs b/src/main/csharp/Selector/EqualExpression.cs
index 0e9a792..af48080 100644
--- a/src/main/csharp/Selector/EqualExpression.cs
+++ b/src/main/csharp/Selector/EqualExpression.cs
@@ -1,47 +1,46 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// A filter performing an equality or inequality comparison
- /// of two expressions.
- /// </summary>
- public class EqualExpression : ComparisonExpression
- {
- private bool notNot;
-
- protected override string ExpressionSymbol
- {
- get { return notNot ? "=" : "<>"; }
- }
-
- public EqualExpression(IExpression left, IExpression right, bool notNot)
- : base(left, right)
- {
- this.notNot = notNot;
- }
-
- public override bool AsBoolean(int? compared)
- {
- bool answer = (compared.HasValue ? compared.Value == 0 : false);
- return notNot ? answer : !answer;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// A filter performing an equality or inequality comparison
+ /// of two expressions.
+ /// </summary>
+ public class EqualExpression : ComparisonExpression
+ {
+ private bool notNot;
+
+ protected override string ExpressionSymbol
+ {
+ get { return notNot ? "=" : "<>"; }
+ }
+
+ public EqualExpression(IExpression left, IExpression right, bool notNot)
+ : base(left, right)
+ {
+ this.notNot = notNot;
+ }
+
+ public override bool AsBoolean(int? compared)
+ {
+ bool answer = (compared.HasValue ? compared.Value == 0 : false);
+ return notNot ? answer : !answer;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/GreaterExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/GreaterExpression.cs b/src/main/csharp/Selector/GreaterExpression.cs
index eb264e5..012f3fb 100644
--- a/src/main/csharp/Selector/GreaterExpression.cs
+++ b/src/main/csharp/Selector/GreaterExpression.cs
@@ -1,42 +1,41 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// A filter performing a greater than comparison of two expressions.
- /// </summary>
- public class GreaterExpression : ComparisonExpression
- {
- protected override string ExpressionSymbol
- {
- get { return ">"; }
- }
-
- public GreaterExpression(IExpression left, IExpression right)
- : base(left, right)
- {
- }
-
- public override bool AsBoolean(int? compared)
- {
- return compared.HasValue ? compared.Value > 0 : false;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// A filter performing a greater than comparison of two expressions.
+ /// </summary>
+ public class GreaterExpression : ComparisonExpression
+ {
+ protected override string ExpressionSymbol
+ {
+ get { return ">"; }
+ }
+
+ public GreaterExpression(IExpression left, IExpression right)
+ : base(left, right)
+ {
+ }
+
+ public override bool AsBoolean(int? compared)
+ {
+ return compared.HasValue ? compared.Value > 0 : false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/GreaterOrEqualExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/GreaterOrEqualExpression.cs b/src/main/csharp/Selector/GreaterOrEqualExpression.cs
index 7a456f8..df8cc6f 100644
--- a/src/main/csharp/Selector/GreaterOrEqualExpression.cs
+++ b/src/main/csharp/Selector/GreaterOrEqualExpression.cs
@@ -1,43 +1,42 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// A filter performing a greater than or equal comparison
- /// of two expressions.
- /// </summary>
- public class GreaterOrEqualExpression : ComparisonExpression
- {
- protected override string ExpressionSymbol
- {
- get { return ">="; }
- }
-
- public GreaterOrEqualExpression(IExpression left, IExpression right)
- : base(left, right)
- {
- }
-
- public override bool AsBoolean(int? compared)
- {
- return compared.HasValue ? compared.Value >= 0 : false;
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// A filter performing a greater than or equal comparison
+ /// of two expressions.
+ /// </summary>
+ public class GreaterOrEqualExpression : ComparisonExpression
+ {
+ protected override string ExpressionSymbol
+ {
+ get { return ">="; }
+ }
+
+ public GreaterOrEqualExpression(IExpression left, IExpression right)
+ : base(left, right)
+ {
+ }
+
+ public override bool AsBoolean(int? compared)
+ {
+ return compared.HasValue ? compared.Value >= 0 : false;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/IBooleanExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/IBooleanExpression.cs b/src/main/csharp/Selector/IBooleanExpression.cs
index af6c0f5..bf5a833 100644
--- a/src/main/csharp/Selector/IBooleanExpression.cs
+++ b/src/main/csharp/Selector/IBooleanExpression.cs
@@ -1,35 +1,34 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// An IBooleanExpression is an expression that always
- /// produces a boolean result.
- /// </summary>
- public interface IBooleanExpression : IExpression
- {
- /// <summary>
- /// Checks if expression evaluates to <c>true</c>.
- /// </summary>
- /// <param name="message">Evaluation context.</param>
- /// <return><c>true</c> if the expression evaluates to <c>true</c>.</return>
- bool Matches(MessageEvaluationContext message);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// An IBooleanExpression is an expression that always
+ /// produces a boolean result.
+ /// </summary>
+ public interface IBooleanExpression : IExpression
+ {
+ /// <summary>
+ /// Checks if expression evaluates to <c>true</c>.
+ /// </summary>
+ /// <param name="message">Evaluation context.</param>
+ /// <return><c>true</c> if the expression evaluates to <c>true</c>.</return>
+ bool Matches(MessageEvaluationContext message);
+ }
+}
http://git-wip-us.apache.org/repos/asf/activemq-nms-msmq/blob/7274a80a/src/main/csharp/Selector/IExpression.cs
----------------------------------------------------------------------
diff --git a/src/main/csharp/Selector/IExpression.cs b/src/main/csharp/Selector/IExpression.cs
index 30fb893..833c6b5 100644
--- a/src/main/csharp/Selector/IExpression.cs
+++ b/src/main/csharp/Selector/IExpression.cs
@@ -1,35 +1,34 @@
-\ufeffusing System;
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-namespace Apache.NMS.Selector
-{
- /// <summary>
- /// Represents an expression
- /// </summary>
- public interface IExpression
- {
- /// <summary>
- /// Evaluates the expression.
- /// </summary>
- /// <param name="message">Evaluation context.</param>
- /// <return>The result of the evaluation.</return>
- object Evaluate(MessageEvaluationContext message);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+
+namespace Apache.NMS.Selector
+{
+ /// <summary>
+ /// Represents an expression
+ /// </summary>
+ public interface IExpression
+ {
+ /// <summary>
+ /// Evaluates the expression.
+ /// </summary>
+ /// <param name="message">Evaluation context.</param>
+ /// <return>The result of the evaluation.</return>
+ object Evaluate(MessageEvaluationContext message);
+ }
+}
\ No newline at end of file