Class Atom

  • All Implemented Interfaces:
    Formula

    public class Atom
    extends java.lang.Object
    implements Formula
    Represents an atom, a proposition.
    • Constructor Summary

      Constructors 
      Constructor Description
      Atom​(java.lang.String predicate)
      Default constructor of the atom.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(Formula otherFormula)
      Returns true if this formula contains the specified formula.
      boolean equals​(java.lang.Object other)
      Verifies if the current object formula and other formula are the same.
      boolean evaluate​(LogicAssignment assignment)
      Evaluates a state that we passed into arguments.
      Formula getNegation()
      Returns the negation of the current formula.
      int hashCode()  
      Formula simplify()
      Simplifies the logic formula.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Atom

        public Atom​(java.lang.String predicate)
        Default constructor of the atom.
        Parameters:
        predicate - proposition predicate
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Description copied from interface: Formula
        Verifies if the current object formula and other formula are the same.
        Specified by:
        equals in interface Formula
        Overrides:
        equals in class java.lang.Object
        Parameters:
        other - other formula to test the equality
        Returns:
        result of the equality test
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • simplify

        public Formula simplify()
        Description copied from interface: Formula
        Simplifies the logic formula.
        Specified by:
        simplify in interface Formula
        Returns:
        simplified formula
      • getNegation

        public Formula getNegation()
        Description copied from interface: Formula
        Returns the negation of the current formula.
        Specified by:
        getNegation in interface Formula
        Returns:
        negation of formula
      • contains

        public boolean contains​(Formula otherFormula)
        Description copied from interface: Formula
        Returns true if this formula contains the specified formula.
        Specified by:
        contains in interface Formula
        Parameters:
        otherFormula - other formula whose presence in this formula is to be tested
        Returns:
        true if this formula contains the specified formula
      • evaluate

        public boolean evaluate​(LogicAssignment assignment)
                         throws java.lang.Exception
        Description copied from interface: Formula
        Evaluates a state that we passed into arguments.
        Specified by:
        evaluate in interface Formula
        Parameters:
        assignment - state to evaluate
        Returns:
        result of the evaluation
        Throws:
        java.lang.Exception - throws when the formula not supported this operation or expected object not given