You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jg...@apache.org on 2016/09/10 23:09:21 UTC
svn commit: r1760211 [3/12] - in
/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk: ./ src/main/csharp/
src/main/csharp/Readers/ src/main/csharp/Selector/ src/test/csharp/
src/test/csharp/Commands/
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Readers/NonFilteringMessageReader.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Readers/NonFilteringMessageReader.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Readers/NonFilteringMessageReader.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Readers/NonFilteringMessageReader.cs Sat Sep 10 23:09:20 2016
@@ -1,128 +1,128 @@
-using System;
-using System.Messaging;
-using Apache.NMS.MSMQ;
-/*
- * 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.MSMQ.Readers
-{
- /// <summary>
- /// MSMQ message reader, returning all messages, without filtering.
- /// </summary>
- public class NonFilteringMessageReader : AbstractMessageReader
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="messageQueue">The MSMQ message queue from which
- /// messages will be read.</param>
- /// <param name="messageConverter">A message converter for mapping
- /// MSMQ messages to NMS messages.</param>
- public NonFilteringMessageReader(MessageQueue messageQueue,
- IMessageConverter messageConverter)
- : base(messageQueue, messageConverter)
- {
- }
-
- /// <summary>
- /// Returns without removing (peeks) the first message in the queue
- /// referenced by this MessageQueue matching the selection criteria.
- /// The Peek method is synchronous, so it blocks the current thread
- /// until a message becomes available.
- /// </summary>
- /// <returns>Peeked message.</returns>
- public override IMessage Peek()
- {
- return Convert(messageQueue.Peek());
- }
-
- /// <summary>
- /// Returns without removing (peeks) the first message in the queue
- /// referenced by this MessageQueue matching the selection criteria.
- /// The Peek method is synchronous, so it blocks the current thread
- /// until a message becomes available or the specified time-out occurs.
- /// </summary>
- /// <param name="timeSpan">Reception time-out.</param>
- /// <returns>Peeked message.</returns>
- public override IMessage Peek(TimeSpan timeSpan)
- {
- return Convert(messageQueue.Peek(timeSpan));
- }
-
- /// <summary>
- /// Receives the first message available in the queue referenced by
- /// the MessageQueue matching the selection criteria.
- /// This call is synchronous, and blocks the current thread of execution
- /// until a message is available.
- /// </summary>
- /// <returns>Received message.</returns>
- public override IMessage Receive()
- {
- return Convert(messageQueue.Receive());
- }
-
- /// <summary>
- /// Receives the first message available in the queue referenced by the
- /// MessageQueue matching the selection criteria, and waits until either
- /// a message is available in the queue, or the time-out expires.
- /// </summary>
- /// <param name="timeSpan">Reception time-out.</param>
- /// <returns>Received message.</returns>
- public override IMessage Receive(TimeSpan timeSpan)
- {
- return Convert(messageQueue.Receive(timeSpan));
- }
-
- /// <summary>
- /// Receives the first message available in the transactional queue
- /// referenced by the MessageQueue matching the selection criteria.
- /// This call is synchronous, and blocks the current thread of execution
- /// until a message is available.
- /// </summary>
- /// <param name="transaction">Transaction.</param>
- /// <returns>Received message.</returns>
- public override IMessage Receive(MessageQueueTransaction transaction)
- {
- return Convert(messageQueue.Receive(transaction));
- }
-
- /// <summary>
- /// Receives the first message available in the transactional queue
- /// referenced by the MessageQueue matching the selection criteria,
- /// and waits until either a message is available in the queue, or the
- /// time-out expires.
- /// </summary>
- /// <param name="timeSpan">Reception time-out.</param>
- /// <param name="transaction">Transaction.</param>
- /// <returns>Received message.</returns>
- public override IMessage Receive(TimeSpan timeSpan,
- MessageQueueTransaction transaction)
- {
- return Convert(messageQueue.Receive(timeSpan, transaction));
- }
-
- /// <summary>
- /// Checks if an MSMQ message matches the selection criteria.
- /// </summary>
- /// <param name="message">MSMQ message.</param>
- /// <return>true if the message matches the selection criteria.</return>
- public override bool Matches(Message message)
- {
- return true;
- }
- }
-}
+using System;
+using System.Messaging;
+using Apache.NMS.MSMQ;
+/*
+ * 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.MSMQ.Readers
+{
+ /// <summary>
+ /// MSMQ message reader, returning all messages, without filtering.
+ /// </summary>
+ public class NonFilteringMessageReader : AbstractMessageReader
+ {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ /// <param name="messageQueue">The MSMQ message queue from which
+ /// messages will be read.</param>
+ /// <param name="messageConverter">A message converter for mapping
+ /// MSMQ messages to NMS messages.</param>
+ public NonFilteringMessageReader(MessageQueue messageQueue,
+ IMessageConverter messageConverter)
+ : base(messageQueue, messageConverter)
+ {
+ }
+
+ /// <summary>
+ /// Returns without removing (peeks) the first message in the queue
+ /// referenced by this MessageQueue matching the selection criteria.
+ /// The Peek method is synchronous, so it blocks the current thread
+ /// until a message becomes available.
+ /// </summary>
+ /// <returns>Peeked message.</returns>
+ public override IMessage Peek()
+ {
+ return Convert(messageQueue.Peek());
+ }
+
+ /// <summary>
+ /// Returns without removing (peeks) the first message in the queue
+ /// referenced by this MessageQueue matching the selection criteria.
+ /// The Peek method is synchronous, so it blocks the current thread
+ /// until a message becomes available or the specified time-out occurs.
+ /// </summary>
+ /// <param name="timeSpan">Reception time-out.</param>
+ /// <returns>Peeked message.</returns>
+ public override IMessage Peek(TimeSpan timeSpan)
+ {
+ return Convert(messageQueue.Peek(timeSpan));
+ }
+
+ /// <summary>
+ /// Receives the first message available in the queue referenced by
+ /// the MessageQueue matching the selection criteria.
+ /// This call is synchronous, and blocks the current thread of execution
+ /// until a message is available.
+ /// </summary>
+ /// <returns>Received message.</returns>
+ public override IMessage Receive()
+ {
+ return Convert(messageQueue.Receive());
+ }
+
+ /// <summary>
+ /// Receives the first message available in the queue referenced by the
+ /// MessageQueue matching the selection criteria, and waits until either
+ /// a message is available in the queue, or the time-out expires.
+ /// </summary>
+ /// <param name="timeSpan">Reception time-out.</param>
+ /// <returns>Received message.</returns>
+ public override IMessage Receive(TimeSpan timeSpan)
+ {
+ return Convert(messageQueue.Receive(timeSpan));
+ }
+
+ /// <summary>
+ /// Receives the first message available in the transactional queue
+ /// referenced by the MessageQueue matching the selection criteria.
+ /// This call is synchronous, and blocks the current thread of execution
+ /// until a message is available.
+ /// </summary>
+ /// <param name="transaction">Transaction.</param>
+ /// <returns>Received message.</returns>
+ public override IMessage Receive(MessageQueueTransaction transaction)
+ {
+ return Convert(messageQueue.Receive(transaction));
+ }
+
+ /// <summary>
+ /// Receives the first message available in the transactional queue
+ /// referenced by the MessageQueue matching the selection criteria,
+ /// and waits until either a message is available in the queue, or the
+ /// time-out expires.
+ /// </summary>
+ /// <param name="timeSpan">Reception time-out.</param>
+ /// <param name="transaction">Transaction.</param>
+ /// <returns>Received message.</returns>
+ public override IMessage Receive(TimeSpan timeSpan,
+ MessageQueueTransaction transaction)
+ {
+ return Convert(messageQueue.Receive(timeSpan, transaction));
+ }
+
+ /// <summary>
+ /// Checks if an MSMQ message matches the selection criteria.
+ /// </summary>
+ /// <param name="message">MSMQ message.</param>
+ /// <return>true if the message matches the selection criteria.</return>
+ public override bool Matches(Message message)
+ {
+ return true;
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ANDExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ANDExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ANDExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ANDExpression.cs Sat Sep 10 23:09:20 2016
@@ -1,47 +1,46 @@
-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>
- /// A filter performing a logical AND combination of two expressions.
- /// </summary>
- public class ANDExpression : LogicExpression
- {
- protected override string ExpressionSymbol
- {
- get { return "AND"; }
- }
-
- public ANDExpression(IBooleanExpression left, IBooleanExpression right)
- : base(left, right)
- {
- }
-
- public override object Evaluate(MessageEvaluationContext message)
- {
- object lvalue = Left.Evaluate(message);
- if(lvalue == null) return null;
- if(!(bool)lvalue) return false;
-
- object rvalue = Right.Evaluate(message);
- return rvalue == null ? null : rvalue;
- }
- }
-}
+/*
+ * 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 logical AND combination of two expressions.
+ /// </summary>
+ public class ANDExpression : LogicExpression
+ {
+ protected override string ExpressionSymbol
+ {
+ get { return "AND"; }
+ }
+
+ public ANDExpression(IBooleanExpression left, IBooleanExpression right)
+ : base(left, right)
+ {
+ }
+
+ public override object Evaluate(MessageEvaluationContext message)
+ {
+ object lvalue = Left.Evaluate(message);
+ if(lvalue == null) return null;
+ if(!(bool)lvalue) return false;
+
+ object rvalue = Right.Evaluate(message);
+ return rvalue == null ? null : rvalue;
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/AlignedNumericValues.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/AlignedNumericValues.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/AlignedNumericValues.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/AlignedNumericValues.cs Sat Sep 10 23:09:20 2016
@@ -1,175 +1,174 @@
-using 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−45 to ±3.4e38)
- DoubleType = 10 // 15-16 digits (±5.0e−324 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−45 to ±3.4e38)
+ DoubleType = 10 // 15-16 digits (±5.0e−324 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));
+ }
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ArithmeticExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ArithmeticExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ArithmeticExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ArithmeticExpression.cs Sat Sep 10 23:09:20 2016
@@ -1,57 +1,56 @@
-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 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);
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BinaryExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BinaryExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BinaryExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BinaryExpression.cs Sat Sep 10 23:09:20 2016
@@ -1,59 +1,58 @@
-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 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() + ")";
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanCastExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanCastExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanCastExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanCastExpression.cs Sat Sep 10 23:09:20 2016
@@ -1,45 +1,44 @@
-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 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;
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanConstantExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanConstantExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanConstantExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanConstantExpression.cs Sat Sep 10 23:09:20 2016
@@ -1,38 +1,37 @@
-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>
- /// 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
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanUnaryExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanUnaryExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanUnaryExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/BooleanUnaryExpression.cs Sat Sep 10 23:09:20 2016
@@ -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;
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ComparisonExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ComparisonExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ComparisonExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ComparisonExpression.cs Sat Sep 10 23:09:20 2016
@@ -1,162 +1,161 @@
-using 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);
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ConstantExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ConstantExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ConstantExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/ConstantExpression.cs Sat Sep 10 23:09:20 2016
@@ -1,157 +1,156 @@
-using 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
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/DivideExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/DivideExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/DivideExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/DivideExpression.cs Sat Sep 10 23:09:20 2016
@@ -1,67 +1,66 @@
-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>
- /// 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;
+ }
+ }
+}
Modified: activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/EqualExpression.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/EqualExpression.cs?rev=1760211&r1=1760210&r2=1760211&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/EqualExpression.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MSMQ/trunk/src/main/csharp/Selector/EqualExpression.cs Sat Sep 10 23:09:20 2016
@@ -1,47 +1,46 @@
-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>
- /// 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;
+ }
+ }
+}