org.gcube.data.analysis.tabulardata.model.datatype
Class Numeric

java.lang.Object
  extended by org.gcube.data.analysis.tabulardata.model.datatype.Numeric
All Implemented Interfaces:
Serializable, DataType

public class Numeric
extends Object
implements DataType

The type numeric can store numbers with up to 1000 digits of precision and perform calculations exactly. A Numeric is defined with a precision and a scale. The scale of a numeric is the count of decimal digits in the fractional part, to the right of the decimal point. The precision of a numeric is the total count of significant digits in the whole number, that is, the number of digits to both sides of the decimal point.

Author:
"Luigi Fortunati"
See Also:
Serialized Form

Constructor Summary
Numeric()
          Define a Numeric type with default precision and scale
Numeric(int precision)
          Creates a Numeric type with a given precision
Numeric(int precision, int scale)
          Creates a Numeric type with a given precision and scale.
 
Method Summary
 boolean equals(Object obj)
           
 DataTypeEnum getDataType()
           
 int getPrecision()
           
 int getScale()
           
 int hashCode()
           
 boolean hasPrecision()
           
 boolean hasScale()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Numeric

public Numeric()
Define a Numeric type with default precision and scale


Numeric

public Numeric(int precision)
Creates a Numeric type with a given precision

Parameters:
precision - total count of significant digits in the whole number

Numeric

public Numeric(int precision,
               int scale)
Creates a Numeric type with a given precision and scale.

Parameters:
precision - total count of significant digits in the whole number
scale - count of decimal digits in the fractional part
Throws:
IllegalArgumentException
Method Detail

getDataType

public DataTypeEnum getDataType()
Specified by:
getDataType in interface DataType

hasPrecision

public boolean hasPrecision()

getPrecision

public int getPrecision()

hasScale

public boolean hasScale()

getScale

public int getScale()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013. All Rights Reserved.