com.ihr.xbrl.dts

## Class VirtualDimension

- java.lang.Object
- - com.ihr.xbrl.dts.VirtualDimension

- All Implemented Interfaces:
    Dimension<java.lang.Integer>, XDTVirtualDimension, java.lang.Comparable<Dimension<?>>

      public class VirtualDimension
      extends java.lang.Object
      implements Dimension<java.lang.Integer>, XDTVirtualDimension

  Dimension for duplicate items if they exist. This class can be used to hold a domain of any type of Member

  Duplicates are identified while the DimensionalInstanceExplorer is running. When duplicates are found a duplicates dimension is created (an instance of this class) and members are added for each duplicate item in the array. Duplicates are then identified by an integer that represents the fact position in the array of duplicates.

  Note. This class handles all virtual dimensions.

  Author:
    Ignacio

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.ihr.xbrl.dts.Dimension

      `Dimension.DimensionType`

  - ### Field Summary

    - ### Fields inherited from interface com.ihr.xbrl.dts.Dimension

      `defaultDimensionsXBRL, duplicatesDimension, entityDimension, formLineDimenion, instantModeDimension, instantOnDurationDimension, periodDimensionDuration, periodDimensionInstant, POSITION_AVAIL, POSITION_COLUMN_HEADERS, POSITION_ROW_HEADERS, POSITION_UNKOWN, RSDimensionsNameNamespace, RSDimensionsNameNamespacePrefix`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VirtualDimension(javax.xml.namespace.QName name, java.lang.String userName)` Instantiates a new virtual dimension.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addMember(Member<?> member)` Adds a new dimension member to the end of the members of this dimension.
    `boolean` | `bHasFixedName()` This function returns true if the dimension has a fixed name that must be obtained via a call to `Dimension.getDimensionName()`.
    `int` | `compareTo(Dimension<?> o)`
    `boolean` | `delMember(Member<?> member)` Removes an existing dimension member from the dimension domain.
    `boolean` | `equals(java.lang.Object obj)` Equals.
    `boolean` | `factMatches(XDTFactWithVirtualDimensions item, Member<?> mem, java.util.HashSet<javax.xml.namespace.QName> dimensionsToMatch, java.lang.Object contextualExtraInformation)` Fact matches.
    `Member<?>` | `findMember(Member<?> mem)` Search the Dimension domain for an occurrence of the mem member.
    `Member<?>` | `getDefault()` for explicit dimensions this function returns the default member if any is defined.
    `java.lang.String` | `getDimensionName()` This function will be used to obtain a dimension name for things that does not have a label like the Period dimension or the Identifier dimension.
    `java.util.Collection<Member<?>>` | `getDomain()` Returns an ordered collection of members.
    `Member<?>` | `getMemberFromString(java.lang.String value)` Returns the domain member whose test representation matches the string value or null.
    `java.util.Collection<Member<?>>` | `getMembers()` Returns an ordered collection of members.
    `javax.xml.namespace.QName` | `getName()` Every Dimension must have a dimension QName.
    `int` | `getSuggestedInitialPosition(javax.xml.namespace.QName selectedPrimaryItem)` Returns the suggested initial placement position of the graphical element in the GUI.
    `Dimension.DimensionType` | `getType()` returns either com.ihr.xbrl.om.xdt.XDTDimension.TYPED, com.ihr.xbrl.om.xdt.XDTDimension.EXPLICIT depending on the type of the surrounding dimension.
    `int` | `hashCode()` Hash code.
    `boolean` | `isPrimary()` Returns true if the dimension is linked with a primary item and thus it is a PDimension or a DDimension.
    `boolean` | `isTree()` Returns true if the representation of this dimension could be a tree of elements or false if it is a list of items.
    `void` | `setAllowDuplicates(boolean allowDuplicates)` If the value is true then it is possible for the dimension to contain two identical members as two different member values.

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

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

