@sap/odata-v4
Version:
OData V4.0 server library
66 lines (57 loc) • 1.35 kB
JavaScript
;
const Expression = require('./Expression');
/**
* @extends Expression
* @hideconstructor
*/
class UnaryExpression extends Expression {
/**
* Create an instance of UnaryExpression.
* @param {UnaryExpression.OperatorKind} operator operator
* @param {Expression} operand operand
*/
constructor(operator, operand) {
super(Expression.ExpressionKind.UNARY);
/**
* @type {UnaryExpression.OperatorKind}
* @private
*/
this._operator = operator;
/**
* @type {Expression}
* @private
*/
this._operand = operand;
}
/**
* Return the operator.
* @returns {UnaryExpression.OperatorKind} the operator
*/
getOperator() {
return this._operator;
}
/**
* Return the operand.
* @returns {Expression} the operand
*/
getOperand() {
return this._operand;
}
/**
* Return the EDM type of this expression or null if there is none.
* @returns {?EdmType} the EDM type of this expression or null if there is none
*/
getType() {
return this._operand.getType();
}
}
/**
* Defined operators.
* @enum {string}
* @readonly
*/
UnaryExpression.OperatorKind = {
MINUS: '-',
NOT: 'not'
};
module.exports = UnaryExpression;