com.ihr.xbrl.om.formula

## Class XBRLVariableFact

- java.lang.Object
- - com.ihr.xbrl.om.XMLFragment
  - - com.ihr.xbrl.om.exLinks.XLinkElement
    - - com.ihr.xbrl.om.exLinks.XBRLPointerOfARelationship
      - - com.ihr.xbrl.om.exLinks.XBRLResource
        - - com.ihr.xbrl.om.formula.XBRLFormulaResource
          - - com.ihr.xbrl.om.formula.XBRLVariableResource
            - - com.ihr.xbrl.om.formula.XBRLVariableFact

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

      public class XBRLVariableFact
      extends XBRLVariableResource

  The Class XBRLVariableFact.
  Author:
    Ignacio

- - ### 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
    --- | ---
    `XFCompleteScenarioAspectTest` | `completeScenarioTest` The complete scenario test.
    `XFCompleteSegmentAspectTest` | `completeSegmentTest` The complete segment test.
    `XFConceptAspectTest` | `conceptTest` The concept test.
    `XFDimensionsTestController` | `dimensionsTest` The dimensions test.
    `XFEntityAspectTest` | `entityTest` The entity test.
    `static javax.xml.namespace.QName` | `fallbackValue` The Constant fallbackValue.
    `XFLocationAspectTest` | `locationTest` The location test.
    `static javax.xml.namespace.QName` | `matches` The Constant matches.
    `static javax.xml.namespace.QName` | `nils` The Constant nils.
    `XFNonXDTScenarioAspectTest` | `nonXDTScenarioTest` The non xdt scenario test.
    `XFNonXDTSegmentAspectTest` | `nonXDTSegmentTest` The non xdt segment test.
    `XFPeriodAspectTest` | `periodTest` The period test.
    `static javax.xml.namespace.QName` | `resourceName` The Constant resourceName.
    `XFUnitAspectTest` | `unitTest` The unit test.

    - ### Fields inherited from class com.ihr.xbrl.om.formula.XBRLVariableResource

      `as, bindAsSequence, name, order`

    - ### Fields inherited from class com.ihr.xbrl.om.exLinks.XBRLResource

      `nullResource`

    - ### Fields inherited from class com.ihr.xbrl.om.exLinks.XLinkElement

      `actuate, ACTUATE, ARC, arcrole, ARCROLE, ETITLE, EXTENDED, from, FROM, href, HREF, label, LABEL, LOCATOR, RESOURCE, role, ROLE, show, SHOW, SIMPLE, title, TITLE, to, TO, TYPE`

    - ### 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
    `XBRLVariableFact(XBRLFormulaProcessor formulaProcessor, XBRLResource res)` Instantiates a new XBRL variable fact.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `bindAsEmpty(XBRLVariablesHolder set)` Bind as empty.
    `boolean` | `bindAsSequence()` In the case of resource based variables this reads the surrounding syntax and returns the value of the bindAsSequence.
    `void` | `checkOptimizer(XBRLVariablesHolder set)` creates an optimizer of the XPath expressions and the implicit filters for all variables in the set.
    `boolean` | `checkVariable(XBRLVariablesHolder set, javax.xml.namespace.QName name, java.util.Collection<net.sf.saxon.s9api.QName> resolved)` Called for variables that are also resources during the static compilation phase of the formula preparation.
    `void` | `clear()` Removes all referneces to this resource in the DTS.
    `Evaluation` | `evaluateValue(XMLFragment evaluationContext, java.util.Collection<XBRLVariableResourceUse> availableVars, XBRLVariableSetResource set)` Evaluates the resource internal XPath expression and returns either the returned value from the XPath expression or the fall back value in the case of variables that may have a fall back value and the rawEvaluation of the XPath expression results in the empty sequence.
    `net.sf.saxon.s9api.XdmValue` | `fallbackValue(XBRLVariablesHolder set)` Return the fallbackValue or null if no fallback value is possible on this variable.
    `java.lang.String` | `getExpression()` Used only for debug purposes.
    `int` | `getUncoveredAspects(XBRLVariablesHolder set)` Gets the uncovered aspects.
    `java.util.Collection<javax.xml.namespace.QName>` | `getVariablesRequired(XBRLVariablesHolder set)` Returns a collection of variables required for the evaluation of this variable.
    `XMLFragment` | `getXMLFragment()` Returns the surrounding XML Fragment this resource comes from.
    `boolean` | `hasFilterAspect(int aspect, javax.xml.namespace.QName dimName)` Checks for filter aspect.
    `boolean` | `isCoveredAspect(int aspect, javax.xml.namespace.QName dimName)` Checks if is covered aspect.
    `boolean` | `matcheable(net.sf.saxon.s9api.XdmValue value, int aspectModel)` Calculates if the sequence passed in as a parameter satisfy requirements to be split into sub-sequences by the VariablesLoopController who is the only one class that should call this method.
    `boolean` | `matches()` Returns the explicit or default value of the matches attribute on the Fact Variable definition .
    `Evaluation` | `rawEvaluateValue(XMLFragment evaluationContext, java.util.Collection<XBRLVariableResourceUse> availableVars)` Evaluates the resource internal XPath expression and returns the sequence.

    - ### Methods inherited from class com.ihr.xbrl.om.formula.XBRLVariableResource

      `adjustValueAccordingToType, getAllAspectsFiltered, getFilters, getKeysAspectsFiltered, getUse, getVariableType`

    - ### Methods inherited from class com.ihr.xbrl.om.formula.XBRLFormulaResource

      `getProcessor`

    - ### Methods inherited from class com.ihr.xbrl.om.exLinks.XBRLResource

      `addChild, equals, generateLocatorToNode, generateNode, getAttributes, getDTSBase, getFriendlyName, getFriendlyName, getParent, getResourceIdentifier, getRoleType, getType, getValidationReport, getValueKey, hashCode, invalidate, invalidate, isComplexType, isOnValidation, isSimpleType, setComplexType, setDTSBase, setId, setParent, setRole, setRoleType, setSimpleType, setValue, validate`

    - ### Methods inherited from class com.ihr.xbrl.om.exLinks.XLinkElement

      `getActuate, getArcrole, getFromTxt, getHRef, getLabel, getRole, getShow, getStaticLabel, getSType, getTitle, getToTxt, isRequiredAttribute, isValidAttribute, setActuate, setArcrole, setFrom, setHRef, setLabel, setShow, setSType, setTitle, setTo`

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

      `addAttribute, addFromRelationship, addNamespace, addNamespace, addToRelationship, addXMLChild, changeBase, checkBase, clone, clone, delAttribute, delAttribute, equalXdmValues, evaluateBoolean, evaluateList, evaluateNode, evaluateNumber, evaluateString, generateId, generateNodeNamespacesAndAttributes, generateNodeValue, generatePrefix, getAllAttributes, getAttribute, getAttributeBooleanValue, getAttributeQNameValue, getAttributes, getAttributeStringValue, getAttributeValue, getBase, getBase, getBaseURI, getBooleanValue, getChild, getContainer, getContainerDocumentURI, getDeclaredNamespaces, getDocument, getElements, getElementsHashCode, getFragment, 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, resolve_equal2, resolveHRef, resolveHRef, s_equal2, s_equal2, s_equal2, setAttributes, setBase, setDocument, setDocumentAndReload, setElements, setLang, setNamespaceContext, setNamespaces, setNode, setNodeName, setParent, setRegenerateNodeIfnotFound, setValue, setVariablesDefined, size, thin, toString, valueEquals, xEqual`

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

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

    - ### Methods inherited from interface com.ihr.xbrl.om.formula.XBRLVariableFormulaEvaluable

      `getProcessor`

    - ### Methods inherited from interface com.ihr.xbrl.om.exLinks.XBRLRelationshipPoint

      `addFromRelationship, addToRelationship, getFromRelationships, getToRelationships, removeFromRelationship, removeToRelationship`

