Class NumberBuilder
java.lang.Object
com.singularsys.extensions.mathml.builder.NumberBuilder
- All Implemented Interfaces:
MathMLFragmentBuilder
Converts numeric-constants to CN nodes.
Can produce
- <cn type="integer">value</cn> if is an Integer, Long or Short
- <cn type="e-notation">mantissa<sep/>exponent</cn> if Double.toString(val) produces scientific notation.
- <cn type="complex-cartesian">real<sep/>imaginary</cn> if the value is complex
- <notanumber/> for Doubles representing NaN's
- <infinity/> for Doubles representing +Infinity
- <apply><minus><infinity/><apply/> for Doubles representing -Infinity
- <cn type="integer">value</cn> for all other types
- <cn>value</cn> for all other types
- ALLWAYS_DOUBLE <cn>2.0</cn>
- NO_DECIMALPOINT <cn>2</cn>
- TYPE_INTEGER <cn type="integer">2</cn>
- Author:
- Richard Morris
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow to format Double objects with integral values. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild(Node n, Document d, MathMLDocumentBuilder db) Builds a Element for a jep Node.buildAsComplex(Complex val, Document d, MathMLDocumentBuilder db) buildAsDouble(double val, Document d, MathMLDocumentBuilder db) buildAsInteger(long val, Document d, MathMLDocumentBuilder db) protected booleanTest if a number is an integer.voidsetDoubleBehaviour(NumberBuilder.DoubleBehaviour doubleBehaviour)
-
Constructor Details
-
NumberBuilder
public NumberBuilder()
-
-
Method Details
-
buildAsInteger
-
buildAsDouble
-
buildAsComplex
-
build
Description copied from interface:MathMLFragmentBuilderBuilds a Element for a jep Node.- Specified by:
buildin interfaceMathMLFragmentBuilder- Parameters:
n- The jep sub expression.d- The document to create the element in.db- Used create elements and attributes and child nodes.- Returns:
- element representing the node
- Throws:
JepException
-
isInteger
Test if a number is an integer.- Parameters:
val- the value to test, typically a Number- Returns:
- true if val is an Integer, Short or Long or if the Math.rint(val) == val, false otherwise
-
getDoubleBehaviour
-
setDoubleBehaviour
-