UnaryOperation() public static method

public static UnaryOperation ( $UnaryOperator, parent $OperandExpression ) : UnaryOperationExpression
$OperandExpression parent
return UnaryOperationExpression
示例#1
0
 public function MapUnaryOperationExpression($UnaryOperator, CoreExpression $OperandExpression)
 {
     switch ($UnaryOperator) {
         case O\Unary::Increment:
             return new E\BinaryOperationExpression($OperandExpression, O\Binary::Addition, new EE\ConstantExpression(1));
         case O\Unary::Decrement:
             return new E\BinaryOperationExpression($OperandExpression, O\Binary::Subtraction, new EE\ConstantExpression(1));
         case O\Unary::PreIncrement:
             return new E\BinaryOperationExpression(new EE\ConstantExpression(1), O\Binary::Addition, $OperandExpression);
         case O\Unary::PreDecrement:
             return new E\BinaryOperationExpression(new EE\ConstantExpression(1), O\Binary::Subtraction, $OperandExpression);
         default:
             return Expression::UnaryOperation($UnaryOperator, $OperandExpression);
     }
 }
示例#2
0
 public function MapUnaryOperationExpression($UnaryOperator, CoreExpression $OperandExpression)
 {
     return Expression::UnaryOperation($UnaryOperator, $OperandExpression);
 }
示例#3
0
 public function sub(CoreExpression $ObjectExpression, array $ArgumentExpressions)
 {
     $IntervalExpression = $ArgumentExpressions[0];
     if ($IntervalExpression instanceof E\ConstantExpression && $IntervalExpression->GetValue() instanceof \DateInterval) {
         $IntervalValue = $ArgumentExpressions[0]->GetValue();
         $IntervalValue->invert = $IntervalValue->invert === 1 ? 0 : 1;
         $ArgumentExpressions[0] = $IntervalValue;
     } else {
         $ArgumentExpressions[0] = Expression::UnaryOperation(Operators\Unary::Negation, $IntervalExpression);
     }
     return $this->add($ObjectExpression, $ArgumentExpressions);
 }