Class OperatorExpression

    • Constructor Summary

      Constructors 
      Constructor Description
      OperatorExpression​(java.lang.String operator)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object add​(java.lang.Object[] numbers)
      Add of the specified numbers
      java.lang.Object divide​(java.lang.Object[] numbers)
      Divide of the specified numbers
      java.lang.Object evaluate​(java.lang.Object[] numbers)
      Math evaluate
      int getArgumentCount​()
      Get the number of arguments this expression uses
      static boolean isSymbol​(char c)
      Determines whether the specified char is a math symbol
      static boolean isSymbol​(java.lang.String s)
      Determines whether the specified string is a math symbol
      java.lang.Object multiple​(java.lang.Object[] numbers)
      Multiple of the specified numbers
      java.lang.Object power​(java.lang.Object[] numbers)
      Power of the specified numbers
      java.lang.Object subtract​(java.lang.Object[] numbers)
      Subtract of the specified numbers
      java.lang.String toString​()  
      • Methods inherited from class java.lang.Object

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

      • OperatorExpression

        public OperatorExpression​(java.lang.String operator)
    • Method Detail

      • evaluate

        public java.lang.Object evaluate​(java.lang.Object[] numbers)
        Description copied from interface: IExpression
        Math evaluate
        Parameters:
        numbers - The numbers to evaluate
        Returns:
        The result of the evaluated numbers
      • add

        public java.lang.Object add​(java.lang.Object[] numbers)
        Add of the specified numbers
        Parameters:
        numbers - The numbers
        Returns:
        The result of the operation
      • subtract

        public java.lang.Object subtract​(java.lang.Object[] numbers)
        Subtract of the specified numbers
        Parameters:
        numbers - The numbers
        Returns:
        The result of the operation
      • multiple

        public java.lang.Object multiple​(java.lang.Object[] numbers)
        Multiple of the specified numbers
        Parameters:
        numbers - The numbers
        Returns:
        The result of the operation
      • divide

        public java.lang.Object divide​(java.lang.Object[] numbers)
        Divide of the specified numbers
        Parameters:
        numbers - The numbers
        Returns:
        The result of the operation
      • power

        public java.lang.Object power​(java.lang.Object[] numbers)
        Power of the specified numbers
        Parameters:
        numbers - The numbers
        Returns:
        The result of the operation
      • isSymbol

        public static boolean isSymbol​(java.lang.String s)
        Determines whether the specified string is a math symbol
        Parameters:
        s - The string to check
        Returns:
        If the string is a math symbol
      • isSymbol

        public static boolean isSymbol​(char c)
        Determines whether the specified char is a math symbol
        Parameters:
        c - The char to check
        Returns:
        If the char is a math symbol
      • toString

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