A literal Number constant value.
A Number in CER is an arbitrarily-long decimal value, specified using a period (".") as the decimal separator and without any thousands separator.
CER business calculations can often involve percentage values, e.g. "Deduct 10% of the person's income". To help with the codification of such rules, CER allows a Number to be specified as a percentage, by simply suffixing the number with %. For example, the numbers 12.345% and 0.12345 will behave identically in calculations (but the percentage version will display in percentage form).
<?xml version="1.0" encoding="UTF-8"?>
<RuleSet name="Example_Number"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"http://www.curamsoftware.com/CreoleRulesSchema.xsd">
<Class name="NumberExampleRuleClass">
<Attribute name="aPositiveInteger">
<type>
<javaclass name="Number"/>
</type>
<derivation>
<!-- A positive integer -->
<Number value="1"/>
</derivation>
</Attribute>
<Attribute name="aNegativeInteger">
<type>
<javaclass name="Number"/>
</type>
<derivation>
<!-- A negative integer -->
<Number value="-2"/>
</derivation>
</Attribute>
<Attribute name="aDecimalNumber">
<type>
<javaclass name="Number"/>
</type>
<derivation>
<!-- A decimal number.
Numbers are arbitrarily long/precise, use "." for
the decimal separator and have no thousands
separator.
-->
<Number value="-12345.6789"/>
</derivation>
</Attribute>
<Attribute name="aPercentage">
<type>
<javaclass name="Number"/>
</type>
<derivation>
<!-- A percentage
(12.345% is equivalent to the number 0.12345) -->
<Number value="12.345%"/>
</derivation>
</Attribute>
</Class>
</RuleSet>