Class BinaryFunction

java.lang.Object
calculator.functions.BinaryFunction
All Implemented Interfaces:
Expression
Direct Known Subclasses:
Log

public abstract class BinaryFunction extends Object implements Expression
  • Field Details

    • symbol

      protected String symbol
  • Constructor Details

  • Method Details

    • op

      public abstract Atom op(Real r1, Real r2)
      Abstract method representing the actual function result of two reals
      Parameters:
      r1 - first Real of the binary operation
      r2 - second Real of the binary operation
      Returns:
      result of the function on two Reals
    • op

      public abstract Atom op(Complex c1, Complex c2)
      Abstract method representing the actual function result of two complexes
      Parameters:
      c1 - first Complex of the binary operation
      c2 - second Complex of the binary operation
      Returns:
      result of the function on two Complexes
    • op

      public abstract Atom op(IntegerAtom i1, IntegerAtom i2)
      Abstract method representing the actual function result of two integers
      Parameters:
      i1 - first Integer of the binary operation
      i2 - second Integer of the binary operation
      Returns:
      result of the function on two IntegerAtoms
    • op

      public abstract Atom op(Rationnal q1, Rationnal q2)
      Abstract method representing the actual function result of two Rationnals
      Parameters:
      q1 - first Rationnal of the binary operation
      q2 - second Rationnal of the binary operation
      Returns:
      result of the function on two Rationnals
    • accept

      public void accept(Visitor v)
      Accept method to implement the visitor design pattern to traverse arithmetic expressions.
      Specified by:
      accept in interface Expression
      Parameters:
      v - The visitor object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getSymbol

      public String getSymbol()
    • setSymbol

      public void setSymbol(String symbol)
    • getFirstArg

      public Expression getFirstArg()
    • setFirstArg

      public void setFirstArg(Expression firstArg)
    • getSecondArg

      public Expression getSecondArg()
    • setSecondArg

      public void setSecondArg(Expression secondArg)