com.ihr.xbrl.om.exLinks

## Class DTSBase

- java.lang.Object
- - com.ihr.xbrl.om.exLinks.DTSBase

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<DTSBase>

      public class DTSBase
      extends java.lang.Object
      implements java.io.Serializable, java.lang.Comparable<DTSBase>

  a DTSBase is a container of all Extended links with the same value in the xlink:role attribute It doesn't matter in which XBRLLinkbase the Extended links are going to be serialized.
  Author:
    Ignacio
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DTSBase(DTSContainer dts, javax.xml.namespace.QName linkbaseType, XBRLRoleType role)` Creates an empty base (no extended links).

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addExtendedLink(XBRLExtendedLink extendedLink)` An optimization of this strategy would be to write down the relationships not the extended links one by one.
    `void` | `addRelationship(XBRLRelationship relationship)` Adds the relationship.
    `void` | `clear()` Clear.
    `int` | `compareTo(DTSBase o)`
    `boolean` | `equals(java.lang.Object obj)`
    `java.util.Iterator<XBRLArcroleType>` | `getArcroles(XBRLExtendedLink filter)` An iterator over arcroles in one extended link.
    `DTSBaseSet` | `getBaseSet(XBRLArcroleType arcrole)` Returns the DTSBaseSet object for this arcrole Type The DTSBaseSet is a HashSet of XBRLRelationshpis.
    `java.util.Iterator<XBRLArcroleType>` | `getBaseSetArcroles()` An iterator over arcroles in all base sets inside this DTSBase.
    `java.util.Iterator<XBRLRelationship>` | `getBaseSetRelationshipsIterator(XBRLArcroleType arcrole)` Returns an iterator over the relationships in the base set.
    `java.util.Iterator<XBRLRelationship>` | `getBaseSetRelationshipsIterator(XBRLArcroleType arcrole, XBRLValidationReport rep)` Returns an iterator over the relationships in the base set.
    `DTSContainer` | `getContainer()` Returns the DTSContainer associated to this object.
    `java.util.Iterator<XBRLExtendedLink>` | `getExtendedLinks()` Gets the extended links.
    `DTSBaseSet` | `getIneffectualBaseSet(XBRLArcroleType arcrole, EFMProcessor proc, XBRLValidationReport rep)` This method processes all arcs in a DTSBase and returns all ineffectual relationships in a new constructed instance of a DTSBaseSet.
    `javax.xml.namespace.QName` | `getLinkbaseType()` Gets the linkbase type.
    `XBRLRoleType` | `getRole()` Gets the role.
    `java.util.Iterator<XBRLResource>` | `getVectorResources(java.lang.String extraXPath)` Gets the vector resources.
    `int` | `hashCode()`
    `boolean` | `isBaseSetDefined(XBRLArcroleType arcrole)` Returns true if on this DTSbase set there is a DTSBaseSet of relationships for the indicated arcrole, this method does not create an empty base set if it is not defined and does not change the DTS content in any manner.
    `boolean` | `removeExtendedLink(XBRLExtendedLink extendedLink)` Removes an extended link from this base.
    `boolean` | `removeRelationship(XBRLRelationship relationship)` Removes the relationship.
    `void` | `serialize(XBRLRelationship rel, XBRLDocument document)` This function makes sure that: 1- the relationship exists in the appropriate ExtendedLink or creates the extended link 2- If the target is a resource, the resource is included in the ExtendedLink as well.
    `java.lang.String` | `toString()`

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

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

