PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/pyjs/tests/test019.js

http://pyjamas.googlecode.com/
JavaScript | 42 lines | 37 code | 5 blank | 0 comment | 8 complexity | f385e6d446a2da0bb685db7f5606249d MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. __Schedule.prototype.__class__ = "Schedule";
  2. function Schedule() {
  3. return new __Schedule();
  4. }
  5. function __Schedule() {
  6. this.timeSlots = new pyjslib_List([]);
  7. }
  8. __Schedule.prototype.addTimeSlot = function(timeSlot) {
  9. this.timeSlots.append(timeSlot);
  10. };
  11. __Schedule.prototype.getDescription = function(daysFilter) {
  12. var s = null;
  13. var __timeSlot = this.timeSlots.__iter__();
  14. try {
  15. while (true) {
  16. var timeSlot = __timeSlot.next();
  17. if (daysFilter.__getitem__(timeSlot.dayOfWeek)) {
  18. if (!(s)) {
  19. var s = timeSlot.getDescription();
  20. }
  21. else {
  22. s += ( ", " + timeSlot.getDescription() ) ;
  23. }
  24. }
  25. }
  26. } catch (e) {
  27. if (e != StopIteration) {
  28. throw e;
  29. }
  30. }
  31. if (s) {
  32. return s;
  33. }
  34. else {
  35. return "";
  36. }
  37. };