public static Object pow(Object left, Object right) { return InfixOpNode.math(left, right, null, (l, r) -> BigDecimalMath.pow(l, r, MathContext.DECIMAL128)); }
public static Object div(Object left, Object right, EvaluationContext ctx) { if ( left == null || right == null ) { return null; } else if ( left instanceof Duration && right instanceof Number ) { return ((Duration)left).dividedBy( ((Number) right).longValue() ); } else if ( left instanceof Number && right instanceof Duration ) { return Duration.ofSeconds( EvalHelper.getBigDecimalOrNull( left ).divide( EvalHelper.getBigDecimalOrNull( ((Duration)right).getSeconds() ), MathContext.DECIMAL128 ).longValue() ); } else if ( left instanceof Duration && right instanceof Duration ) { return EvalHelper.getBigDecimalOrNull( ((Duration) left).getSeconds() ).divide( EvalHelper.getBigDecimalOrNull( ((Duration)right).getSeconds() ), MathContext.DECIMAL128 ); } else if ( left instanceof Period && right instanceof Number ) { return Period.ofMonths( EvalHelper.getBigDecimalOrNull( ((Period)left).toTotalMonths() ).divide( EvalHelper.getBigDecimalOrNull( ((Number) right).longValue() ), MathContext.DECIMAL128 ).intValue() ); } else if ( left instanceof Number && right instanceof Period ) { return Period.ofMonths( EvalHelper.getBigDecimalOrNull( left ).divide( EvalHelper.getBigDecimalOrNull( ((Period)right).toTotalMonths() ), MathContext.DECIMAL128 ).intValue() ); } else if ( left instanceof Period && right instanceof Period ) { return EvalHelper.getBigDecimalOrNull( ((Period) left).toTotalMonths() ).divide( EvalHelper.getBigDecimalOrNull( ((Period)right).toTotalMonths() ), MathContext.DECIMAL128 ); } else { return math( left, right, ctx, (l, r) -> l.divide( r, MathContext.DECIMAL128 ) ); } }
public static Object mult(Object left, Object right, EvaluationContext ctx) { if ( left == null || right == null ) { return null; } else if ( left instanceof Duration && right instanceof Number ) { return ((Duration)left).multipliedBy( ((Number) right).longValue() ); } else if ( left instanceof Number && right instanceof Duration ) { return Duration.ofSeconds( EvalHelper.getBigDecimalOrNull( left ).multiply( EvalHelper.getBigDecimalOrNull( ((Duration)right).getSeconds() ), MathContext.DECIMAL128 ).longValue() ); } else if ( left instanceof Duration && right instanceof Duration ) { return EvalHelper.getBigDecimalOrNull( ((Duration) left).getSeconds() ).multiply( EvalHelper.getBigDecimalOrNull( ((Duration)right).getSeconds() ), MathContext.DECIMAL128 ); } else if ( left instanceof Period && right instanceof Number ) { return Period.ofMonths( EvalHelper.getBigDecimalOrNull( ((Period)left).toTotalMonths() ).multiply( EvalHelper.getBigDecimalOrNull( ((Number) right).longValue() ), MathContext.DECIMAL128 ).intValue() ); } else if ( left instanceof Number && right instanceof Period ) { return Period.ofMonths( EvalHelper.getBigDecimalOrNull( left ).multiply( EvalHelper.getBigDecimalOrNull( ((Period)right).toTotalMonths() ), MathContext.DECIMAL128 ).intValue() ); } else if ( left instanceof Period && right instanceof Period ) { return EvalHelper.getBigDecimalOrNull( ((Period) left).toTotalMonths() ).multiply( EvalHelper.getBigDecimalOrNull( ((Period)right).toTotalMonths() ), MathContext.DECIMAL128 ); } else { return math( left, right, ctx, (l, r) -> l.multiply( r, MathContext.DECIMAL128 ) ); } }
return ((OffsetTime) left).minus( (Duration) right); } else { return math( left, right, ctx, (l, r) -> l.subtract( r, MathContext.DECIMAL128 ) );
return div( left, right, ctx ); case POW: return math( left, right, ctx, (l, r) -> BigDecimalMath.pow( l, r, MathContext.DECIMAL128 ) ); case AND: return and( left, right, ctx );
return ((OffsetTime) right).plus( (Duration) left); } else { return math( left, right, ctx, (l, r) -> l.add( r, MathContext.DECIMAL128 ) );