namespace com.azkoss.excellite { using System; /// ///Formula token for holding function. /// internal class FunctionFormulaToken : FormulaToken { // Methods /// ///Initializes a new instance of the class. /// ///The code. public FunctionFormulaToken(FormulaTokenCode code) : base(code, 3, FormulaTokenType.Function) { } /// ///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.function.Code); 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.function = FormulaFunctionsTable.Instance[data[0] as string]; } /// ///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) { ushort num1 = BitConverter.ToUInt16(rpnBytes, startIndex); this.function = FormulaFunctionsTable.Instance[num1]; } /// ///Convert formula token to string representation. /// ///formula token string representation public override string ToString() { return this.function.Name.ToUpper(); } // Properties public byte ArgumentsCount { get { return this.function.ArgumentsCount; } } public FormulaFunctionInfo Function { get { return this.function; } } // Fields private FormulaFunctionInfo function; } }