8b134aff2ca7328cc32d38de5997b7df9d2a4523d7cf12b26777311c6f69625bb409be73119ed88bc64f88aa04772637fc3d27e0773237ce487eb388e7642d 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. var __extends = this && this.t || function() {
  2. var extendStatics = function(t, n) {
  3. extendStatics = Object.setPrototypeOf || {
  4. __proto__: []
  5. } instanceof Array && function(t, n) {
  6. t.__proto__ = n;
  7. } || function(t, n) {
  8. for (var i in n) if (Object.prototype.hasOwnProperty.call(n, i)) t[i] = n[i];
  9. };
  10. return extendStatics(t, n);
  11. };
  12. return function(t, n) {
  13. if (typeof n !== "function" && n !== null) throw new TypeError("Class extends value " + String(n) + " is not a constructor or null");
  14. extendStatics(t, n);
  15. function __() {
  16. this.constructor = t;
  17. }
  18. t.prototype = n === null ? Object.create(n) : (__.prototype = n.prototype, new __);
  19. };
  20. }();
  21. import { Base } from "../ContainerBase";
  22. var Stack = function(t) {
  23. __extends(Stack, t);
  24. function Stack(n) {
  25. if (n === void 0) {
  26. n = [];
  27. }
  28. var i = t.call(this) || this;
  29. i.nt = [];
  30. var r = i;
  31. n.forEach((function(t) {
  32. r.push(t);
  33. }));
  34. return i;
  35. }
  36. Stack.prototype.clear = function() {
  37. this.M = 0;
  38. this.nt = [];
  39. };
  40. Stack.prototype.push = function(t) {
  41. this.nt.push(t);
  42. this.M += 1;
  43. return this.M;
  44. };
  45. Stack.prototype.pop = function() {
  46. if (this.M === 0) return;
  47. this.M -= 1;
  48. return this.nt.pop();
  49. };
  50. Stack.prototype.top = function() {
  51. return this.nt[this.M - 1];
  52. };
  53. return Stack;
  54. }(Base);
  55. export default Stack;
  56. //# sourceMappingURL=Stack.js.map