Documentation of 'jhplot.math.exp4j.operator.Operator' Java class.
Operator
jhplot.math.exp4j.operator

Class Operator



  • public abstract class Operator
    extends java.lang.Object
    Class representing operators that can be used in an expression
    • Field Detail

      • PRECEDENCE_ADDITION

        public static final int PRECEDENCE_ADDITION
        The precedence value for the addition operation
        See Also:
        Constant Field Values
      • PRECEDENCE_SUBTRACTION

        public static final int PRECEDENCE_SUBTRACTION
        The precedence value for the subtraction operation
        See Also:
        Constant Field Values
      • PRECEDENCE_MULTIPLICATION

        public static final int PRECEDENCE_MULTIPLICATION
        The precedence value for the multiplication operation
        See Also:
        Constant Field Values
      • PRECEDENCE_DIVISION

        public static final int PRECEDENCE_DIVISION
        The precedence value for the division operation
        See Also:
        Constant Field Values
      • PRECEDENCE_MODULO

        public static final int PRECEDENCE_MODULO
        The precedence value for the modulo operation
        See Also:
        Constant Field Values
      • PRECEDENCE_POWER

        public static final int PRECEDENCE_POWER
        The precedence value for the power operation
        See Also:
        Constant Field Values
      • PRECEDENCE_UNARY_MINUS

        public static final int PRECEDENCE_UNARY_MINUS
        The precedence value for the unary minus operation
        See Also:
        Constant Field Values
      • PRECEDENCE_UNARY_PLUS

        public static final int PRECEDENCE_UNARY_PLUS
        The precedence value for the unary plus operation
        See Also:
        Constant Field Values
      • ALLOWED_OPERATOR_CHARS

        public static final char[] ALLOWED_OPERATOR_CHARS
        The set of allowed operator chars
    • Constructor Detail

      • Operator

        public Operator(java.lang.String symbol,
                        int numberOfOperands,
                        boolean leftAssociative,
                        int precedence)
        Create a new operator for use in expressions
        Parameters:
        symbol - the symbol of the operator
        numberOfOperands - the number of operands the operator takes (1 or 2)
        leftAssociative - set to true if the operator is left associative, false if it is right associative
        precedence - the precedence value of the operator
    • Method Detail

      • isAllowedOperatorChar

        public static boolean isAllowedOperatorChar(char ch)
        Check if a character is an allowed operator char
        Parameters:
        ch - the char to check
        Returns:
        true if the char is allowed an an operator symbol, false otherwise
      • isLeftAssociative

        public boolean isLeftAssociative()
        Check if the operator is left associative
        Returns:
        true os the operator is left associative, false otherwise
      • getPrecedence

        public int getPrecedence()
        Check the precedence value for the operator
        Returns:
        the precedence value
      • apply

        public abstract double apply(double... args)
        Apply the operation on the given operands
        Parameters:
        args - the operands for the operation
        Returns:
        the calculated result of the operation
      • getSymbol

        public java.lang.String getSymbol()
        Get the operator symbol
        Returns:
        the symbol
      • getNumOperands

        public int getNumOperands()
        Get the number of operands
        Returns:
        the number of operands

DMelt 3.0 © DataMelt by jWork.ORG