- java.lang.Object
-
- org.logicng.formulas.FormulaFactory
-
- org.logicng.formulas.ExtendedFormulaFactory
-
public class ExtendedFormulaFactory extends FormulaFactory
An extended version of the formula factory that allows saving and loading states to reduce memory usage.New formulas can only be generated by a formula factory. It is implemented s.t. it is guaranteed that equivalent formulas (in terms of associativity and commutativity) are hold exactly once in memory.
A formula factory is NOT thread-safe. If you generate formulas from more than one thread you either need to synchronize the formula factory yourself or you use a formula factory for each single thread.
- Since:
- 1.2
- Version:
- 2.3.2
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.logicng.formulas.FormulaFactory
FormulaFactory.FormulaFactoryStatistics
-
-
Field Summary
-
Fields inherited from class org.logicng.formulas.FormulaFactory
CC_PREFIX, CNF_PREFIX, PB_PREFIX
-
-
Constructor Summary
Constructors Constructor Description ExtendedFormulaFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all formulas from the factory cache.voidclearCaches()Clears the transformation, function, and PB encoding caches.voidload(FormulaFactoryState state)Loads a previously saved FormulaFactoryState.FormulaFactoryStatesave()Saves the FormulaFactoryState to be loaded later.-
Methods inherited from class org.logicng.formulas.FormulaFactory
amo, amo, and, and, binaryOperator, cc, cc, clause, clause, clearCaches, cnf, cnf, cnfEncoder, configurationFor, constant, equivalence, exo, exo, falsum, functionCacheEntry, implication, importFormula, isGeneratedVariable, literal, name, naryOperator, naryOperator, newCCVariable, newCNFVariable, newPBVariable, not, numberOfNodes, or, or, parse, pbc, pbc, pbEncoder, predicateCacheEntry, putConfiguration, setFunctionCacheEntry, setPredicateCacheEntry, setPredicateCacheEntry, setTransformationCacheEntry, statistics, string, string, stringRepresentation, subformulaFunction, toString, transformationCacheEntry, variable, variables, variables, verum
-
-
-
-
Method Detail
-
clear
public void clear()
Description copied from class:FormulaFactoryRemoves all formulas from the factory cache.- Overrides:
clearin classFormulaFactory
-
save
public FormulaFactoryState save()
Saves the FormulaFactoryState to be loaded later.- Returns:
- the FormulaFactoryState.
-
load
public void load(FormulaFactoryState state)
Loads a previously saved FormulaFactoryState. All formula factory states saved after the loaded one become invalid.- Parameters:
state- the FormulaFactoryState to be loaded- Throws:
IllegalArgumentException- if the FormulaFactoryState to be loaded is invalid
-
clearCaches
public void clearCaches()
Clears the transformation, function, and PB encoding caches.
-
-