Package mondrian.olap.type
Class DecimalType
- java.lang.Object
-
- mondrian.olap.type.ScalarType
-
- mondrian.olap.type.NumericType
-
- mondrian.olap.type.DecimalType
-
- All Implemented Interfaces:
Type
public class DecimalType extends NumericType
Subclass ofNumericType
which guarantees fixed number of decimal places. In particular, a decimal with zero scale is an integer.- Since:
- May 3, 2005
- Author:
- jhyde
-
-
Constructor Summary
Constructors Constructor Description DecimalType(int precision, int scale)
Creates a decimal type with precision and scale.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
int
getPrecision()
Returns the maximum number of decimal digits which a value of this type can have.int
getScale()
Returns the number of digits to the right of the decimal point.-
Methods inherited from class mondrian.olap.type.NumericType
isInstance
-
Methods inherited from class mondrian.olap.type.ScalarType
computeCommonType, getArity, getDimension, getHierarchy, getLevel, hashCode, toString, usesDimension, usesHierarchy
-
-
-
-
Constructor Detail
-
DecimalType
public DecimalType(int precision, int scale)
Creates a decimal type with precision and scale.Examples:
- 123.45 has precision 5, scale 2.
- 12,345,000 has precision 5, scale -3.
The largest value is 10 ^ (precision - scale). Hence the largest
DECIMAL(5, -3)
value is 10 ^ 8.- Parameters:
precision
- Maximum number of decimal digits which a value of this type can have. Must be greater than zero. UseInteger.MAX_VALUE
if the precision is unbounded.scale
- Number of digits to the right of the decimal point.
-
-
Method Detail
-
getPrecision
public int getPrecision()
Returns the maximum number of decimal digits which a value of this type can have.- Returns:
- precision of this type
-
getScale
public int getScale()
Returns the number of digits to the right of the decimal point.- Returns:
- scale of this type
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classNumericType
-
-