Module logicng

Class 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
    • Constructor Detail

      • ExtendedFormulaFactory

        public ExtendedFormulaFactory()
    • Method Detail

      • 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.