VIPRCatDataItem.js 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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, 2020
  8. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. */
  10. define(['./VIPRDecoratable', './VIPRItemClassSet', './VIPRTuple'], function (VIPRDecoratable, VIPRItemClassSet, VIPRTuple) {
  11. // implements ICatDataItem
  12. var VIPRCatDataItem = function (_VIPRDecoratable) {
  13. _inherits(VIPRCatDataItem, _VIPRDecoratable);
  14. function VIPRCatDataItem(resultItem, context, content) {
  15. _classCallCheck(this, VIPRCatDataItem);
  16. var _this = _possibleConstructorReturn(this, _VIPRDecoratable.call(this, resultItem, context));
  17. _this.resultItem = resultItem;
  18. _this.context = context;
  19. _this.content = content;
  20. _this.dataItemIndex = _this.context.index.dataitem;
  21. _this.dataset = _this.context.dataset;
  22. var slot = _this.dataset.slots[_this.dataItemIndex];
  23. _this.dataItemFormats = [];
  24. slot.getDataItemList().forEach(function (dataItem) {
  25. _this.dataItemFormats.push(dataItem.getFormat());
  26. });
  27. _this.tuples = [];
  28. _this.itemClassSets = [new VIPRItemClassSet(_this.resultItem.getDataItemList(), _this.context)];
  29. _this.viprItemCache = {};
  30. return _this;
  31. }
  32. VIPRCatDataItem.prototype.getUniqueName = function getUniqueName() {};
  33. VIPRCatDataItem.prototype.postProcessing = function postProcessing() {};
  34. VIPRCatDataItem.prototype.getCaption = function getCaption() {};
  35. VIPRCatDataItem.prototype.getType = function getType() {
  36. return 'cat';
  37. };
  38. VIPRCatDataItem.prototype.getTupleCount = function getTupleCount() {
  39. return this.resultItem ? this.resultItem.getRowCount() : 0;
  40. };
  41. VIPRCatDataItem.prototype.getTuple = function getTuple(index) {
  42. if (index < this.getTupleCount() && this.tuples[index] === undefined) {
  43. this.context.dataset = this.dataset;
  44. var tuple = this.resultItem.getValue(index);
  45. this.context.index = {
  46. dataitem: this.dataItemIndex,
  47. dataItemFormats: this.dataItemFormats,
  48. tuple: index,
  49. itemClassSet: 0
  50. };
  51. this.tuples[index] = new VIPRTuple(tuple, this.context, this.content, this.viprItemCache);
  52. }
  53. return this.tuples[index];
  54. };
  55. VIPRCatDataItem.prototype.getDataWindowStart = function getDataWindowStart() {
  56. return 0;
  57. };
  58. VIPRCatDataItem.prototype.getDataWindowEnd = function getDataWindowEnd() {
  59. return this.getTupleCount();
  60. };
  61. VIPRCatDataItem.prototype.getItemClassSetCount = function getItemClassSetCount() {
  62. return this.itemClassSets.length;
  63. };
  64. VIPRCatDataItem.prototype.getItemClassSet = function getItemClassSet(index) {
  65. return this.itemClassSets[index || 0];
  66. };
  67. return VIPRCatDataItem;
  68. }(VIPRDecoratable);
  69. return VIPRCatDataItem;
  70. });
  71. //# sourceMappingURL=VIPRCatDataItem.js.map