com.ihr.xbrl.om.instance

## Class XBRLUnit

- java.lang.Object
- - com.ihr.xbrl.om.XMLFragment
  - - com.ihr.xbrl.om.instance.XBRLUnit

- All Implemented Interfaces:
    HasAdditionalEqualityForReassignation, XBRLRelationshipPoint, Thinable, XBRLValidation, XMLHasParent, java.lang.Cloneable, javax.xml.namespace.NamespaceContext

      public class XBRLUnit
      extends XMLFragment
      implements XBRLValidation, HasAdditionalEqualityForReassignation

  The Class XBRLUnit.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.ihr.xbrl.om.XBRLValidation

      `XBRLValidation.Direction`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static javax.xml.namespace.QName` | `divideQNameNode` The Constant divideQNameNode.
    `static javax.xml.namespace.QName` | `PURE` The Constant PURE.
    `static javax.xml.namespace.QName` | `SHARES` The Constant SHARES.
    `static javax.xml.namespace.QName` | `unitDenominatorQNameNode` The Constant unitDenominatorQNameNode.
    `static javax.xml.namespace.QName` | `unitNumeratorQNameNode` The Constant unitNumeratorQNameNode.
    `static javax.xml.namespace.QName` | `unitQNameNode` The Constant unitQNameNode.

    - ### Fields inherited from class com.ihr.xbrl.om.XMLFragment

      `CONCEPT_LABEL, CONCEPT_QNAME, EASY_TO_READ, ELEMENT_LABEL, EMPTYRELATIONSHIPSITERATORINSTANCE, EMPTYXMLFRAGMENTITERATORINSTANCE, FACT_CONCEPT_DATATYPE, FACT_CONCEPT_LABEL, FACT_QNAME, HIDE_COMMON_ACCURACY, idQName, NO_POSITION, OrderComparator, OrderComparator2, PERIOD_TYPE, PERIOD_VALUE, SHORT_TEXT, SOURCE_DOCUMENT, XPATH, XPOINTER`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XBRLUnit(DTSContainer dts, java.util.Collection<javax.xml.namespace.QName> numerator, java.util.Collection<javax.xml.namespace.QName> denominator)` Creates an unit that can be used for XBRLFactNumeric objects.
    `XBRLUnit(DTSContainer dts, net.sf.saxon.s9api.XdmNode root)` Instantiates a new XBRL unit.
    `XBRLUnit(XBRLInstance parent, net.sf.saxon.s9api.XdmNode root)` Instantiates a new XBRL unit.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clear()` Frees-up used memory This method should not be invoqued on live objects in the DTS.
    `XBRLUnit` | `clone()`
    `XBRLUnit` | `clone(DTSContainer newDTS)` Clone.
    `boolean` | `equals(java.lang.Object other)` Evaluates u-equality of two units.
    `org.jdom.Element` | `generateNode(boolean relativize, java.net.URI base)` Serializes to a jdom Element the representation of the properties of this Information Item This method should be called from classes derived from this class
    `java.util.Collection<javax.xml.namespace.QName>` | `getDenominator()` Gets the denominator.
    `java.util.Iterator<XMLFragment>` | `getElements()` For complex type resources this returns an iterator with all children XML fragments This method may be overwriten by other classes in the hierarchy.
    `java.lang.String` | `getFriendlyName()` Returns a string description that represents the element content in a form that users can understand.
    `java.lang.String` | `getFriendlyNameOnlyId()` Gets the friendly name only id.
    `java.util.Collection<javax.xml.namespace.QName>` | `getNumerator()` Gets the numerator.
    `XBRLInstance` | `getParent()` The parent XMLFragment node of this XMLFragment node.
    `XBRLValidationReport` | `getValidationReport()` Access to the last stored validation report.
    `int` | `hashCode()`
    `void` | `invalidate()` Invalidates the XBRLFact for XBRL validation.
    `boolean` | `invalidate(XBRLValidation.Direction dir)` Invalidates this object and the elements in the XML tree according with the parameter in dir This method is used by GUI tools that requires to reset validation before a manual validation cycle is started.
    `boolean` | `isMoneraty()` Returns true if the unit is just a monetary value.
    `boolean` | `isOnValidation()` When validation is a recursive process, this function returns true if the object going to be validated is already under validation.
    `boolean` | `resolve_equal2(net.sf.saxon.s9api.XdmNode otherXdmNode)` resolves content that is added by this XMLFragment during XMLNode serialization and may not be available to the lower levels in the hierarchy.
    `boolean` | `s_equal2(java.lang.Object other)` Resolves s_equal2 comparison of this node against the other node.
    `void` | `setParent(XMLHasParent instance)` Sets the parent of this unit to the instance document specified in the parameter.
    `java.lang.String` | `toString()` Returns the XML representation of this object as an String.
    `XBRLValidationReport` | `validate(XBRLPlugInProcessor proc)` Executes validation on the instance object and returns a validation report.
    `void` | `validateISO4217()` Validate is o4217.
    `void` | `validateShares()` Validate shares.

    - ### Methods inherited from class com.ihr.xbrl.om.XMLFragment

      `addAttribute, addChild, addFromRelationship, addNamespace, addNamespace, addToRelationship, addXMLChild, changeBase, checkBase, delAttribute, delAttribute, equalXdmValues, evaluateBoolean, evaluateList, evaluateNode, evaluateNumber, evaluateString, generateId, generateNodeNamespacesAndAttributes, generateNodeValue, generatePrefix, getAllAttributes, getAttribute, getAttributeBooleanValue, getAttributeQNameValue, getAttributes, getAttributes, getAttributeStringValue, getAttributeValue, getBase, getBase, getBaseURI, getBooleanValue, getChild, getContainer, getContainerDocumentURI, getDeclaredNamespaces, getDocument, getElementsHashCode, getFragment, getFriendlyName, getFromRelationships, getFromRelationships, getFromRelationships, getFromRelationships, getFromRelationships, getGenericLabelText, getId, getLang, getNamespaceURI, getNodeName, getNumberOfAttributes, getNumberOfElements, getNumberOfFromRelationships, getNumberOfToRelationships, getOrGenerateId, getPrefix, getPrefixes, getQNameValue, getRelationshipsBases, getRelationshipsChain, getRelationshipTypes, getStaticContext, getStaticNamespace, getStringValue, getToolTipText, getToRelationships, getToRelationships, getToRelationships, getToRelationships, getToRelationships, getValue, getXPathExecutable, getXPathNamespaceContext, getXPathToNode, getXPathToRoot, getXPointerElementScheme, getXPointerElementScheme, getXPointerShorthandScheme, getXPointerToNode, isDead, isNamespaceDefined, isXdmDocumentAttached, objEquals, objHashCode, qNameToString, removeAttribute, removeChild, removeChild, removeFromRelationship, removeToRelationship, removeXMLChild, resetElements, resetHash, resolveHRef, resolveHRef, s_equal2, s_equal2, setAttributes, setBase, setDocument, setDocumentAndReload, setElements, setId, setLang, setNamespaceContext, setNamespaces, setNode, setNodeName, setRegenerateNodeIfnotFound, setValue, setValue, setVariablesDefined, size, thin, valueEquals, xEqual`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### unitQNameNode

          public static final javax.xml.namespace.QName unitQNameNode

      The Constant unitQNameNode.

    - #### divideQNameNode

          public static final javax.xml.namespace.QName divideQNameNode

      The Constant divideQNameNode.

    - #### unitNumeratorQNameNode

          public static final javax.xml.namespace.QName unitNumeratorQNameNode

      The Constant unitNumeratorQNameNode.

    - #### unitDenominatorQNameNode

          public static final javax.xml.namespace.QName unitDenominatorQNameNode

      The Constant unitDenominatorQNameNode.

    - #### PURE

          public static final javax.xml.namespace.QName PURE

      The Constant PURE.

    - #### SHARES

          public static final javax.xml.namespace.QName SHARES

      The Constant SHARES.

  - ### Constructor Detail

    - #### XBRLUnit

          public XBRLUnit(DTSContainer dts,
                  net.sf.saxon.s9api.XdmNode root)

      Instantiates a new XBRL unit.
      Parameters:
        `dts` - the dts
        `root` - the root

    - #### XBRLUnit

          public XBRLUnit(DTSContainer dts,
                  java.util.Collection<javax.xml.namespace.QName> numerator,
                  java.util.Collection<javax.xml.namespace.QName> denominator)

      Creates an unit that can be used for XBRLFactNumeric objects.
      Parameters:
        `dts` - DTSContainer, the DTS of this unit
        `numerator` - Collection<QName> elements in the numerator, cannot be null
        `denominator` - Collection<QName> elements in the denominator, can be null

    - #### XBRLUnit

          public XBRLUnit(XBRLInstance parent,
                  net.sf.saxon.s9api.XdmNode root)
                   throws XBRLInconsistentDTSException

      Instantiates a new XBRL unit.
      Parameters:
        `parent` - the parent
        `root` - the root
      Throws:
        `XBRLInconsistentDTSException` - the XBRL inconsistent dts exception

  - ### Method Detail

    - #### clear

          public void clear()
                     throws java.lang.Throwable

      Description copied from class: `XMLFragment`
      Frees-up used memory

      This method should not be invoqued on live objects in the DTS. It is automatically invoqued by the API when an object is no longer used and referenced by other objects. It is save not to call it directly.

      Overrides:
        `clear` in class `XMLFragment`
      Throws:
        `java.lang.Throwable` - the throwable

    - #### getParent

          public XBRLInstance getParent()

      Description copied from class: `XMLFragment`
      The parent XMLFragment node of this XMLFragment node.

      For XBRLAttribute nodes, the parent is the element node.

      For Document nodes the returned value is null

      For Embedded document nodes, the returned value is the parent element node.

      Specified by:
        `getParent` in interface `XMLHasParent`
      Overrides:
        `getParent` in class `XMLFragment`
      Returns:
        the parent XMLFragment possible parents are: XBRLItem, XBRLTuple, XBRLImport, XBRLLinkbase, XBRLExtendedLink, XBRLDocumentation, XBRLRelationship, XBRLResource.

    - #### clone

          public XBRLUnit clone()

      Overrides:
        `clone` in class `XMLFragment`

    - #### clone

          public XBRLUnit clone(DTSContainer newDTS)

      Description copied from class: `XMLFragment`
      Clone.
      Overrides:
        `clone` in class `XMLFragment`
      Parameters:
        `newDTS` - the new dts
      Returns:
        the XML fragment

    - #### validateISO4217

          public void validateISO4217()
                               throws XBRLValidationException

      Validate is o4217.
      Throws:
        `XBRLValidationException` - the XBRL validation exception

    - #### validateShares

          public void validateShares()
                              throws XBRLValidationException

      Validate shares.
      Throws:
        `XBRLValidationException` - the XBRL validation exception

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `XMLFragment`

    - #### equals

          public boolean equals(java.lang.Object other)

      Evaluates u-equality of two units.
      Overrides:
        `equals` in class `XMLFragment`
      Parameters:
        `other` - the other
      Returns:
        true, if successful

    - #### s_equal2

          public boolean s_equal2(java.lang.Object other)

      Description copied from class: `XMLFragment`
      Resolves s_equal2 comparison of this node against the other node.
      Overrides:
        `s_equal2` in class `XMLFragment`
      Parameters:
        `other` - The other node (preferably an XMLFragment) that contains a non null NodeInfo document.
      Returns:
        boolean

    - #### generateNode

          public org.jdom.Element generateNode(boolean relativize,
                                      java.net.URI base)
                                        throws XBRLSerializationException

      Description copied from class: `XMLFragment`
      Serializes to a jdom Element the representation of the properties of this Information Item This method should be called from classes derived from this class
      Overrides:
        `generateNode` in class `XMLFragment`
      Parameters:
        `relativize` - boolean indicating if URIs should be relativized to the base URI (see next argument)
        `base` - the URI to which some attributes of this object should be relativided
      Returns:
        a clone of the surrounding jdom Element so it can be incorporated into multiple trees
      Throws:
        `XBRLSerializationException` - the XBRL serialization exception

    - #### getNumerator

          public java.util.Collection<javax.xml.namespace.QName> getNumerator()

      Gets the numerator.
      Returns:
        the numerator

    - #### getDenominator

          public java.util.Collection<javax.xml.namespace.QName> getDenominator()

      Gets the denominator.
      Returns:
        the denominator

    - #### isMoneraty

          public boolean isMoneraty()

      Returns true if the unit is just a monetary value.
      Returns:
        boolean

    - #### getElements

          public java.util.Iterator<XMLFragment> getElements()

      Description copied from class: `XMLFragment`
      For complex type resources this returns an iterator with all children XML fragments This method may be overwriten by other classes in the hierarchy.
      Overrides:
        `getElements` in class `XMLFragment`
      Returns:
        Iterator

    - #### setParent

          public void setParent(XMLHasParent instance)
                         throws XBRLInconsistentDTSException

      Sets the parent of this unit to the instance document specified in the parameter.
      Specified by:
        `setParent` in interface `XMLHasParent`
      Overrides:
        `setParent` in class `XMLFragment`
      Parameters:
        `instance` - XBRLInstance
      Throws:
        `XBRLInconsistentDTSException` - if the context contains facts in a previous unattached instance

    - #### getFriendlyName

          public java.lang.String getFriendlyName()

      Description copied from class: `XMLFragment`
      Returns a string description that represents the element content in a form that users can understand. This method may be overridden by parent classes.

      Remarks, this method may return very long names not suitable for user interface

      Overrides:
        `getFriendlyName` in class `XMLFragment`
      Returns:
        Non empty String. Internationalization is enabled

    - #### getFriendlyNameOnlyId

          public java.lang.String getFriendlyNameOnlyId()

      Gets the friendly name only id.
      Returns:
        the friendly name only id

    - #### toString

          public java.lang.String toString()

      Description copied from class: `XMLFragment`
      Returns the XML representation of this object as an String.
      Overrides:
        `toString` in class `XMLFragment`
      Returns:
        the string

    - #### getValidationReport

          public XBRLValidationReport getValidationReport()

      Description copied from interface: `XBRLValidation`
      Access to the last stored validation report.
      Specified by:
        `getValidationReport` in interface `XBRLValidation`
      Returns:
        XBRLValidationReport or null if the object has not been validated or no errors exists

    - #### validate

          public XBRLValidationReport validate(XBRLPlugInProcessor proc)

      Description copied from interface: `XBRLValidation`
      Executes validation on the instance object and returns a validation report.

      The validation result may be cached internally. A call to `XBRLValidation.invalidate(Direction)` clears the validation cache.

      Specified by:
        `validate` in interface `XBRLValidation`
      Parameters:
        `proc` - the processor under which the object is going to be validated. Note the same object can be validated on multiple processors.
      Returns:
        the validation report or null if no errors.

    - #### invalidate

          public void invalidate()

      Description copied from interface: `XBRLValidation`
      Invalidates the XBRLFact for XBRL validation.
      Specified by:
        `invalidate` in interface `XBRLValidation`

    - #### invalidate

          public boolean invalidate(XBRLValidation.Direction dir)

      Description copied from interface: `XBRLValidation`
      Invalidates this object and the elements in the XML tree according with the parameter in dir

      This method is used by GUI tools that requires to reset validation before a manual validation cycle is started.

      Specified by:
        `invalidate` in interface `XBRLValidation`
      Parameters:
        `dir` - see the `XBRLValidation.Direction` enumeration for more information.
      Returns:
        true, if successful

    - #### isOnValidation

          public boolean isOnValidation()

      Description copied from interface: `XBRLValidation`
      When validation is a recursive process, this function returns true if the object going to be validated is already under validation. This prevents a recursive loop to enter the same validation component in an infinite loop.
      Specified by:
        `isOnValidation` in interface `XBRLValidation`
      Returns:
        true if the document is under validation. Means, the validation has not finished.

    - #### resolve_equal2

          public boolean resolve_equal2(net.sf.saxon.s9api.XdmNode otherXdmNode)

      Description copied from interface: `HasAdditionalEqualityForReassignation`
      resolves content that is added by this XMLFragment during XMLNode serialization and may not be available to the lower levels in the hierarchy.
      Specified by:
        `resolve_equal2` in interface `HasAdditionalEqualityForReassignation`
      Overrides:
        `resolve_equal2` in class `XMLFragment`
      Parameters:
        `otherXdmNode` - the other xdm node
      Returns:
        true, if successful