com.ihr.xbrl.om.formula.filters

## Interface XBRLFormulaFilter

- All Known Subinterfaces:
    XBRLDelayedCompilationFilter, XBRLLogicalOpFilter
  All Known Implementing Classes:
    XBRLAncestorFilter, XBRLAndFilter, XBRLAspectCoverFilter, XBRLConceptBalanceFilter, XBRLConceptCustomAttributeFilter, XBRLConceptDataTypeFilter, XBRLConceptFilterAbstract, XBRLConceptNameFilter, XBRLConceptPeriodTypeFilter, XBRLConceptRelationFilter, XBRLConceptSubstitutionGroupFilter, XBRLDimensionFilterAbstract, XBRLExplicitDimensionFilter, XBRLExplicitDimensionMultiFilter, XBRLFormulaFilterBase, XBRLGeneralFilter, XBRLGeneralMeasuresFilter, XBRLIdentifierFilter, XBRLLocationFilter, XBRLMatchAbstractFilter, XBRLMatchConceptFilter, XBRLMatchDimensionFilter, XBRLMatchEntityIdentifierFilter, XBRLMatchLocationFilter, XBRLMatchNonXDTScenarioFilter, XBRLMatchNonXDTSegmentFilter, XBRLMatchPeriodFilter, XBRLMatchScenarioFilter, XBRLMatchSegmentFilter, XBRLMatchUnitFilter, XBRLOrFilter, XBRLParentFilter, XBRLPeriodEndFilter, XBRLPeriodFilter, XBRLPeriodFilterAbstract, XBRLPeriodForeverFilter, XBRLPeriodInstantDurationFilter, XBRLPeriodInstantFilter, XBRLPeriodStartFilter, XBRLRegExpIdentifierFilter, XBRLRegExpSchemeFilter, XBRLRelativeFilter, XBRLScenarioFilter, XBRLSegmentFilter, XBRLSiblingFilter, XBRLSingleMeasureFilter, XBRLSpecificIdentifierFilter, XBRLSpecificSchemeFilter, XBRLTypedDimensionFilter, XBRLValueNilFilter, XBRLValuePrecisionFilter

      public interface XBRLFormulaFilter

  This interface defines the minimum requirements for an XBRL Formula Filter

  A filter can be compared against other filters in order to decide about the order the filter expressions are evaluated. This order is not defined in the XBRL Formula Specification (a mistake made by the authors of the Specification) but filter order is relevant during the formula evaluation. Example

  Expression A obtains facts in the instance
  Expression B returns the unit of a monetary fact variable.

  Expression B would return an error condition if the fact is not numeric.

  Expression C filters only numeric values from the instance.

  Expression C should be evaluated BEFORE expression B in order to avoid unexpected errors to be raised during the evaluation of expression B.

  The Formula Specification 1.0 does not allows users to define any order in which the filters should be evaluated. So different implementations would raise different results.

  In the opinion of RS, the XBRL Formula specification should allow just one filter (the general filter) and avoid any other filter to exist. Software products in the market would facilitate users to write the long XPath expressions, the specification is NOT the place to put all this stuff.

  Author:
    Ignacio

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `collectVariables(java.util.Collection<javax.xml.namespace.QName> col, java.util.Collection<net.sf.saxon.s9api.QName> resolved)` This method is called after the filter has been compiled.
    `int` | `getFilterWeight()` Returns a number assigned statically to every filter type in order to facilitate evaluate the right order in which filters should be concatenated in an XPath expression or Boolean Filter.
    `java.lang.String` | `getLabel()` Implemented in the XBRLResource.
    `int` | `getRelatedAspect(boolean bIsCover)` Returns a constant value indicating the aspect covered by this filter Constants are defined in the CommonAspectRule class.
    `java.lang.String` | `getXPathTerm(java.util.Collection<net.sf.saxon.s9api.QName> preDefinedVariables)` Access to the XPath expression for this filter according to the formula specification.

- - ### Method Detail

    - #### getXPathTerm

          java.lang.String getXPathTerm(java.util.Collection<net.sf.saxon.s9api.QName> preDefinedVariables)
                                        throws XFValidationException

      Access to the XPath expression for this filter according to the formula specification.
      Parameters:
        `preDefinedVariables` - set of pre defined variables in the variable set
      Returns:
        The XPath expression for this filter
      Throws:
        `XFValidationException` - if the variable filter XPath expression cannot be compiled for any reason

    - #### getRelatedAspect

          int getRelatedAspect(boolean bIsCover)

      Returns a constant value indicating the aspect covered by this filter Constants are defined in the CommonAspectRule class.
      Parameters:
        `bIsCover` - boolean value indicating the value of the cover attribute on the arc connecting the variable with the filter
      Returns:
        integer constant

    - #### collectVariables

          void collectVariables(java.util.Collection<javax.xml.namespace.QName> col,
                              java.util.Collection<net.sf.saxon.s9api.QName> resolved)

      This method is called after the filter has been compiled. The method must add to the parameter all variables required for the evaluation of the XPath sentence that will be returned by the getXPathTerm() method
      Parameters:
        `col` - the collection where variables will be appended
        `resolved` - the resolved

    - #### getFilterWeight

          int getFilterWeight()

      Returns a number assigned statically to every filter type in order to facilitate evaluate the right order in which filters should be concatenated in an XPath expression or Boolean Filter. The number is assigned in a table inside the XBRLFilterOrderTool class.

      A typical implementation should just do:

           XBRLFilterOrderTool.getFilterWeight(getClass());

      and make sure the class is defined in the XBRLFilterOrderTool
      Returns:
        integer for comparison of filter order

    - #### getLabel

          java.lang.String getLabel()

      Implemented in the XBRLResource. Allows for finer logging
      Returns:
        String