Class Inequality

  • All Implemented Interfaces:
    IGroundable, java.io.Serializable, java.lang.Cloneable

    public class Inequality
    extends Substitution
    implements IGroundable, java.io.Serializable
    Represents the condition that a variable cannot have a specified value.
    Author:
    Joao Dias
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Inequality​(Substitution subst)
      Creates a new Inequality Condition from an existing Substitution (by negating the Substitution)
      Inequality​(Symbol var, Symbol value)
      Creates a new Inequality Condition of the type [x]!=4
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Creates a new copy, which is initially equal to this inequality.
      boolean isGrounded()
      Indicates if the Inequality is grounded (no unbound variables in it's WFN) Example: 2 != 4 is grounded while [x] != 4 is not.
      void MakeGround​(Substitution subst)
      Applies a set of substitutions to the object, grounding it.
      void MakeGround​(java.util.ArrayList<Substitution> substs)
      Applies a set of substitutions to the object, grounding it.
      void ReplaceUnboundVariables​(int id)
      Replaces all unbound variables in the object by applying a numeric identifier to each one.
      java.lang.String toString()
      Converts the inequality to a String
      • Methods inherited from class java.lang.Object

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

      • Inequality

        public Inequality​(Symbol var,
                          Symbol value)
        Creates a new Inequality Condition of the type [x]!=4
        Parameters:
        var - - the variable to be constrained
        value - - the value that the variable cannot have
      • Inequality

        public Inequality​(Substitution subst)
        Creates a new Inequality Condition from an existing Substitution (by negating the Substitution)
        Parameters:
        subst - - the Substitution to be negated
        See Also:
        Substitution
    • Method Detail

      • ReplaceUnboundVariables

        public void ReplaceUnboundVariables​(int id)
        Replaces all unbound variables in the object by applying a numeric identifier to each one. For example, the variable [x] becomes [x4] if the received ID is 4. Attention, this method modifies the original object.
        Specified by:
        ReplaceUnboundVariables in interface IGroundable
        Parameters:
        id - - the identifier to be applied
      • MakeGround

        public void MakeGround​(java.util.ArrayList<Substitution> substs)
        Description copied from interface: IGroundable
        Applies a set of substitutions to the object, grounding it. Example: Applying the substitution "[X]/John" in the name "Weak([X])" returns "Weak(John)". Attention, this method modifies the original object.
        Specified by:
        MakeGround in interface IGroundable
        Parameters:
        substs - - A list of substitutions of the type "[Variable]/value"
        See Also:
        Substitution
      • MakeGround

        public void MakeGround​(Substitution subst)
        Applies a set of substitutions to the object, grounding it. Example: Applying the substitution "[X]/John" in the name "Weak([X])" returns "Weak(John)". Attention, this method modifies the original object.
        Specified by:
        MakeGround in interface IGroundable
        Parameters:
        subst - - a substitution of the type "[Variable]/value"
        See Also:
        Substitution
      • isGrounded

        public boolean isGrounded()
        Indicates if the Inequality is grounded (no unbound variables in it's WFN) Example: 2 != 4 is grounded while [x] != 4 is not.
        Specified by:
        isGrounded in interface IGroundable
        Returns:
        true if the Inequality is grounded, false otherwise
      • clone

        public java.lang.Object clone()
        Creates a new copy, which is initially equal to this inequality. If the new inequality changes, the original object remains the same.
        Overrides:
        clone in class Substitution
        Returns:
        the new created Inequality
      • toString

        public java.lang.String toString()
        Converts the inequality to a String
        Overrides:
        toString in class Substitution
        Returns:
        the converted String