Package org.apache.sling.scripting.sightly.compiler.expression.nodes

## Class TernaryOperator

- java.lang.Object
- - org.apache.sling.scripting.sightly.compiler.expression.nodes.TernaryOperator

All Implemented Interfaces:
  `ExpressionNode`

    public final class TernaryOperator
    extends Object
    implements ExpressionNode

Defines the HTL ternary operator (e.g. `condition ? then : else`).

### Constructor Summary

Constructors
`TernaryOperator​(ExpressionNode condition, ExpressionNode thenBranch, ExpressionNode elseBranch)` Creates the operator.

### Method Summary

All Methods Instance Methods Concrete Methods
`<T> T` `accept​(NodeVisitor<T> visitor)` Accept a visitor to process this node.
`ExpressionNode` `getCondition()` Returns the condition of this operator.
`ExpressionNode` `getElseBranch()` Returns the "else" branch.
`ExpressionNode` `getThenBranch()` Returns the "then" branch.
`String` `toString()`

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

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

### Constructor Detail

#### TernaryOperator

    public TernaryOperator​(ExpressionNode condition,
                           ExpressionNode thenBranch,
                           ExpressionNode elseBranch)

Creates the operator.

Parameters:
  `condition` - the operator's condition
  `thenBranch` - the "then" branch
  `elseBranch` - the "else" branch

### Method Detail

#### getCondition

    public ExpressionNode getCondition()

Returns the condition of this operator.

Returns:
  the condition of this operator

#### getThenBranch

    public ExpressionNode getThenBranch()

Returns the "then" branch.

Returns:
  the "then" branch

#### getElseBranch

    public ExpressionNode getElseBranch()

Returns the "else" branch.

Returns:
  the "else" branch

#### accept

    public <T> T accept​(NodeVisitor<T> visitor)

Description copied from interface: `ExpressionNode`
Accept a visitor to process this node.

Specified by:
  `accept` in interface `ExpressionNode`
Type Parameters:
  `T` - the type of the visitor
Parameters:
  `visitor` - The visitor
Returns:
  the node after it has been evaluated by the visitor

#### toString

    public String toString()

Overrides:
  `toString` in class `Object`