|
using System.Text;
namespace MathMLToCSharp.Entities
{
/// <summary>
/// Number.
/// </summary>
public class Mn : WithTextContent
{
public Mn(string content) : base(content) {}
/// <summary>
/// Returns <c>true</c> if the content is an integer greater than 1 (i.e., 2, 3, etc.)
/// </summary>
public bool IsIntegerGreaterThan1
{
get
{
try
{
double d = double.Parse(content);
if (System.Math.Floor(d) == d)
if (d > 1.0)
return true;
return false;
}
catch
{
return false;
}
}
}
public int IntegerValue
{
get
{
return int.Parse(content);
}
}
public override void Visit(StringBuilder sb, BuildContext bc)
{
base.Visit(sb, bc);
if (bc.Options.NumberPostfix && !bc.Options.SubscriptMode)
sb.Append(Semantics.postfixForDataType(bc.Options.EqnDataType));
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I work primarily with the .NET technology stack, and specialize in accelerated code production via code generation (static or dynamic), aspect-oriented programming, MDA, domain-specific languages and anything else that gets products out the door faster. My languages of choice are C# and C++, though I'm open to suggestions.