com.ihr.xbrl.dts

## Class DimensionalInstanceExplorer

- java.lang.Object
- - com.ihr.xbrl.dts.InstanceExplorerAbstract
  - - com.ihr.xbrl.dts.DimensionalInstanceExplorer

- All Implemented Interfaces:
    ContextProvider, InstanceExplorerInterface, InstanceExplorerListener, UnitsProvider

      public class DimensionalInstanceExplorer
      extends InstanceExplorerAbstract

  This class provides methods to investigate the content of an XBRL instance document from a high level point of view so the development of tools reading the content of instance document will be much easier.
  Author:
    Ignacio

- - ### Field Summary

    - ### Fields inherited from class com.ihr.xbrl.dts.InstanceExplorerAbstract

      `ACUM_Q1Q3, ALL, DAYS, FOREVER, HALVES, HOURS, INSTANT, MINUTES, MONTHS, NONSTANDARD, notesOrderer, QUARTERS, sDays, SECONDS, sForever, sHalves, sHours, sMinutes, sMonths, sNonstandard, sQuarters, sSeconds, sWeeks, sYears, unkownUnit, WEEKS, YEARS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DimensionalInstanceExplorer(LangsProvider lp, HasBoySupport hb, HasDimensionsTableHeaderItem hdth, HasAccessSelectedRole instanceDocumentPane, DefaultUnitProviderInterface defaultUnitProvider, HandleInstantMode him)` Instantiates a new dimensional instance explorer.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addContext(XBRLContext newContext)` Adds a new context to this context provider.
    `void` | `addFact(XBRLFact fact)` Received notification that a fact has been added.
    `void` | `addFragmentMember(XMLFragmentMember frMem, java.lang.String text)` Adds a member to a typed dimension Forwards messages accordingly.
    `void` | `clear()` Clear.
    `void` | `delFact(XBRLFact fact, XBRLFactsList parent)` Receives notification that a fact has been removed from the instance being explored.
    `void` | `factChangedContext(XBRLFactItem fact, XBRLContext oldContext, XBRLContext newContext)` Informs the Context provider that the fact has changed its context information.
    `void` | `factChangedUnit(XBRLFactNumeric fact, XBRLUnit oldUnit, XBRLUnit newUnit)` Fact changed unit.
    `XBRLFactItem` | `findFact(java.util.ArrayList<Member<?>> allMembers)` if the allMembers contains LineTitleMember elements, we need to resolve the hierarchy resolution before calling this method.
    `java.util.Iterator<XBRLContext>` | `getCompatibleContexts(XBRLFactItem fact)` Returns an iterator over compatible contexts for this fact.
    `Dimension<?>` | `getDimensionFromQName(javax.xml.namespace.QName name)` Gets the dimension from the "name" parameter that applies for the selected primary item.
    `XBRLInstance` | `getInstance()` Access to the XBRLInstance in the instance explorer.
    `java.util.Collection<ClsPackQNameContainer>` | `getItemDimensions(XMLElementDefinition item, XBRLRoleType role)` Returns a collection of dimensions that are applicable for this primary item.
    `XDTInfosetConsumer` | `getXDTInfosetConsumer()` Access to the XDTInfosetConsumer linked with this DimensionalIntanceExplorer.
    `XDTProcessor` | `getXDTProc()` Access to the XDTProcessor linked with this DimensionalInstanceExplorer.
    `void` | `resetDuplicatesDimension()` Reset duplicates dimension.
    `void` | `resetTypedDimensions()` Clear typed dimension members.
    `void` | `setInstance(XBRLInstance instance)` Sets the instance.
    `void` | `setXDTProcessors(XDTProcessor xdt, XDTInfosetConsumer xdtInfo)` When the DTS change these variables must be updated too.
    `void` | `update()` Update.

    - ### Methods inherited from class com.ihr.xbrl.dts.InstanceExplorerAbstract

      `addInstanceExplorerListener, getCompanyKeys, getFactNotes, getInstanceExplorerListeners, getNumberOfCompanies, getNumTokens, getStringOfDateStep, getStringOfPeriod, getSuggestedUnit, getSuggestedUnits, getVNotes, hasDataForCompany, indexOfDateStepCode, instanceEvent, intTokenToString, removeInstanceExplorerListener, sendEvent, setSuggestedUnit, stepsCodeForIndex, stringTokenToInt`

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

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DimensionalInstanceExplorer

          public DimensionalInstanceExplorer(LangsProvider lp,
                                     HasBoySupport hb,
                                     HasDimensionsTableHeaderItem hdth,
                                     HasAccessSelectedRole instanceDocumentPane,
                                     DefaultUnitProviderInterface defaultUnitProvider,
                                     HandleInstantMode him)

      Instantiates a new dimensional instance explorer.
      Parameters:
        `lp` - the lp
        `hb` - the hb
        `hdth` - the hdth
        `instanceDocumentPane` - the instance document pane
        `defaultUnitProvider` - the default unit provider
        `him` - the him

  - ### Method Detail

    - #### setXDTProcessors

          public void setXDTProcessors(XDTProcessor xdt,
                              XDTInfosetConsumer xdtInfo)

      When the DTS change these variables must be updated too.
      Parameters:
        `xdt` - the xdt
        `xdtInfo` - the xdt info

    - #### setInstance

          public void setInstance(XBRLInstance instance)

      Sets the instance.
      Parameters:
        `instance` - the new instance

    - #### resetDuplicatesDimension

          public void resetDuplicatesDimension()

      Reset duplicates dimension.

    - #### resetTypedDimensions

          public void resetTypedDimensions()

      Clear typed dimension members.

    - #### update

          public void update()

      Update.

    - #### getXDTProc

          public XDTProcessor getXDTProc()

      Access to the XDTProcessor linked with this DimensionalInstanceExplorer.
      Returns:
        instance of XDTProcessor or null if none is set

    - #### getXDTInfosetConsumer

          public XDTInfosetConsumer getXDTInfosetConsumer()

      Access to the XDTInfosetConsumer linked with this DimensionalIntanceExplorer.
      Returns:
        instance od XDTInfosetConsumer or null if none is set

    - #### clear

          public void clear()

      Description copied from interface: `InstanceExplorerInterface`
      Clear.
      Specified by:
        `clear` in interface `InstanceExplorerInterface`
      Overrides:
        `clear` in class `InstanceExplorerAbstract`

    - #### addContext

          public void addContext(XBRLContext newContext)

      Description copied from interface: `ContextProvider`
      Adds a new context to this context provider. This happens when the user creates a new context
      Parameters:
        `newContext` - XBRLContext to add

    - #### factChangedContext

          public void factChangedContext(XBRLFactItem fact,
                                XBRLContext oldContext,
                                XBRLContext newContext)

      Description copied from interface: `ContextProvider`
      Informs the Context provider that the fact has changed its context information.
      Parameters:
        `fact` - the fact
        `oldContext` - the old context
        `newContext` - the new context

    - #### getCompatibleContexts

          public java.util.Iterator<XBRLContext> getCompatibleContexts(XBRLFactItem fact)

      Description copied from interface: `ContextProvider`
      Returns an iterator over compatible contexts for this fact. the first element in the iterator is the context currently associated to the fact.
      Parameters:
        `fact` - the fact
      Returns:
        Iterator<XBRLContext>

    - #### factChangedUnit

          public void factChangedUnit(XBRLFactNumeric fact,
                             XBRLUnit oldUnit,
                             XBRLUnit newUnit)

      Description copied from interface: `UnitsProvider`
      Fact changed unit.
      Parameters:
        `fact` - the fact
        `oldUnit` - the old unit
        `newUnit` - the new unit

    - #### findFact

          public XBRLFactItem findFact(java.util.ArrayList<Member<?>> allMembers)

      Description copied from interface: `InstanceExplorerInterface`
      if the allMembers contains LineTitleMember elements, we need to resolve the hierarchy resolution before calling this method. In other words, this method no longer supports LineTitleMember as members of the ArrayList
      Parameters:
        `allMembers` - the all members
      Returns:
        the XBRL fact item

    - #### getItemDimensions

          public java.util.Collection<ClsPackQNameContainer> getItemDimensions(XMLElementDefinition item,
                                                                      XBRLRoleType role)

      Returns a collection of dimensions that are applicable for this primary item.
      Parameters:
        `item` - the item
        `role` - the role
      Returns:
        the item dimensions

    - #### getDimensionFromQName

          public Dimension<?> getDimensionFromQName(javax.xml.namespace.QName name)

      Gets the dimension from the "name" parameter that applies for the selected primary item. The selected primary item is obtained from a call to getSelectedPrimaryItem() on the interface used to create this instance. The getSelectedPrimaryItem() method is defined in the HasDimensionsTableHeaderItem interface. Also the dimension is limited to the role returned by a call to getSelectedRole() that is defined in the HasAccessSelectedRole interface.

      How this method works:

      1. Obtain the selected role via the getSelectedRole() method call
      2. Obtain the selected primary item from a call to getSelectedPrimaryItem()
      3. process the definition linkbases and find a dimension that matches the dimension name indicated in the QName name parameter and return it
      Parameters:
        `name` - the name
      Returns:
        the dimension from q name
      See Also:
        `HasDimensionsTableHeaderItem`, `HasAccessSelectedRole`

    - #### addFact

          public void addFact(XBRLFact fact)

      Description copied from interface: `InstanceExplorerInterface`
      Received notification that a fact has been added.
      Parameters:
        `fact` - the fact

    - #### delFact

          public void delFact(XBRLFact fact,
                     XBRLFactsList parent)

      Description copied from interface: `InstanceExplorerInterface`
      Receives notification that a fact has been removed from the instance being explored.

      Note: after removing a fact from its container the fact parent is set to null.

      The fact has to be removed from the parent container prior to call this method and this is the reason this method has a second parameter that indicated what the parent container was.

      Parameters:
        `fact` - the fact
        `parent` - the parent

    - #### addFragmentMember

          public void addFragmentMember(XMLFragmentMember frMem,
                               java.lang.String text)

      Adds a member to a typed dimension Forwards messages accordingly.
      Parameters:
        `frMem` - the fr mem
        `text` - String text representation for fm or null

    - #### getInstance

          public XBRLInstance getInstance()

      Description copied from interface: `InstanceExplorerInterface`
      Access to the XBRLInstance in the instance explorer.
      Returns:
        single instance of InstanceExplorerInterface