namespace com.azkoss.excellite
{
using System;
///
///Formula token for holding integer.
///
internal class NumFormulaToken : FormulaToken
{
// Methods
///
///Initializes a new instance of the class.
///
public NumFormulaToken() : base(FormulaTokenCode.Num, 9, FormulaTokenType.Operand)
{
}
///
///Convert formula token to array of byte representation.
///
///formula token' array of byte representation
public override byte[] ConvertToBytes()
{
byte[] buffer1 = base.ConvertToBytes();
byte[] buffer2 = BitConverter.GetBytes(this.value);
buffer2.CopyTo(buffer1, 1);
return buffer1;
}
///
///Make custom delay initialize.
///
///The data for initialization which is unique for each formula token.
public override void DelayInitialize(object[] data)
{
this.value = (double) data[0];
}
///
///Initialize formula token by reading input data from array of bytes
///
///input data, array of bytes
///start position for array of bytes to read from
public override void Read(byte[] rpnBytes, int startIndex)
{
this.value = BitConverter.ToDouble(rpnBytes, startIndex);
}
///
///Convert formula token to string representation.
///
///formula token string representation
public override string ToString()
{
return this.value.ToString();
}
// Properties
public double Value
{
get
{
return this.value;
}
}
// Fields
private double value;
}
}