namespace com.azkoss.excellite { using System; /// ///Formula token for holding integer. /// internal class IntFormulaToken : FormulaToken { // Methods /// ///Initializes a new instance of the class. /// public IntFormulaToken() : base(FormulaTokenCode.Int, 3, FormulaTokenType.Operand) { } /// ///Convert formula token to bytes representation. /// ///bytes representation of the formula token public override byte[] ConvertToBytes() { byte[] buffer1 = base.ConvertToBytes(); BitConverter.GetBytes(this.Value).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 = (ushort) 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.ToUInt16(rpnBytes, startIndex); } /// ///Convert formula token to string representation. /// ///formula token string representation public override string ToString() { return this.value.ToString(); } // Properties public ushort Value { get { return this.value; } } // Fields private ushort value; } }