public class Cube : FarPoint.CalcEngine.FunctionInfo
{
public override string Name
{
get
{
return "Cube";
}
}
public override int MaxArgs
{
get
{
return 1;
}
}
public override int MinArgs
{
get
{
return 1;
}
}
public override bool AcceptsReference(int i)
{
if (i == 0)
{
return true;
}
else
{
return false;
}
}
public override object Evaluate(object[] args)
{
double total;
FarPoint.CalcEngine.CalcReference cellref;
object value;
if (args[0] is FarPoint.CalcEngine.CalcArray)
{
return FarPoint.CalcEngine.CalcError.Value;
}
if (args[0] is FarPoint.CalcEngine.CalcReference)
{
cellref = ((FarPoint.CalcEngine.CalcReference)(args[0]));
if (cellref.ColumnCount > 1 | cellref.RowCount > 1)
{
return FarPoint.CalcEngine.CalcError.Value;
}
value = cellref.GetValue(cellref.Row, cellref.Column);
try
{
total = Math.Pow(FarPoint.CalcEngine.CalcConvert.ToDouble(args[0]), 3);
}
catch
{
}
}
else
{
try
{
total = Math.Pow(FarPoint.CalcEngine.CalcConvert.ToDouble(args[0]), 3);
}
catch
{
}
}
return total;
}
}