- - ### Constructor Detail

    - #### DTSBase

          public DTSBase(DTSContainer dts,
                 javax.xml.namespace.QName linkbaseType,
                 XBRLRoleType role)

      Creates an empty base (no extended links).
      Parameters:
        `dts` - DTSContainer object
        `linkbaseType` - QName
        `role` - XBRLRoleType

  - ### Method Detail

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### addExtendedLink

          public void addExtendedLink(XBRLExtendedLink extendedLink)
                               throws XBRLInconsistentDTSException

      An optimization of this strategy would be to write down the relationships not the extended links one by one. But it is necessary to deal with duplicate arcs before
      Parameters:
        `extendedLink` - the extended link
      Throws:
        `XBRLInconsistentDTSException` - the XBRL inconsistent dts exception

    - #### removeExtendedLink

          public boolean removeExtendedLink(XBRLExtendedLink extendedLink)

      Removes an extended link from this base.
      Parameters:
        `extendedLink` - to remove
      Returns:
        boolean. true if it has been removed false if no changes were made

    - #### getContainer

          public DTSContainer getContainer()

      Returns the DTSContainer associated to this object.
      Returns:
        DTSContainer instance associated to this DTSBase

    - #### getBaseSetArcroles

          public java.util.Iterator<XBRLArcroleType> getBaseSetArcroles()

      An iterator over arcroles in all base sets inside this DTSBase.
      Returns:
        Iterator<XBRLArcroleType>

    - #### getArcroles

          public java.util.Iterator<XBRLArcroleType> getArcroles(XBRLExtendedLink filter)

      An iterator over arcroles in one extended link.
      Parameters:
        `filter` - the extended link to explore for arcroles
      Returns:
        Iterator<XBRLArcroleType>

    - #### getBaseSetRelationshipsIterator

          public java.util.Iterator<XBRLRelationship> getBaseSetRelationshipsIterator(XBRLArcroleType arcrole)

      Returns an iterator over the relationships in the base set. Arcs are resolved to return only those that are not prohibiting other arcs
      Parameters:
        `arcrole` - or the arcs to filter
      Returns:
        an Iterator object

    - #### getBaseSetRelationshipsIterator

          public java.util.Iterator<XBRLRelationship> getBaseSetRelationshipsIterator(XBRLArcroleType arcrole,
                                                                             XBRLValidationReport rep)

      Returns an iterator over the relationships in the base set. Arcs are resolved to return only those that are not prohibiting other arcs. This method receives an XBRLValidationReport instance. All errors will be added to that XBRLValidationReport.
      Parameters:
        `arcrole` - or the arcs to filter
        `rep` - instance of the XBRLValidationReport where errors will be added.
      Returns:
        an Iterator object

    - #### getBaseSet

          public DTSBaseSet getBaseSet(XBRLArcroleType arcrole)
                                throws XBRLRuntimeException

      Returns the DTSBaseSet object for this arcrole Type The DTSBaseSet is a HashSet of XBRLRelationshpis. This method may return null under certain conditions such as when another thread has informed this processor to stop operations.
      Parameters:
        `arcrole` - or the arcs to filter
      Returns:
        a DTSBaseSet
      Throws:
        `XBRLRuntimeException` - if there were XBRLValidationExceptions that cannot be added to an existing XBRLValidationReport

    - #### isBaseSetDefined

          public boolean isBaseSetDefined(XBRLArcroleType arcrole)

      Returns true if on this DTSbase set there is a DTSBaseSet of relationships for the indicated arcrole, this method does not create an empty base set if it is not defined and does not change the DTS content in any manner.
      Parameters:
        `arcrole` - the XBRLArcroleType to ask for on this DTSBase
      Returns:
        true if there is a DTSBaseSet already indexed and contains at least one relationship
      Since:
        2.8.4

    - #### getIneffectualBaseSet

          public DTSBaseSet getIneffectualBaseSet(XBRLArcroleType arcrole,
                                         EFMProcessor proc,
                                         XBRLValidationReport rep)
                                           throws XBRLValidationException

      This method processes all arcs in a DTSBase and returns all ineffectual relationships in a new constructed instance of a DTSBaseSet. The only reason for this method to exist is to allow EFM (Edgar Filer Manual) to detect such condition as it is indicated as one error but it is not used for any other reason in the API. Even more, ineffectual relationships shall not be considered as errors by the US SEC as the existing XBRL Specifications already handles all possible situations where a relationship shall be used in combination with other relationships. The existence of such error condition just requires processors to detect things that are not errors in the specification. The existence of this condition could be just a consequence of low quality software written by the SEC or by SEC contractors. We encourage the SEC to properly use the XBRL specifications and concentrate on elaborate EFM rules that are not simply syntactical XBRL rules.
      Parameters:
        `arcrole` - the XBRLArcroleType for which relationships are going to be processed
        `proc` - instance of the EFMProcessor in order to recognize if the relationship belongs to an official taxonomy or an extension taxonomy
        `rep` - the rep
      Returns:
        DTSBaseSet
      Throws:
        `XBRLValidationException` - the XBRL validation exception
      Since:
        2.7.4

    - #### addRelationship

          public void addRelationship(XBRLRelationship relationship)
                               throws XBRLValidationException

      Adds the relationship.
      Parameters:
        `relationship` - the relationship
      Throws:
        `XBRLValidationException` - the XBRL validation exception

    - #### removeRelationship

          public boolean removeRelationship(XBRLRelationship relationship)
                                     throws XBRLInconsistentDTSException

      Removes the relationship.
      Parameters:
        `relationship` - the relationship
      Returns:
        true, if successful
      Throws:
        `XBRLInconsistentDTSException` - the XBRL inconsistent dts exception

    - #### getVectorResources

          public java.util.Iterator<XBRLResource> getVectorResources(java.lang.String extraXPath)
                                                              throws javax.xml.xpath.XPathExpressionException,
                                                                     XBRLValidationException

      Gets the vector resources.
      Parameters:
        `extraXPath` - the extra x path
      Returns:
        the vector resources
      Throws:
        `javax.xml.xpath.XPathExpressionException` - the x path expression exception
        `XBRLValidationException` - the XBRL validation exception

    - #### getLinkbaseType

          public javax.xml.namespace.QName getLinkbaseType()

      Gets the linkbase type.
      Returns:
        the linkbase type

    - #### getRole

          public XBRLRoleType getRole()

      Gets the role.
      Returns:
        the role

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getExtendedLinks

          public java.util.Iterator<XBRLExtendedLink> getExtendedLinks()

      Gets the extended links.
      Returns:
        Iterator<XBRLExtendedLink>

    - #### serialize

          public void serialize(XBRLRelationship rel,
                       XBRLDocument document)
                         throws XBRLSerializationException

      This function makes sure that: 1- the relationship exists in the appropriate ExtendedLink or creates the extended link 2- If the target is a resource, the resource is included in the ExtendedLink as well.
      Parameters:
        `rel` - The Relationship. MUST be a relationship created in this base
        `document` - XBRLDocument MUST be an XBRLIntance or an XBRLLinkbase
      Throws:
        `XBRLSerializationException` - the XBRL serialization exception

    - #### clear

          public void clear()

      Clear.

    - #### compareTo

          public int compareTo(DTSBase o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable<DTSBase>`