VIPRItemClassSet.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5. /**
  6. * Licensed Materials - Property of IBM
  7. * IBM Business Analytics (C) Copyright IBM Corp. 2019
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define(['./VIPRDecoratable', './VIPRItemClass'], function (VIPRDecoratable, VIPRItemClass) {
  11. // implements IItemClassSet
  12. var VIPRItemClassSet = function (_VIPRDecoratable) {
  13. _inherits(VIPRItemClassSet, _VIPRDecoratable);
  14. function VIPRItemClassSet(dataItems, context) {
  15. _classCallCheck(this, VIPRItemClassSet);
  16. var _this = _possibleConstructorReturn(this, _VIPRDecoratable.apply(this, arguments));
  17. _this.dataItems = dataItems;
  18. _this.context = context;
  19. _this.itemClasses = [];
  20. return _this;
  21. }
  22. VIPRItemClassSet.prototype.getItemClassCount = function getItemClassCount() {
  23. return this.dataItems.length;
  24. };
  25. VIPRItemClassSet.prototype.getItemClass = function getItemClass(index) {
  26. if (index < this.getItemClassCount() && this.itemClasses[index] === undefined) {
  27. this.itemClasses[index] = new VIPRItemClass(this.dataItems[index], this.context);
  28. }
  29. return this.itemClasses[index];
  30. };
  31. return VIPRItemClassSet;
  32. }(VIPRDecoratable);
  33. return VIPRItemClassSet;
  34. });
  35. //# sourceMappingURL=VIPRItemClassSet.js.map