Module logicng

Class FormulaStringRepresentation

    • Constructor Detail

      • FormulaStringRepresentation

        public FormulaStringRepresentation()
    • Method Detail

      • toString

        public String toString​(Formula formula)
        Returns the string representation of the given formula.

        In order to add a prefix/suffix or do one-time calculations on the formula it is recommended to overwrite this method in subclasses.

        Parameters:
        formula - the formula
        Returns:
        the string representation of the formula
      • toInnerString

        protected String toInnerString​(Formula formula)
        Returns the string representation of the given formula.

        This method is used for recursive calls in order to format the sub-formulas.

        Parameters:
        formula - the formula
        Returns:
        the string representation of the formula
      • bracket

        protected String bracket​(Formula formula)
        Returns a bracketed string version of a given formula.
        Parameters:
        formula - the formula
        Returns:
        "(" + formula.toString() + ")"
      • binaryOperator

        protected String binaryOperator​(BinaryOperator operator,
                                        String opString)
        Returns the string representation of a binary operator.
        Parameters:
        operator - the binary operator
        opString - the operator string
        Returns:
        the string representation
      • naryOperator

        protected String naryOperator​(NAryOperator operator,
                                      String opString)
        Returns the string representation of an n-ary operator.
        Parameters:
        operator - the n-ary operator
        opString - the operator string
        Returns:
        the string representation
      • pbLhs

        protected String pbLhs​(Literal[] operands,
                               int[] coefficients)
        Returns the string representation of the left-hand side of a pseudo-Boolean constraint.
        Parameters:
        operands - the literals of the constraint
        coefficients - the coefficients of the constraint
        Returns:
        the string representation
      • falsum

        protected abstract String falsum()
        Returns the string representation of false.
        Returns:
        the string representation of false
      • verum

        protected abstract String verum()
        Returns the string representation of true.
        Returns:
        the string representation of true
      • negation

        protected abstract String negation()
        Returns the string representation of not.
        Returns:
        the string representation of not
      • implication

        protected abstract String implication()
        Returns the string representation of an implication.
        Returns:
        the string representation of an implication
      • equivalence

        protected abstract String equivalence()
        Returns the string representation of an equivalence.
        Returns:
        the string representation of an equivalence
      • and

        protected abstract String and()
        Returns the string representation of and.
        Returns:
        the string representation of and
      • or

        protected abstract String or()
        Returns the string representation of or.
        Returns:
        the string representation of or
      • pbComparator

        protected abstract String pbComparator​(CType comparator)
        Returns the string representation of a pseudo-Boolean comparator.
        Parameters:
        comparator - the pseudo-Boolean comparator
        Returns:
        the string representation of a pseudo-Boolean comparator
      • pbMul

        protected abstract String pbMul()
        Returns the string representation of a pseudo-Boolean multiplication.
        Returns:
        the string representation of a pseudo-Boolean multiplication
      • pbAdd

        protected abstract String pbAdd()
        Returns the string representation of a pseudo-Boolean addition.
        Returns:
        the string representation of a pseudo-Boolean addition
      • lbr

        protected abstract String lbr()
        Returns the string representation of a left bracket.
        Returns:
        the string representation of a left bracket
      • rbr

        protected abstract String rbr()
        Returns the string representation of right bracket.
        Returns:
        the string representation of right bracket