Class Inequation


public class Inequation extends Statement
This class models an inequation of two terms.
Author:
Matthias Thimm
  • Field Details

  • Constructor Details

    • Inequation

      public Inequation(Term leftTerm, Term rightTerm, int type)
      Creates a new inequation of the given type with the two terms.
      Parameters:
      leftTerm - a term.
      rightTerm - a term.
      type - the type of the inequality, one of Inequation.LESS, Inequation.LESS_EQUAL Inequation.GREATER, Inequation.GREATER_EQUAL, Inequation.UNEQUAL.
  • Method Details

    • replaceTerm

      public Statement replaceTerm(Term toSubstitute, Term substitution)
      Description copied from class: Statement
      Replaces each occurrence of "toSubstitute" by "substitution" and return the new statement.
      Specified by:
      replaceTerm in class Statement
      Parameters:
      toSubstitute - the term to be substituted
      substitution - the new term
      Returns:
      this statement where "toSubstitute" is replaced by "substitution"
    • getType

      public int getType()
      Returns the type of this inequation.
      Returns:
      the type of this inequation.
    • isNormalized

      public boolean isNormalized()
      Description copied from class: Statement
      Checks whether this constraint is of normalized form, i.e. whether it has the form "T > 0" or "T >= 0", "T = 0" or "T != 0"
      Specified by:
      isNormalized in class Statement
      Returns:
      "true" iff this constraint is normalized.
    • toNormalizedForm

      public Statement toNormalizedForm()
      Description copied from class: Statement
      Normalizes this constraint, i.e. brings it into an equivalent form "T > 0" or "T >= 0", "T = 0" or "T != 0".
      Specified by:
      toNormalizedForm in class Statement
      Returns:
      a statement.
    • toLinearForm

      public Statement toLinearForm()
      Description copied from class: Statement
      Brings both terms into linear form. If this constraint is normalized (i.e. the right term consists of the constant 0) the right term is not linearized.
      Specified by:
      toLinearForm in class Statement
      Returns:
      a statement.
    • getRelationSymbol

      public String getRelationSymbol()
      Description copied from class: Statement
      Returns the relation symbol of this statement.
      Specified by:
      getRelationSymbol in class Statement
      Returns:
      the relation symbol of this statement.
    • isValid

      public boolean isValid(Statement s)
      Description copied from class: Statement
      checks if a Statement fulfills the relation
      Specified by:
      isValid in class Statement
      Parameters:
      s - a Statement with values for all variables
      Returns:
      if the left and the right hand side are in the correct relation to each other