- - ### Constructor Detail

    - #### VirtualDimension

          public VirtualDimension(javax.xml.namespace.QName name,
                          java.lang.String userName)

      Instantiates a new virtual dimension.
      Parameters:
        `name` - the name
        `userName` - the user name

  - ### Method Detail

    - #### addMember

          public boolean addMember(Member<?> member)

      Description copied from interface: `Dimension`
      Adds a new dimension member to the end of the members of this dimension. returns true if the member is new, false if the member already exist
      Specified by:
        `addMember` in interface `Dimension<java.lang.Integer>`
      Parameters:
        `member` - the member
      Returns:
        true, if successful

    - #### bHasFixedName

          public boolean bHasFixedName()

      Description copied from interface: `Dimension`
      This function returns true if the dimension has a fixed name that must be obtained via a call to `Dimension.getDimensionName()`.
      Specified by:
        `bHasFixedName` in interface `Dimension<java.lang.Integer>`
      Returns:
        boolean

    - #### delMember

          public boolean delMember(Member<?> member)

      Description copied from interface: `Dimension`
      Removes an existing dimension member from the dimension domain.
      Specified by:
        `delMember` in interface `Dimension<java.lang.Integer>`
      Parameters:
        `member` - the member to remove
      Returns:
        true, if successful

    - #### factMatches

          public boolean factMatches(XDTFactWithVirtualDimensions item,
                            Member<?> mem,
                            java.util.HashSet<javax.xml.namespace.QName> dimensionsToMatch,
                            java.lang.Object contextualExtraInformation)

      Description copied from interface: `Dimension`
      Fact matches.
      Specified by:
        `factMatches` in interface `Dimension<java.lang.Integer>`
      Parameters:
        `item` - the item
        `mem` - the mem
        `dimensionsToMatch` - the dims to match on this round
        `contextualExtraInformation` - the contextual extra information
      Returns:
        true, if successful

    - #### findMember

          public Member<?> findMember(Member<?> mem)

      Description copied from interface: `Dimension`
      Search the Dimension domain for an occurrence of the mem member. If found. the found member is returned. otherwise null is returned
      Specified by:
        `findMember` in interface `Dimension<java.lang.Integer>`
      Parameters:
        `mem` - the member to search on this dimension domain
      Returns:
        the member found or null

    - #### getDefault

          public Member<?> getDefault()

      Description copied from interface: `Dimension`
      for explicit dimensions this function returns the default member if any is defined.
      Specified by:
        `getDefault` in interface `Dimension<java.lang.Integer>`
      Returns:
        the default

    - #### getDimensionName

          public java.lang.String getDimensionName()

      Description copied from interface: `Dimension`
      This function will be used to obtain a dimension name for things that does not have a label like the Period dimension or the Identifier dimension.
      Specified by:
        `getDimensionName` in interface `Dimension<java.lang.Integer>`
      Returns:
        String

    - #### getDomain

          public java.util.Collection<Member<?>> getDomain()

      Description copied from interface: `Dimension`
      Returns an ordered collection of members. If the members are hierarchically organized then the ordering includes only the parent elements.
      Specified by:
        `getDomain` in interface `Dimension<java.lang.Integer>`
      Returns:
        Collection of members

    - #### getMembers

          public java.util.Collection<Member<?>> getMembers()

      Description copied from interface: `Dimension`
      Returns an ordered collection of members. If the members are hierarchically organized then the ordering includes parents first, when a parent has children, then the list of children from the first one to the last one then the parent continues.
      Specified by:
        `getMembers` in interface `Dimension<java.lang.Integer>`
      Returns:
        Collection of members

    - #### getName

          public javax.xml.namespace.QName getName()

      Description copied from interface: `Dimension`
      Every Dimension must have a dimension QName.
      Specified by:
        `getName` in interface `Dimension<java.lang.Integer>`
      Specified by:
        `getName` in interface `XDTVirtualDimension`
      Returns:
        QName

    - #### getSuggestedInitialPosition

          public int getSuggestedInitialPosition(javax.xml.namespace.QName selectedPrimaryItem)

      Description copied from interface: `Dimension`
      Returns the suggested initial placement position of the graphical element in the GUI. This value is a constant defined in this interface
      Specified by:
        `getSuggestedInitialPosition` in interface `Dimension<java.lang.Integer>`
      Parameters:
        `selectedPrimaryItem` - this is the selected primary item in the GUI
      Returns:
        integer constant defined in this interface

    - #### getType

          public Dimension.DimensionType getType()

      Description copied from interface: `Dimension`
      returns either com.ihr.xbrl.om.xdt.XDTDimension.TYPED, com.ihr.xbrl.om.xdt.XDTDimension.EXPLICIT depending on the type of the surrounding dimension. Also returns -1 if the dimension is the primary item or a pre defined dimension in XBRL as the time dimension or the company dimension
      Specified by:
        `getType` in interface `Dimension<java.lang.Integer>`
      Returns:
        integer constant defined in com.ihr.xbrl.om.xdt.XDTDimension class

    - #### isPrimary

          public boolean isPrimary()

      Description copied from interface: `Dimension`
      Returns true if the dimension is linked with a primary item and thus it is a PDimension or a DDimension.
      Specified by:
        `isPrimary` in interface `Dimension<java.lang.Integer>`
      Returns:
        boolean value

    - #### isTree

          public boolean isTree()

      Description copied from interface: `Dimension`
      Returns true if the representation of this dimension could be a tree of elements or false if it is a list of items.
      Specified by:
        `isTree` in interface `Dimension<java.lang.Integer>`
      Returns:
        boolean value (never calculated)

    - #### setAllowDuplicates

          public void setAllowDuplicates(boolean allowDuplicates)

      Description copied from interface: `Dimension`
      If the value is true then it is possible for the dimension to contain two identical members as two different member values. If the value is false, a call to a method addMember will always check the existence of the member before the member is added to the dimension
      Specified by:
        `setAllowDuplicates` in interface `Dimension<java.lang.Integer>`
      Parameters:
        `allowDuplicates` - the new allow duplicates

    - #### hashCode

          public int hashCode()

      Description copied from interface: `Dimension`
      Hash code.
      Specified by:
        `hashCode` in interface `Dimension<java.lang.Integer>`
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        the int

    - #### equals

          public boolean equals(java.lang.Object obj)

      Description copied from interface: `Dimension`
      Equals.
      Specified by:
        `equals` in interface `Dimension<java.lang.Integer>`
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the other
      Returns:
        true, if successful

    - #### compareTo

          public int compareTo(Dimension<?> o)

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

    - #### getMemberFromString

          public Member<?> getMemberFromString(java.lang.String value)

      Description copied from interface: `Dimension`
      Returns the domain member whose test representation matches the string value or null.
      Specified by:
        `getMemberFromString` in interface `Dimension<java.lang.Integer>`
      Parameters:
        `value` - the value
      Returns:
        the member from string