public class XBRLNumericValue extends java.lang.Object implements java.lang.Cloneable, XBRLNumber
Starting on 8/4/2009. In order to implement the functionality that this object can be created without a value and the value can be set later, this object now has a flag indicating whether the numeric value is set of is blank.
DECIMALS, INF, PRECISION| Constructor and Description |
|---|
XBRLNumericValue(XBRLFactNumeric fact)
Creation of an empty XBRLNumericValue (Blank)
This is useful for editing purposes.
|
XBRLNumericValue(XBRLFactNumeric fact,
java.lang.Number value,
int precisionOrDecimals,
java.lang.String strValue)
Creation from Java Number object.
|
XBRLNumericValue(XBRLFactNumeric fact,
net.sf.saxon.value.NumericValue value,
int precisionOrDecimals)
Creation from a Saxon NumericValue object.
|
| Modifier and Type | Method and Description |
|---|---|
XBRLNumericValue |
clone()
Clone.
|
boolean |
eq(XBRLNumber value2)
Eq.
|
boolean |
equals(java.lang.Object other) |
java.math.BigDecimal |
getBigDecimal()
returns the internal representation of this value as a BigDecimal.
|
java.lang.String |
getDecimals()
Convert precision value into decimals value if needed and returns the decimals value
It is returned as a string because "INF" is a valid value.
|
static int |
getExponent(java.lang.String strValue)
Gets the exponent.
|
XBRLFactNumeric |
getFact()
Access to the XBRLFactNumeric that is the container of this XBRLNumericValue.
|
java.lang.String |
getFriendlyName(int flags,
LabelsProvider lp)
Gets the friendly name.
|
int |
getInferredPrecision()
Gets the inferred precision for this numeric value.
|
java.lang.String |
getPrecision()
The value of the precision for this numeric value.
|
java.lang.String |
getStringValue()
Gets the string value.
|
java.lang.Number |
getValue()
Access to the surrounding number value this object is encapsulating.
|
static net.sf.saxon.value.NumericValue |
getValue(XBRLXSDTypeDefinition type,
java.lang.Object value)
Returns a NumericValue representation of the value according to the type definition in the parameter.
|
int |
hashCode()
Hash code.
|
static int |
inferredDecimals(int precision,
java.lang.String strValue)
Inferred decimals.
|
static int |
inferredDecimalsBug368(int precision,
java.lang.String rawStrValue)
Inferred decimals bug368.
|
static int |
inferredPrecision(java.lang.String decimalsStr,
java.lang.String strValue)
Inferred precision.
|
boolean |
isBlank()
true if this XBRLNumericValue has no value assigned .
|
XBRLNumericValue |
multiply(double weight)
Multiply.
|
boolean |
ne(XBRLNumber value2)
Ne.
|
static java.lang.String |
numericValueToString(java.lang.Number value)
Calculates a string representation of an object value.
|
XBRLNumericValue |
plus(XBRLNumber value2)
Plus.
|
XBRLNumericValue |
roundTo(int precisionOrDecimals)
Round to a specific value for the decimals attribute or number of characters in the
precision attribute.
|
void |
setDecimals(int decimals)
Sets the decimals.
|
void |
setFact(XBRLFactNumeric factNumeric)
Sets the fact.
|
void |
setPrecision(int precision)
Sets the precision.
|
void |
setValue(java.lang.Number value,
java.lang.String strValue)
Sets the value.
|
java.lang.String |
toString()
Returns a human readable representation of this number.
|
public XBRLNumericValue(XBRLFactNumeric fact)
fact - the parent fact, may be nullpublic XBRLNumericValue(XBRLFactNumeric fact, java.lang.Number value, int precisionOrDecimals, java.lang.String strValue)
fact - the XBRLFactNumeric instance for which this is the XBRLNumericValuevalue - Java Number or derived from Number object instanceprecisionOrDecimals - integer, depending on the bug368 the value goes to the precision or decimals propertystrValue - the str valuepublic XBRLNumericValue(XBRLFactNumeric fact, net.sf.saxon.value.NumericValue value, int precisionOrDecimals)
fact - the XBRLFactNumeric instance for which this is the XBRLNumericValuevalue - NumericValue form saxonica libraryprecisionOrDecimals - integerpublic XBRLFactNumeric getFact()
XBRLNumberIt may be null
getFact in interface XBRLNumberpublic boolean isBlank()
XBRLNumberisBlank in interface XBRLNumberpublic java.lang.String toString()
The representation uses the decimal format #,##0.####;(#,##0.####) that is defined as a constant
inside this class followed by p(n) which means precision n, n is the number precision (explicit or inferred) according to the
XBRL 2.1 standard. This includes the constant INF that represents INFINITE precision.
Examples: -1,000,000 p(4) -1,000,000 p(INF)
toString in class java.lang.Objectpublic java.lang.String getFriendlyName(int flags,
LabelsProvider lp)
XBRLNumbergetFriendlyName in interface XBRLNumberflags - XMLFragment.HIDE_COMMON_ACCURACY can be used to remove suffixeslp - (can be null, it is not used)public java.lang.Number getValue()
Return null if the value is nil and the fact is assigned and isNil() returns true otherwise this returns the value, that also may be null.
public java.lang.String getStringValue()
public void setValue(java.lang.Number value,
java.lang.String strValue)
value - a Number to be set as the valuestrValue - the string representation of valuepublic XBRLNumericValue clone()
XBRLNumberclone in interface XBRLNumberclone in class java.lang.Objectpublic java.lang.String getPrecision()
public XBRLNumericValue multiply(double weight)
XBRLNumbermultiply in interface XBRLNumberweight - the weightpublic XBRLNumericValue plus(XBRLNumber value2)
XBRLNumberplus in interface XBRLNumbervalue2 - the multiplypublic boolean ne(XBRLNumber value2)
XBRLNumberne in interface XBRLNumbervalue2 - the sum itempublic int getInferredPrecision()
XBRLNumbergetInferredPrecision in interface XBRLNumberpublic boolean eq(XBRLNumber value2)
XBRLNumbereq in interface XBRLNumbervalue2 - the vbpublic XBRLNumericValue roundTo(int precisionOrDecimals)
precisionOrDecimals - the new value to round this value to.public boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic static net.sf.saxon.value.NumericValue getValue(XBRLXSDTypeDefinition type, java.lang.Object value)
type - XBRLXSDTypeDefinitionvalue - the valuepublic static java.lang.String numericValueToString(java.lang.Number value)
DecimalFormat("################################.00000000000000000000000000000000",new DecimalFormatSymbols(Locale.US))
NaN is an accepted input value; in this case, the returned string is NaN.value - a Numberpublic java.lang.String getDecimals()
XBRLNumbergetDecimals in interface XBRLNumberpublic static int inferredDecimals(int precision,
java.lang.String strValue)
precision - the precisionstrValue - the str valuepublic static int inferredDecimalsBug368(int precision,
java.lang.String rawStrValue)
precision - the precisionrawStrValue - the raw str valuepublic static int inferredPrecision(java.lang.String decimalsStr,
java.lang.String strValue)
decimalsStr - the decimals strstrValue - the str valuepublic static int getExponent(java.lang.String strValue)
strValue - capitalized so the exponent will be the number after Epublic void setPrecision(int precision)
precision - the new precisionpublic void setDecimals(int decimals)
decimals - the new decimalspublic void setFact(XBRLFactNumeric factNumeric)
XBRLNumbersetFact in interface XBRLNumberfactNumeric - the new factpublic int hashCode()
XBRLNumberhashCode in interface XBRLNumberhashCode in class java.lang.Objectpublic java.math.BigDecimal getBigDecimal()