Class ComplexLogicalFormulaAdapter

  • All Implemented Interfaces:
    net.sf.tweety.commons.Formula, ComplexLogicalFormula, LogicStructure, SimpleLogicalFormula
    Direct Known Subclasses:
    AssociativeFormulaSupport

    public abstract class ComplexLogicalFormulaAdapter
    extends Object
    implements ComplexLogicalFormula
    Abstract base class for ComplexLogicalFormula, that are formulas which implement substitute(), exchange(), getTerms(), isGround() and isWellFormed() and therefore use terms to describe themself. It also implements the isLiteral method and returns false as default behavior sub classes needing another behavior shall override this method
    Author:
    Tim Janus
    • Constructor Detail

      • ComplexLogicalFormulaAdapter

        public ComplexLogicalFormulaAdapter()
    • Method Detail

      • getTerms

        public <C extends Term<?>> Set<C> getTerms​(Class<C> cls)
        Description copied from interface: LogicStructure
        Processes the set containing all terms of type C. This method uses the equals method of the given Class and therefore does not add terms which are sub classes of type C to the set.
        Specified by:
        getTerms in interface LogicStructure
        Type Parameters:
        C - the type of terms
        Parameters:
        cls - The Class structure containing type information about the searched term
        Returns:
        A set containing all terms of type C of this logical structure
      • containsTermsOfType

        public <C extends Term<?>> boolean containsTermsOfType​(Class<C> cls)
        Description copied from interface: LogicStructure
        Checks if this logical structure contains at least one term of type C. This method is a shortcut for !getTerms(TermImplementation.class).isEmpty().
        Specified by:
        containsTermsOfType in interface LogicStructure
        Type Parameters:
        C - the type of terms
        Parameters:
        cls - The class structure representing the type C of the term.
        Returns:
        True if this logical structure contains at least one term of type C or false otherwise.
      • isGround

        public boolean isGround()
        Description copied from interface: ComplexLogicalFormula
        Checks whether this formula is ground, i.e. whether there appears no variable in this formula.
        Specified by:
        isGround in interface ComplexLogicalFormula
        Returns:
        "true" if this formula is ground.
      • isWellFormed

        public boolean isWellFormed()
        Description copied from interface: ComplexLogicalFormula
        Checks if this formula is well formed in the logical langauge. What well- formed means is highly language dependent and the documentation of implementing sub classes shall describe the well formed term for the language they model.
        Specified by:
        isWellFormed in interface ComplexLogicalFormula
        Returns:
        true if the formula is well-formed, false otherwise
      • isLiteral

        public boolean isLiteral()
        Specified by:
        isLiteral in interface SimpleLogicalFormula
        Returns:
        true if the formula represents a literal in the language or false otherwise