stack.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*##############################################################################
  2. # Copyright (C) 2011 HPCC Systems.
  3. #
  4. # All rights reserved. This program is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU Affero General Public License as
  6. # published by the Free Software Foundation, either version 3 of the
  7. # License, or (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU Affero General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU Affero General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. ############################################################################## */
  17. function Stack()
  18. {
  19. // Create an empty array of cards.
  20. this.cards = new Array();
  21. this.push = StackPush;
  22. this.pop = StackPop;
  23. this.getData = StackGetData;
  24. }
  25. function StackPush(data)
  26. {
  27. this.cards.push(data);
  28. }
  29. function StackPop(data)
  30. {
  31. return this.cards.pop();
  32. }
  33. function StackGetData()
  34. {
  35. return this.cards;
  36. }