Module logicng

Class VariableProfileFunction

  • All Implemented Interfaces:
    FormulaFunction<Map<Variable,​Integer>>

    public final class VariableProfileFunction
    extends Object
    implements FormulaFunction<Map<Variable,​Integer>>
    A function that computes the variable profile for a given formula, i.e. it counts the number of occurrences for each variable.

    For this function, the non-caching version is preferred since it usually performs better. The non-caching version of this function generates the result mapping only once and fills it recursively whereas the caching version has to construct a new mapping for each sub-formula.

    Since:
    1.0
    Version:
    2.3.0
    • Constructor Detail

      • VariableProfileFunction

        @Deprecated
        public VariableProfileFunction()
        Deprecated.
        In the next version, the standard constructor will be replaced by a private constructor. In order to instantiate an object of this class, use the get() method.
    • Method Detail

      • get

        public static VariableProfileFunction get()
        Returns the singleton instance of this function.
        Returns:
        an instance of this function
      • apply

        public Map<Variable,​Integer> apply​(Formula formula,
                                                 boolean cache)
        Description copied from interface: FormulaFunction
        Applies this function to a given formula.
        Specified by:
        apply in interface FormulaFunction<Map<Variable,​Integer>>
        Parameters:
        formula - the input formula
        cache - indicates whether the result should be cached in this formula's cache
        Returns:
        the result of the application