- java.lang.Object
-
- org.logicng.functions.LiteralProfileFunction
-
- All Implemented Interfaces:
FormulaFunction<Map<Literal,Integer>>
public final class LiteralProfileFunction extends Object implements FormulaFunction<Map<Literal,Integer>>
A function that computes the literal profile for a given formula, i.e. it counts the number of occurrences for each literal.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 Summary
Constructors Constructor Description LiteralProfileFunction()Deprecated.In the next version, the standard constructor will be replaced by a private constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<Literal,Integer>apply(Formula formula, boolean cache)Applies this function to a given formula.static LiteralProfileFunctionget()Returns the singleton instance of this function.
-
-
-
Constructor Detail
-
LiteralProfileFunction
@Deprecated public LiteralProfileFunction()
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 theget()method.
-
-
Method Detail
-
get
public static LiteralProfileFunction get()
Returns the singleton instance of this function.- Returns:
- an instance of this function
-
apply
public Map<Literal,Integer> apply(Formula formula, boolean cache)
Description copied from interface:FormulaFunctionApplies this function to a given formula.- Specified by:
applyin interfaceFormulaFunction<Map<Literal,Integer>>- Parameters:
formula- the input formulacache- indicates whether the result should be cached in this formula's cache- Returns:
- the result of the application
-
-