- - ### Field Detail

    - #### resourceName

          public static final javax.xml.namespace.QName resourceName

      The Constant resourceName.

    - #### nils

          public static final javax.xml.namespace.QName nils

      The Constant nils.

    - #### matches

          public static final javax.xml.namespace.QName matches

      The Constant matches.

    - #### fallbackValue

          public static final javax.xml.namespace.QName fallbackValue

      The Constant fallbackValue.

    - #### unitTest

          public XFUnitAspectTest unitTest

      The unit test.

    - #### locationTest

          public XFLocationAspectTest locationTest

      The location test.

    - #### conceptTest

          public XFConceptAspectTest conceptTest

      The concept test.

    - #### entityTest

          public XFEntityAspectTest entityTest

      The entity test.

    - #### periodTest

          public XFPeriodAspectTest periodTest

      The period test.

    - #### completeSegmentTest

          public XFCompleteSegmentAspectTest completeSegmentTest

      The complete segment test.

    - #### completeScenarioTest

          public XFCompleteScenarioAspectTest completeScenarioTest

      The complete scenario test.

    - #### nonXDTScenarioTest

          public XFNonXDTScenarioAspectTest nonXDTScenarioTest

      The non xdt scenario test.

    - #### nonXDTSegmentTest

          public XFNonXDTSegmentAspectTest nonXDTSegmentTest

      The non xdt segment test.

    - #### dimensionsTest

          public XFDimensionsTestController dimensionsTest

      The dimensions test.

  - ### Constructor Detail

    - #### XBRLVariableFact

          public XBRLVariableFact(XBRLFormulaProcessor formulaProcessor,
                          XBRLResource res)
                           throws XFValidationException

      Instantiates a new XBRL variable fact.
      Parameters:
        `formulaProcessor` - the formula processor
        `res` - the res
      Throws:
        `XFValidationException` - the XF validation exception

  - ### Method Detail

    - #### bindAsSequence

          public boolean bindAsSequence()

      Description copied from interface: `XBRLVariableFormulaEvaluable`
      In the case of resource based variables this reads the surrounding syntax and returns the value of the bindAsSequence.

      In other cases relays on the implementation

      Specified by:
        `bindAsSequence` in interface `XBRLVariableFormulaEvaluable`
      Overrides:
        `bindAsSequence` in class `XBRLVariableResource`
      Returns:
        true, if successful

    - #### checkVariable

          public boolean checkVariable(XBRLVariablesHolder set,
                              javax.xml.namespace.QName name,
                              java.util.Collection<net.sf.saxon.s9api.QName> resolved)
                                throws XFValidationException

      Description copied from interface: `XBRLVariableFormulaEvaluable`
      Called for variables that are also resources during the static compilation phase of the formula preparation.

      throws exceptions according to the validation rules.

      shall return true on success

      Parameters:
        `set` - the set
        `name` - the name
        `resolved` - the resolved
      Returns:
        true, if successful
      Throws:
        `XFValidationException` - the XF validation exception

    - #### checkOptimizer

          public void checkOptimizer(XBRLVariablesHolder set)

      creates an optimizer of the XPath expressions and the implicit filters for all variables in the set.
      Parameters:
        `set` - the set

    - #### matches

          public boolean matches()

      Returns the explicit or default value of the matches attribute on the Fact Variable definition .
      Returns:
        boolean

    - #### rawEvaluateValue

          public Evaluation rawEvaluateValue(XMLFragment evaluationContext,
                                    java.util.Collection<XBRLVariableResourceUse> availableVars)
                                      throws XFValidationException

      Description copied from interface: `XBRLVariableFormulaEvaluable`
      Evaluates the resource internal XPath expression and returns the sequence. This method does not considers nor evaluates the default value if any is possible. The evaluation considering default values is implemented in the `XBRLVariableFormulaEvaluable.evaluateValue(XMLFragment, Collection, XBRLVariableSetResource)` method.
      Parameters:
        `evaluationContext` - the evaluation context
        `availableVars` - the available vars
      Returns:
        the evaluation
      Throws:
        `XFValidationException` - the XF validation exception

    - #### evaluateValue

          public Evaluation evaluateValue(XMLFragment evaluationContext,
                                 java.util.Collection<XBRLVariableResourceUse> availableVars,
                                 XBRLVariableSetResource set)
                                   throws XFValidationException

      Description copied from interface: `XBRLVariableFormulaEvaluable`
      Evaluates the resource internal XPath expression and returns either the returned value from the XPath expression or the fall back value in the case of variables that may have a fall back value and the rawEvaluation of the XPath expression results in the empty sequence. The raw evaluation of the XPath expression is implemented in the rawEvaluateValue(XMLFragment, Collection) call.
      Parameters:
        `evaluationContext` - the evaluation context
        `availableVars` - the available vars
        `set` - the set
      Returns:
        the evaluation
      Throws:
        `XFValidationException` - the XF validation exception
      See Also:
        `XBRLVariableFormulaEvaluable.rawEvaluateValue(XMLFragment, Collection)`

    - #### clear

          public void clear()

      Description copied from class: `XBRLResource`
      Removes all referneces to this resource in the DTS.
      Specified by:
        `clear` in interface `XBRLVariableFormulaEvaluable`
      Overrides:
        `clear` in class `XBRLVariableResource`

    - #### fallbackValue

          public net.sf.saxon.s9api.XdmValue fallbackValue(XBRLVariablesHolder set)
                                                    throws XFValidationException

      Return the fallbackValue or null if no fallback value is possible on this variable.
      Parameters:
        `set` - the set
      Returns:
        the xdm value
      Throws:
        `XFValidationException` - the XF validation exception

    - #### bindAsEmpty

          public boolean bindAsEmpty(XBRLVariablesHolder set)
                              throws XFValidationException

      Bind as empty.
      Parameters:
        `set` - the set
      Returns:
        true, if successful
      Throws:
        `XFValidationException` - the XF validation exception

    - #### isCoveredAspect

          public boolean isCoveredAspect(int aspect,
                                javax.xml.namespace.QName dimName)

      Checks if is covered aspect.
      Parameters:
        `aspect` - the aspect
        `dimName` - the dim name
      Returns:
        true, if is covered aspect

    - #### getUncoveredAspects

          public int getUncoveredAspects(XBRLVariablesHolder set)

      Gets the uncovered aspects.
      Parameters:
        `set` - the set
      Returns:
        the uncovered aspects

    - #### hasFilterAspect

          public boolean hasFilterAspect(int aspect,
                                javax.xml.namespace.QName dimName)

      Description copied from class: `XBRLVariableResource`
      Checks for filter aspect.
      Specified by:
        `hasFilterAspect` in interface `XBRLVariableFormulaEvaluable`
      Overrides:
        `hasFilterAspect` in class `XBRLVariableResource`
      Parameters:
        `aspect` - the aspect
        `dimName` - if aspect is DIMENSION then dimName is the dimension name
      Returns:
        true, if successful

    - #### getVariablesRequired

          public java.util.Collection<javax.xml.namespace.QName> getVariablesRequired(XBRLVariablesHolder set)

      Description copied from interface: `XBRLVariableFormulaEvaluable`
      Returns a collection of variables required for the evaluation of this variable.
      Parameters:
        `set` - the set
      Returns:
        collection of QNames

    - #### matcheable

          public boolean matcheable(net.sf.saxon.s9api.XdmValue value,
                           int aspectModel)
                             throws XFValidationException

      Calculates if the sequence passed in as a parameter satisfy requirements to be split into sub-sequences by the VariablesLoopController who is the only one class that should call this method.
      Parameters:
        `value` - a sequence of 1 or more items that are values of a variable.
        `aspectModel` - This is the variable set aspect model
      Returns:
        true or false. If true an iterator over the sequence will be created. true is then returned when all elements in the sequence contains the same values for all aspects. No value of the covered is used at this time.
      Throws:
        `XFValidationException` - the XF validation exception

    - #### getExpression

          public java.lang.String getExpression()

      Description copied from class: `XBRLVariableResource`
      Used only for debug purposes.

      Returns the XPath expression used to evaluate this variable

      Specified by:
        `getExpression` in class `XBRLVariableResource`
      Returns:
        String

    - #### getXMLFragment

          public XMLFragment getXMLFragment()

      Description copied from interface: `XBRLVariableFormulaEvaluable`
      Returns the surrounding XML Fragment this resource comes from.
      Returns:
        the XML fragment