Represents the value of an Apama decimal
field, using Decimal or Double objects.
This class allows for a wider range of values to be stored than the Decimal type allows. If the value is within range allowed by a Decimal, as stated in the remarks section there, using either constructor allows the value to be stored internally as a Decimal. If it is outside the range, the string constructor should be used. The value will then be internally represented as a Double, which allows infinities and NaNs too.
Field<DecimalFieldValue> decimalField = FieldTypes.Decimal.NewField("decimalField");
EventParser eventParser = new EventParser(new EventType("sample.MyEvent", decimalField));
Event e = eventParser.Parse(
"sample.MyEvent(1.00000001)");
System.Console.WriteLine(
"Decimal ToString is: "+decimalValue.ToString());
if (decimalValue.Value != null)
{
decimalValueString = decimalValue.Value.ToString();
}
else
{
double decimalValueAsFloat = decimalValue.FloatValue;
decimalValueString =
String.Format(
"%f", decimalValueAsFloat);
}
System.Console.WriteLine(
"Decimal original value was: " + decimalValue.StringValue +
"; current decimal value is: " + decimalValueString);
Apama.Event.Parser.DecimalFieldValue.DecimalFieldValue |
( |
String |
value | ) |
|
Create a new DecimalFieldValue
- Parameters
-
value | from a string representation. |
Using this constructor allows for a wider range of values to be stored than the .Net Decimal type allows. If the value is within range allowed by a Decimal (see remarks section there), the value is stored as a Decimal. If it is outside the range (either too big or too small), it will be stored as a Double. If it is outside the range of a Double then it will be stored as an Infinity (and isInfinity will return true, although the original string value will remain) or zero dependent on it's size. It can also be set to Not a Number through this constructor. If the value cannot be parsed, a FormatException is thrown. If the value passed is null, an ArgumentNullException is thrown.
double Apama.Event.Parser.DecimalFieldValue.FloatValue |
|
get |
The floating point representation of this value.
Under normal circumstances, this is intended to be as accurate a representation of the decimal value as possible. If the decimal representation from Value returned null (i.e. was outside the range storable), then this function should be used. It can also represent NaN and Infinities. One special case is where the value is extremely close to zero. If this property is 0, and the Value property is null, please use StringValue to see the original number.
Nullable<Decimal> Apama.Event.Parser.DecimalFieldValue.Value |
|
get |
The Decimal value. If the value returned is null, please use the FloatValue or or StringValue properties (see remarks).
When a null value is returned, the value is either outside the range allowable by the Decimal type. It could also be a NaN, or Positive/Negative Infinity value. Whilst typically the value might be too large in magnitude to be represented as a decimal, one special case is where the value is extremely close to zero. If this proeprty is null, and FloatValue is 0, please use StringValue to see the original number.