code: public Formula encode(final Formula formula) {
      switch (this.config().algorithm) {
        case FACTORIZATION:
          if (this.factorization == null)
            this.factorization = new CNFFactorization();
          return formula.transform(this.factorization);
        case TSEITIN:
          if (this.tseitin == null || this.currentAtomBoundary != this.config().atomBoundary) {
            this.currentAtomBoundary = this.config().atomBoundary;
            this.tseitin = new TseitinTransformation(this.config().atomBoundary);
          }
          return formula.transform(this.tseitin);
        case PLAISTED_GREENBAUM:
          if (this.plaistedGreenbaum == null || this.currentAtomBoundary != this.config().atomBoundary) {
            this.currentAtomBoundary = this.config().atomBoundary;
            this.plaistedGreenbaum = new PlaistedGreenbaumTransformation(this.config().atomBoundary);
          }
          return formula.transform(this.plaistedGreenbaum);
        case BDD:
          if (this.bddCnfTransformation == null)
            this.bddCnfTransformation = new BDDCNFTransformation();
          return formula.transform(this.bddCnfTransformation);
        case ADVANCED:
          if (this.factorizationHandler == null) {
            this.factorizationHandler = new AdvancedFactorizationHandler();
            this.advancedFactorization = new CNFFactorization(this.factorizationHandler);
          }
          this.factorizationHandler.reset(this.config().distributionBoundary, this.config().createdClauseBoundary);
          return this.advancedEncoding(formula);
        default:
          throw new IllegalStateException("Unknown CNF encoding algorithm: " + this.config().algorithm);
      }
    }
docs: Encodes a formula to CNF.
  @param formula formula
  @return the CNF encoding of the formula