UNPKG

@sap/odata-v4

Version:

OData V4.0 server library

94 lines (82 loc) 2.33 kB
'use strict'; const Transformation = require('./Transformation'); /** * Represents a transformation with one of the pre-defined methods * <code>bottomcount</code>, <code>bottompercent</code>, <code>bottomsum</code>, * <code>topcount</code>, <code>toppercent</code>, <code>topsum</code>. * @extends Transformation * @hideconstructor */ class BottomTopTransformation extends Transformation { constructor() { super(Transformation.TransformationKind.BOTTOM_TOP); this._method = null; this._number = null; this._value = null; } /** * Returns the partial-aggregation method. * @returns {?BottomTopTransformation.Method} the partial-aggregation method */ getMethod() { return this._method; } /** * Sets the partial-aggregation method. * @param {BottomTopTransformation.Method} method the partial-aggregation method * @returns {BottomTopTransformation} this transformation * @package */ setMethod(method) { this._method = method; return this; } /** * Returns the expression that determines the number of items to aggregate. * @returns {Expression} the expression */ getNumber() { return this._number; } /** * Sets the expression that determines the number of items to aggregate. * @param {Expression} number the expression * @returns {BottomTopTransformation} this transformation * @package */ setNumber(number) { this._number = number; return this; } /** * Returns the expression that determines the values to aggregate. * @returns {Expression} the expression */ getValue() { return this._value; } /** * Sets the expression that determines the values to aggregate. * @param {Expression} value the expression * @returns {BottomTopTransformation} this transformation * @package */ setValue(value) { this._value = value; return this; } } /** * Pre-defined method for partial aggregration. * @enum {number} * @readonly */ BottomTopTransformation.Method = { BOTTOM_COUNT: 0, BOTTOM_PERCENT: 1, BOTTOM_SUM: 2, TOP_COUNT: 10, TOP_PERCENT: 11, TOP_SUM: 12 }; module.exports = BottomTopTransformation;