"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
Object.defineProperty(exports, "ViewSizeSet", {
    enumerable: true,
    get: function() {
        return ViewSizeSet;
    }
});
const _viewSize = require("./viewSize");
const _constants = require("./constants");
class ViewSizeSet {
    /**
   * Sets the size for rendered elements. It can be a size for rows, cells or size for row
   * headers etc.
   *
   * @param {number} size The size.
   */ setSize(size) {
        this.size.setSize(size);
    }
    /**
   * Sets the offset for rendered elements. The offset describes the shift between 0 and
   * the first rendered element according to the scroll position.
   *
   * @param {number} offset The offset.
   */ setOffset(offset) {
        this.size.setOffset(offset);
    }
    /**
   * Returns ViewSize instance.
   *
   * @returns {ViewSize}
   */ getViewSize() {
        return this.size;
    }
    /**
   * Checks if this ViewSizeSet is sharing the size with another instance.
   *
   * @returns {boolean}
   */ isShared() {
        return this.sharedSize !== null;
    }
    /**
   * Checks what working space describes this size instance.
   *
   * @param {number} workingSpace The number which describes the type of the working space (see constants.js).
   * @returns {boolean}
   */ isPlaceOn(workingSpace) {
        return this.workingSpace === workingSpace;
    }
    /**
   * Appends the ViewSizeSet instance to this instance that turns it into a shared mode.
   *
   * @param {ViewSizeSet} viewSize The instance of the ViewSizeSet class.
   */ append(viewSize) {
        this.workingSpace = _constants.WORKING_SPACE_TOP;
        viewSize.workingSpace = _constants.WORKING_SPACE_BOTTOM;
        this.sharedSize = viewSize.getViewSize();
    }
    /**
   * Prepends the ViewSize instance to this instance that turns it into a shared mode.
   *
   * @param {ViewSizeSet} viewSize The instance of the ViewSizeSet class.
   */ prepend(viewSize) {
        this.workingSpace = _constants.WORKING_SPACE_BOTTOM;
        viewSize.workingSpace = _constants.WORKING_SPACE_TOP;
        this.sharedSize = viewSize.getViewSize();
    }
    constructor(){
        /**
   * Holder for current and next view size and offset.
   *
   * @type {ViewSize}
   */ this.size = new _viewSize.ViewSize();
        /**
   * Defines if this instance shares its size with another instance. If it's in the shared
   * mode it defines what space it occupies ('top' or 'bottom').
   *
   * @type {number}
   */ this.workingSpace = _constants.WORKING_SPACE_ALL;
        /**
   * Shared Size instance.
   *
   * @type {ViewSize}
   */ this.sharedSize = null;
    }
}
