Class MonomialTerm

java.lang.Object
org.oristool.math.expression.MonomialTerm
All Implemented Interfaces:
AtomicTerm

public final class MonomialTerm extends Object implements AtomicTerm
An atomic term of the form x^alpha.
  • Constructor Details

    • MonomialTerm

      public MonomialTerm(Variable variable, int alpha)
      Builds an instance for a given variable and exponent.
      Parameters:
      variable - variable of the monomial term
      alpha - exponent
  • Method Details

    • getVariable

      public Variable getVariable()
      Description copied from interface: AtomicTerm
      Returns the variable associated with the atomic term.
      Specified by:
      getVariable in interface AtomicTerm
      Returns:
      the associated variable
    • setVariable

      public void setVariable(Variable variable)
    • getAlpha

      public Integer getAlpha()
    • setAlpha

      public void setAlpha(int alpha)
    • multiply

      public void multiply(AtomicTerm term)
      Description copied from interface: AtomicTerm
      Multiplies with another term.
      Specified by:
      multiply in interface AtomicTerm
      Parameters:
      term - to be multiplied
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • duplicate

      public AtomicTerm duplicate()
      Description copied from interface: AtomicTerm
      Duplicates an atomic term.
      Specified by:
      duplicate in interface AtomicTerm
      Returns:
      a copy of this term
    • evaluate

      public OmegaBigDecimal evaluate(OmegaBigDecimal value)
      Description copied from interface: AtomicTerm
      Evaluates the atomic term substituting value to its variable.
      Specified by:
      evaluate in interface AtomicTerm
      Parameters:
      value - the value to be substituted to x
      Returns:
      the result of the evaluation
    • substitute

      public void substitute(Variable oldVar, Variable newVar)
      Description copied from interface: AtomicTerm
      Substitutes oldVar with newVar in the atomic term.
      Specified by:
      substitute in interface AtomicTerm
      Parameters:
      oldVar - variable to be substituted
      newVar - new variable
    • isOne

      public boolean isOne()
      Description copied from interface: AtomicTerm
      Checks if this term the constant 1.
      Specified by:
      isOne in interface AtomicTerm
      Returns:
      true if the term is one, false otherwise
    • toString

      public String toString()
      Overrides:
      toString in class Object