Package org.apache.sling.scripting.sightly.impl.compiler.optimization.reduce

## Class ExpressionReducer

- java.lang.Object
- - org.apache.sling.scripting.sightly.impl.compiler.optimization.reduce.ExpressionReducer

All Implemented Interfaces:
  `NodeVisitor<EvalResult>`

    public class ExpressionReducer
    extends Object
    implements NodeVisitor<EvalResult>

Try to evaluate constant parts in expressions

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`EvalResult` `evaluate​(ArrayLiteral arrayLiteral)` Evaluate a `ArrayLiteral` node.
`EvalResult` `evaluate​(BinaryOperation binaryOperation)` Evaluate a `BinaryOperation` node.
`EvalResult` `evaluate​(BooleanConstant booleanConstant)` Evaluate a `BooleanConstant` node.
`EvalResult` `evaluate​(Identifier identifier)` Evaluate an `Identifier` node.
`EvalResult` `evaluate​(MapLiteral mapLiteral)` Evaluate a `MapLiteral` node.
`EvalResult` `evaluate​(NullLiteral nullLiteral)` Evaluate a `NullLiteral` node.
`EvalResult` `evaluate​(NumericConstant numericConstant)` Evaluate a `NumericConstant` node.
`EvalResult` `evaluate​(PropertyAccess propertyAccess)` Evaluate a `PropertyAccess` node.
`EvalResult` `evaluate​(RuntimeCall runtimeCall)` Evaluate a `RuntimeCall` node.
`EvalResult` `evaluate​(StringConstant text)` Evaluate a `StringConstant` node.
`EvalResult` `evaluate​(TernaryOperator ternaryOperator)` Evaluate a `TernaryOperator` node.
`EvalResult` `evaluate​(UnaryOperation unaryOperation)` Evaluate a `UnaryOperation` node.
`static EvalResult` `reduce​(ExpressionNode node, VariableTracker<EvalResult> tracker)`

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

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

### Method Detail

#### reduce

    public static EvalResult reduce​(ExpressionNode node,
                                    VariableTracker<EvalResult> tracker)

#### evaluate

    public EvalResult evaluate​(PropertyAccess propertyAccess)

Description copied from interface: `NodeVisitor`
Evaluate a `PropertyAccess` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `propertyAccess` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(Identifier identifier)

Description copied from interface: `NodeVisitor`
Evaluate an `Identifier` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `identifier` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(StringConstant text)

Description copied from interface: `NodeVisitor`
Evaluate a `StringConstant` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `text` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(BinaryOperation binaryOperation)

Description copied from interface: `NodeVisitor`
Evaluate a `BinaryOperation` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `binaryOperation` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(BooleanConstant booleanConstant)

Description copied from interface: `NodeVisitor`
Evaluate a `BooleanConstant` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `booleanConstant` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(NumericConstant numericConstant)

Description copied from interface: `NodeVisitor`
Evaluate a `NumericConstant` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `numericConstant` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(UnaryOperation unaryOperation)

Description copied from interface: `NodeVisitor`
Evaluate a `UnaryOperation` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `unaryOperation` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(TernaryOperator ternaryOperator)

Description copied from interface: `NodeVisitor`
Evaluate a `TernaryOperator` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `ternaryOperator` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(RuntimeCall runtimeCall)

Description copied from interface: `NodeVisitor`
Evaluate a `RuntimeCall` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `runtimeCall` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(MapLiteral mapLiteral)

Description copied from interface: `NodeVisitor`
Evaluate a `MapLiteral` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `mapLiteral` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(ArrayLiteral arrayLiteral)

Description copied from interface: `NodeVisitor`
Evaluate a `ArrayLiteral` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `arrayLiteral` - the node to evaluate
Returns:
  the evaluation result

#### evaluate

    public EvalResult evaluate​(NullLiteral nullLiteral)

Description copied from interface: `NodeVisitor`
Evaluate a `NullLiteral` node.

Specified by:
  `evaluate` in interface `NodeVisitor<EvalResult>`
Parameters:
  `nullLiteral` - the node to evaluate
Returns:
  the evaluation result