namespace com.azkoss.excellite
{
using System;
///
///Base formula token class for inheritance
///
internal abstract class FormulaToken
{
// Methods
///
///Initializes a new instance of the class.
///
///The code.
///The size.
public FormulaToken(FormulaTokenCode code, int size) : this(code, size, FormulaTokenType.Empty)
{
}
public FormulaToken(FormulaTokenCode code, int size, FormulaTokenType type)
{
this.token = code;
this.size = size;
this.type = new FormulaTokenTypeEx(type);
}
///
///Convert formula token to bytes representation.
///
///bytes representation of the formula token
public virtual byte[] ConvertToBytes()
{
byte[] buffer1 = new byte[this.Size];
buffer1[0] = (byte) this.Token;
return buffer1;
}
///
///Make custom delay initialize.
///
///The data for initialization which is unique for each formula token.
public virtual void DelayInitialize(object[] data)
{
}
///
///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 virtual void Read(byte[] rpnBytes, int startIndex)
{
}
///
///Convert formula token to string representation.
///
///formula token string representation
public override string ToString()
{
return string.Empty;
}
// Properties
public byte Code
{
get
{
return (byte) this.Token;
}
}
///
///Gets the size of the formula token.
///
///The size of the formula token.
public virtual int Size
{
get
{
return this.size;
}
}
///
///Gets the formula token code.
///
///The formula token code.
protected FormulaTokenCode Token
{
get
{
return this.token;
}
}
public FormulaTokenTypeEx Type
{
get
{
return this.type;
}
}
// Fields
private int size;
private FormulaTokenCode token;
private FormulaTokenTypeEx type;
}
}