- java.lang.Object
-
- org.logicng.formulas.FormulaFactoryConfig.Builder
-
- Enclosing class:
- FormulaFactoryConfig
public static class FormulaFactoryConfig.Builder extends Object
The builder for a formula factory configuration.- Since:
- 2.0.0
- Version:
- 2.0.0
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FormulaFactoryConfigbuild()Builds the configuration.FormulaFactoryConfig.BuilderformulaMergeStrategy(FormulaFactoryConfig.FormulaMergeStrategy formulaMergeStrategy)Sets the strategy defining how to proceed if one or more operands of a formula were created by another formula factory.FormulaFactoryConfig.Buildername(String name)Sets the name of this formula factory.FormulaFactoryConfig.BuildersimplifyComplementaryOperands(boolean simplifyComplementaryOperands)Sets the flag whether trivial contradictions and tautologies are simplified in formulas.FormulaFactoryConfig.BuilderstringRepresentation(Supplier<FormulaStringRepresentation> stringRepresentation)Sets the formula string representation which should be used by default for creating strings from a formula.
-
-
-
Method Detail
-
name
public FormulaFactoryConfig.Builder name(String name)
Sets the name of this formula factory. The default is an empty string.Setting a name is only useful when multiple formula factories are used in the same context. The name is used to create individual names for generated variables s.t. the generated variables of different formula factories will not clash.
- Parameters:
name- the name- Returns:
- the builder
-
formulaMergeStrategy
public FormulaFactoryConfig.Builder formulaMergeStrategy(FormulaFactoryConfig.FormulaMergeStrategy formulaMergeStrategy)
Sets the strategy defining how to proceed if one or more operands of a formula were created by another formula factory. The default value isFormulaFactoryConfig.FormulaMergeStrategy.PANIC.- Parameters:
formulaMergeStrategy- the strategy- Returns:
- the builder
-
stringRepresentation
public FormulaFactoryConfig.Builder stringRepresentation(Supplier<FormulaStringRepresentation> stringRepresentation)
Sets the formula string representation which should be used by default for creating strings from a formula. The default isDefaultStringRepresentation.- Parameters:
stringRepresentation- the formula string representation- Returns:
- the builder
-
simplifyComplementaryOperands
public FormulaFactoryConfig.Builder simplifyComplementaryOperands(boolean simplifyComplementaryOperands)
Sets the flag whether trivial contradictions and tautologies are simplified in formulas. If set to false, a formula likeA & ~AorA | ~Acan be generated on the formula factory. If set to true, the formulas will be simplified to$falseortruerespectively. The default istrue.- Parameters:
simplifyComplementaryOperands- the flag whether to simplify trivial contradictions and tautologies or not- Returns:
- the builder
-
build
public FormulaFactoryConfig build()
Builds the configuration.- Returns:
- the configuration.
-
-