com.singularsys.jep.configurableparser

## Class TernaryOperator

- java.lang.Object
- - com.singularsys.jep.Operator
  - - com.singularsys.jep.configurableparser.TernaryOperator

- All Implemented Interfaces:
    java.io.Serializable

      public class TernaryOperator
      extends Operator

  A class representing a ternary operator, for example x?y:z. These are represented by a linked pair of operators, a `TernaryOperator` and the inner class `RhsTernaryOperator`.
  Author:
    Richard Morris
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `TernaryOperator.RhsTernaryOperator` Inner class used to represent the right hand operator.

  - ### Field Summary

    - ### Fields inherited from class com.singularsys.jep.Operator

      `ASSOCIATIVE, BINARY, COMMUTATIVE, COMPOSITE, EQUIVALENCE, flags, key, LEFT, name, NARY, NO_ARGS, NOT_IN_PARSER, pfmc, precedence, PREFIX, printSymbol, REFLEXIVE, RIGHT, SELF_INVERSE, SUFFIX, symbol, SYMMETRIC, TERNARY, TRANSITIVE, UNARY, USE_BINDING_FOR_PRINT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TernaryOperator(java.lang.String name, java.lang.String lhsSymbol, java.lang.String rhsSymbol, PostfixMathCommandI pfmc, int flags)` Create a Ternary operator.
    `TernaryOperator(java.lang.String name, java.lang.String lhsSymbol, java.lang.String rhsSymbol, PostfixMathCommandI pfmc, int flags, int precedence)` Create a Ternary operator

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TernaryOperator.RhsTernaryOperator` | `getRhsOperator()`
    `java.lang.String` | `getRhsSymbol()` Get symbol used to for righthand operator
    `void` | `setPrecedence(int i)` Set the precedence of the operator.

    - ### Methods inherited from class com.singularsys.jep.Operator

      `addAltSymbol, getAltSymbols, getBinaryInverseOp, getBinding, getFlags, getInverseOp, getKey, getName, getPFMC, getPrecedence, getPrintSymbol, getRootOp, getSymbol, isAssociative, isBinary, isCommutative, isComposite, isDistributiveOver, isEquivalence, isLeftBinding, isNary, isPrefix, isReflexive, isRightBinding, isSelfInverse, isSuffix, isSymmetric, isTernary, isTransitive, isUnary, notInParser, numArgs, setBinaryInverseOp, setDistributiveOver, setFlag, setInverseOp, setKey, setPFMC, setPrintSymbol, setRootOp, setSymbol, toFullString, toString, useBindingForPrint`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### TernaryOperator

          public TernaryOperator(java.lang.String name,
                                 java.lang.String lhsSymbol,
                                 java.lang.String rhsSymbol,
                                 PostfixMathCommandI pfmc,
                                 int flags)

      Create a Ternary operator. Precedence level set later.
      Parameters:
        `name` - verbose name for operator
        `lhsSymbol` - symbol for left hand operator, typically "?"
        `rhsSymbol` - symbol for right hand operator, typically ":"
        `pfmc` - function implementing the operation, typically `TernaryConditional`
        `flags` - status flags, typically `Operator.TERNARY`

    - #### TernaryOperator

          public TernaryOperator(java.lang.String name,
                                 java.lang.String lhsSymbol,
                                 java.lang.String rhsSymbol,
                                 PostfixMathCommandI pfmc,
                                 int flags,
                                 int precedence)

      Create a Ternary operator
      Parameters:
        `name` - verbose name for operator
        `lhsSymbol` - symbol for left hand operator, typically "?"
        `rhsSymbol` - symbol for right hand operator, typically ":"
        `pfmc` - function implementing the operation, typically `TernaryConditional`
        `flags` - status flags, typically `Operator.TERNARY`
        `precedence` - precedence level

  - ### Method Detail

    - #### getRhsSymbol

          public java.lang.String getRhsSymbol()

      Get symbol used to for righthand operator
      Returns:
        the symbol

    - #### getRhsOperator

          public TernaryOperator.RhsTernaryOperator getRhsOperator()

    - #### setPrecedence

          public void setPrecedence(int i)

      Description copied from class: `Operator`
      Set the precedence of the operator. Lower values correspond to tighter binding, that is * gives a lower value than + and 1+2*3 is 1+(2*3).
      Overrides:
        `setPrecedence` in class `Operator`
      Parameters:
        `i` - the precedence

Copyright © 2018 Singular Systems http://www.singularsys.com/jep