Best JavaScript code snippet using qawolf
examples.js
Source:examples.js
1/**2 * @fileoverview Program examples, chapter 73 */4define (["course/it001/res/scripts/decl"], function ()5{6 console.log ("Adding examples: Lesson 07");7 window.it001.gProgramRepository ["it001_Ex_07_010"] =8 {9 globals:10 {11 symbols: ["msg", "t", "v", "x"]12 },13 transitionTable:14 [15 { // State 016 source: "/*",17 symbols: [],18 comment: "",19 transition:20 function ()21 {22 this._SetState (1, false);23 }24 },25 { // State 126 source: "* For each second in 0, 1, 2, ..., 10 we compute",27 symbols: [],28 comment: "",29 transition:30 function ()31 {32 this._SetState (2, false);33 }34 },35 { // State 236 source: "* the distance a vehicle will have travelled at",37 symbols: [],38 comment: "",39 transition:40 function ()41 {42 this._SetState (3, false);43 }44 },45 { // State 346 source: "* a constant speed of 30 m/s.",47 symbols: [],48 comment: "",49 transition:50 function ()51 {52 this._SetState (4, false);53 }54 },55 { // State 456 source: "*/",57 symbols: [],58 comment: "",59 transition:60 function ()61 {62 this._SetState (5, false);63 }64 },65 { // State 566 source: "",67 symbols: [],68 comment: "",69 transition:70 function ()71 {72 this._SetState (6, false);73 }74 },75 { // State 676 source: "var v = 30;",77 symbols: [],78 comment: "",79 transition:80 function ()81 {82 this.v = 30;83 this._SetState (7, false);84 }85 },86 { // State 787 source: "var t;",88 symbols: ["v"],89 comment: "",90 transition:91 function ()92 {93 this._SetState (8, false);94 }95 },96 { // State 897 source: "var x;",98 symbols: ["v","t"],99 comment: "",100 transition:101 function ()102 {103 this._SetState (9, false);104 }105 },106 { // State 9107 source: "var msg;",108 symbols: ["v","t","x"],109 comment: "",110 transition:111 function ()112 {113 this._SetState (10, false);114 }115 },116 { // State 10117 source: "",118 symbols: ["msg","v","t","x"],119 comment: "",120 transition:121 function ()122 {123 this._SetState (11, false);124 }125 },126 { // State 11127 source: "t = 0;",128 symbols: ["msg", "t", "v", "x"],129 comment: "",130 transition:131 function ()132 {133 this.t = 0;134 this._SetState (12, false);135 }136 },137 { // State 12138 source: "x = v * t;",139 symbols: ["msg", "t", "v", "x"],140 comment: "",141 transition:142 function ()143 {144 this.x = this.v * this.t;145 this._SetState (13, false);146 }147 },148 { // State 13149 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",150 symbols: ["msg", "t", "v", "x"],151 comment: "",152 transition:153 function ()154 {155 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";156 this._SetState (14, false);157 }158 },159 { // State 14160 source: "console.log (msg);",161 symbols: ["msg", "t", "v", "x"],162 comment: "",163 transition:164 function ()165 {166 console.log (this.msg);167 this._SetState (15, false);168 }169 },170 { // State 15171 source: "",172 symbols: ["msg", "t", "v", "x"],173 comment: "",174 transition:175 function ()176 {177 this._SetState (16, false);178 }179 },180 { // State 16181 source: "t = 1;",182 symbols: ["msg", "t", "v", "x"],183 comment: "",184 transition:185 function ()186 {187 this.t = 1;188 this._SetState (17, false);189 }190 },191 { // State 17192 source: "x = v * t;",193 symbols: ["msg", "t", "v", "x"],194 comment: "",195 transition:196 function ()197 {198 this.x = this.v * this.t;199 this._SetState (18, false);200 }201 },202 { // State 18203 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",204 symbols: ["msg", "t", "v", "x"],205 comment: "",206 transition:207 function ()208 {209 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";210 this._SetState (19, false);211 }212 },213 { // State 19214 source: "console.log (msg);",215 symbols: ["msg", "t", "v", "x"],216 comment: "",217 transition:218 function ()219 {220 console.log (this.msg);221 this._SetState (20, false);222 }223 },224 { // State 20225 source: "",226 symbols: ["msg", "t", "v", "x"],227 comment: "",228 transition:229 function ()230 {231 this._SetState (21, false);232 }233 },234 { // State 21235 source: "t = 2;",236 symbols: ["msg", "t", "v", "x"],237 comment: "",238 transition:239 function ()240 {241 this.t = 2;242 this._SetState (22, false);243 }244 },245 { // State 22246 source: "x = v * t;",247 symbols: ["msg", "t", "v", "x"],248 comment: "",249 transition:250 function ()251 {252 this.x = this.v * this.t;253 this._SetState (23, false);254 }255 },256 { // State 23257 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",258 symbols: ["msg", "t", "v", "x"],259 comment: "",260 transition:261 function ()262 {263 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";264 this._SetState (24, false);265 }266 },267 { // State 24268 source: "console.log (msg);",269 symbols: ["msg", "t", "v", "x"],270 comment: "",271 transition:272 function ()273 {274 console.log (this.msg);275 this._SetState (25, false);276 }277 },278 { // State 25279 source: "",280 symbols: ["msg", "t", "v", "x"],281 comment: "",282 transition:283 function ()284 {285 this._SetState (26, false);286 }287 },288 { // State 26289 source: "t = 3;",290 symbols: ["msg", "t", "v", "x"],291 comment: "",292 transition:293 function ()294 {295 this.t = 3;296 this._SetState (27, false);297 }298 },299 { // State 27300 source: "x = v * t;",301 symbols: ["msg", "t", "v", "x"],302 comment: "",303 transition:304 function ()305 {306 this.x = this.v * this.t;307 this._SetState (28, false);308 }309 },310 { // State 28311 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",312 symbols: ["msg", "t", "v", "x"],313 comment: "",314 transition:315 function ()316 {317 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";318 this._SetState (29, false);319 }320 },321 { // State 29322 source: "console.log (msg);",323 symbols: ["msg", "t", "v", "x"],324 comment: "",325 transition:326 function ()327 {328 console.log (this.msg);329 this._SetState (30, false);330 }331 },332 { // State 30333 source: "",334 symbols: ["msg", "t", "v", "x"],335 comment: "",336 transition:337 function ()338 {339 this._SetState (31, false);340 }341 },342 { // State 31343 source: "t = 4;",344 symbols: ["msg", "t", "v", "x"],345 comment: "",346 transition:347 function ()348 {349 this.t = 4;350 this._SetState (32, false);351 }352 },353 { // State 32354 source: "x = v * t;",355 symbols: ["msg", "t", "v", "x"],356 comment: "",357 transition:358 function ()359 {360 this.x = this.v * this.t;361 this._SetState (33, false);362 }363 },364 { // State 33365 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",366 symbols: ["msg", "t", "v", "x"],367 comment: "",368 transition:369 function ()370 {371 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";372 this._SetState (34, false);373 }374 },375 { // State 34376 source: "console.log (msg);",377 symbols: ["msg", "t", "v", "x"],378 comment: "",379 transition:380 function ()381 {382 console.log (this.msg);383 this._SetState (35, false);384 }385 },386 { // State 35387 source: "",388 symbols: ["msg", "t", "v", "x"],389 comment: "",390 transition:391 function ()392 {393 this._SetState (36, false);394 }395 },396 { // State 36397 source: "t = 5;",398 symbols: ["msg", "t", "v", "x"],399 comment: "",400 transition:401 function ()402 {403 this.t = 5;404 this._SetState (37, false);405 }406 },407 { // State 37408 source: "x = v * t;",409 symbols: ["msg", "t", "v", "x"],410 comment: "",411 transition:412 function ()413 {414 this.x = this.v * this.t;415 this._SetState (38, false);416 }417 },418 { // State 38419 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",420 symbols: ["msg", "t", "v", "x"],421 comment: "",422 transition:423 function ()424 {425 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";426 this._SetState (39, false);427 }428 },429 { // State 39430 source: "console.log (msg);",431 symbols: ["msg", "t", "v", "x"],432 comment: "",433 transition:434 function ()435 {436 console.log (this.msg);437 this._SetState (40, false);438 }439 },440 { // State 40441 source: "",442 symbols: ["msg", "t", "v", "x"],443 comment: "",444 transition:445 function ()446 {447 this._SetState (41, false);448 }449 },450 { // State 41451 source: "t = 6;",452 symbols: ["msg", "t", "v", "x"],453 comment: "",454 transition:455 function ()456 {457 this.t = 6;458 this._SetState (42, false);459 }460 },461 { // State 42462 source: "x = v * t;",463 symbols: ["msg", "t", "v", "x"],464 comment: "",465 transition:466 function ()467 {468 this.x = this.v * this.t;469 this._SetState (43, false);470 }471 },472 { // State 43473 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",474 symbols: ["msg", "t", "v", "x"],475 comment: "",476 transition:477 function ()478 {479 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";480 this._SetState (44, false);481 }482 },483 { // State 44484 source: "console.log (msg);",485 symbols: ["msg", "t", "v", "x"],486 comment: "",487 transition:488 function ()489 {490 console.log (this.msg);491 this._SetState (45, false);492 }493 },494 { // State 45495 source: "",496 symbols: ["msg", "t", "v", "x"],497 comment: "",498 transition:499 function ()500 {501 this._SetState (46, false);502 }503 },504 { // State 46505 source: "t = 7;",506 symbols: ["msg", "t", "v", "x"],507 comment: "",508 transition:509 function ()510 {511 this.t = 7;512 this._SetState (47, false);513 }514 },515 { // State 47516 source: "x = v * t;",517 symbols: ["msg", "t", "v", "x"],518 comment: "",519 transition:520 function ()521 {522 this.x = this.v * this.t;523 this._SetState (48, false);524 }525 },526 { // State 48527 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",528 symbols: ["msg", "t", "v", "x"],529 comment: "",530 transition:531 function ()532 {533 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";534 this._SetState (49, false);535 }536 },537 { // State 49538 source: "console.log (msg);",539 symbols: ["msg", "t", "v", "x"],540 comment: "",541 transition:542 function ()543 {544 console.log (this.msg);545 this._SetState (50, false);546 }547 },548 { // State 50549 source: "",550 symbols: ["msg", "t", "v", "x"],551 comment: "",552 transition:553 function ()554 {555 this._SetState (51, false);556 }557 },558 { // State 51559 source: "t = 8;",560 symbols: ["msg", "t", "v", "x"],561 comment: "",562 transition:563 function ()564 {565 this.t = 8;566 this._SetState (52, false);567 }568 },569 { // State 52570 source: "x = v * t;",571 symbols: ["msg", "t", "v", "x"],572 comment: "",573 transition:574 function ()575 {576 this.x = this.v * this.t;577 this._SetState (53, false);578 }579 },580 { // State 53581 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",582 symbols: ["msg", "t", "v", "x"],583 comment: "",584 transition:585 function ()586 {587 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";588 this._SetState (54, false);589 }590 },591 { // State 54592 source: "console.log (msg);",593 symbols: ["msg", "t", "v", "x"],594 comment: "",595 transition:596 function ()597 {598 console.log (this.msg);599 this._SetState (55, false);600 }601 },602 { // State 55603 source: "",604 symbols: ["msg", "t", "v", "x"],605 comment: "",606 transition:607 function ()608 {609 this._SetState (56, false);610 }611 },612 { // State 56613 source: "t = 9;",614 symbols: ["msg", "t", "v", "x"],615 comment: "",616 transition:617 function ()618 {619 this.t = 9;620 this._SetState (57, false);621 }622 },623 { // State 57624 source: "x = v * t;",625 symbols: ["msg", "t", "v", "x"],626 comment: "",627 transition:628 function ()629 {630 this.x = this.v * this.t;631 this._SetState (58, false);632 }633 },634 { // State 58635 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",636 symbols: ["msg", "t", "v", "x"],637 comment: "",638 transition:639 function ()640 {641 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";642 this._SetState (59, false);643 }644 },645 { // State 59646 source: "console.log (msg);",647 symbols: ["msg", "t", "v", "x"],648 comment: "",649 transition:650 function ()651 {652 console.log (this.msg);653 this._SetState (60, false);654 }655 },656 { // State 60657 source: "",658 symbols: ["msg", "t", "v", "x"],659 comment: "",660 transition:661 function ()662 {663 this._SetState (61, false);664 }665 },666 { // State 61667 source: "t = 10;",668 symbols: ["msg", "t", "v", "x"],669 comment: "",670 transition:671 function ()672 {673 this.t = 10;674 this._SetState (62, false);675 }676 },677 { // State 62678 source: "x = v * t;",679 symbols: ["msg", "t", "v", "x"],680 comment: "",681 transition:682 function ()683 {684 this.x = this.v * this.t;685 this._SetState (63, false);686 }687 },688 { // State 63689 source: "msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",690 symbols: ["msg", "t", "v", "x"],691 comment: "",692 transition:693 function ()694 {695 this.msg = "After " +this. t + " seconds, the vehicle will have travelled " + this.x + " meters.";696 this._SetState (64, false);697 }698 },699 { // State 64700 source: "console.log (msg);",701 symbols: ["msg", "t", "v", "x"],702 comment: "",703 transition:704 function ()705 {706 console.log (this.msg);707 this._SetState (65, true);708 }709 },710 { // State 65711 source: "/* End */",712 symbols: ["msg", "t", "v", "x"],713 comment: "",714 transition: function (){}715 }716 ]717 };718 719 window.it001.gProgramRepository ["it001_Ex_07_020"] =720 {721 globals:722 {723 symbols: ["msg", "t", "v", "x"]724 },725 transitionTable:726 [727 { // State 0728 source: "/*",729 symbols: [],730 comment: "",731 transition:732 function ()733 {734 this._SetState (6, false);735 }736 },737 { // State 1738 source: " * For each second in 0, 1, 2, ..., 10 we compute ",739 symbols: ["msg", "t", "v", "x"],740 comment: "",741 transition:742 function ()743 {744 this._SetState (2, false);745 }746 },747 { // State 2748 source: " * the distance a vehicle will have travelled at ",749 symbols: ["msg", "t", "v", "x"],750 comment: "",751 transition:752 function ()753 {754 this._SetState (3, false);755 }756 },757 { // State 3758 source: " * a constant speed of 30 m/s.",759 symbols: ["msg", "t", "v", "x"],760 comment: "",761 transition:762 function ()763 {764 this._SetState (4, false);765 }766 },767 { // State 4768 source: " */",769 symbols: ["msg", "t", "v", "x"],770 comment: "",771 transition:772 function ()773 {774 this._SetState (5, false);775 }776 },777 { // State 5778 source: "",779 symbols: ["msg", "t", "v", "x"],780 comment: "",781 transition:782 function ()783 {784 this._SetState (6, false);785 }786 },787 { // State 6788 source: "var v = 30;",789 symbols: [],790 comment: "",791 transition:792 function ()793 {794 this.v = 30;795 this._SetState (7, false);796 }797 },798 { // State 7799 source: "var t;",800 symbols: ["v"],801 comment: "",802 transition:803 function ()804 {805 this._SetState (8, false);806 }807 },808 { // State 8809 source: "var x;",810 symbols: ["t", "v"],811 comment: "",812 transition:813 function ()814 {815 this._SetState (9, false);816 }817 },818 { // State 9819 source: "var msg;",820 symbols: ["t", "v", "x"],821 comment: "",822 transition:823 function ()824 {825 this._SetState (10, false);826 }827 },828 { // State 10829 source: "",830 symbols: ["msg", "t", "v", "x"],831 comment: "",832 transition:833 function ()834 {835 this._SetState (11, false);836 }837 },838 { // State 11839 source: "for (t = 0; t <= 10; t++)",840 symbols: ["msg", "t", "v", "x"],841 comment: "",842 transition:843 function ()844 {845 this.t = 0;846 this._SetState (12, false);847 }848 },849 { // State 12850 source: "{",851 symbols: ["msg", "t", "v", "x"],852 comment: "",853 transition:854 function ()855 {856 if (this.t <= 10)857 {858 this._SetState (13, false);859 }860 else861 {862 this._SetState (17, true);863 }864 }865 },866 { // State 13867 source: " x = v * t;",868 symbols: ["msg", "t", "v", "x"],869 comment: "",870 transition:871 function ()872 {873 this.x = this.v * this.t;874 this._SetState (14, false);875 }876 },877 { // State 14878 source: " msg = \"After \" + t + \" seconds, the vehicle will have travelled \" + x + \" meters.\";",879 symbols: ["msg", "t", "v", "x"],880 comment: "",881 transition:882 function ()883 {884 this.msg = "After " + this.t + " seconds, the vehicle will have travelled " + this.x + " meters.";885 this._SetState (15, false);886 }887 },888 { // State 15889 source: " console.log (msg);",890 symbols: ["msg", "t", "v", "x"],891 comment: "",892 transition:893 function ()894 {895 console.log (this.msg);896 this._SetState (16, false);897 }898 },899 { // State 16900 source: "}",901 symbols: ["msg", "t", "v", "x"],902 comment: "",903 transition:904 function ()905 {906 this.t++;907 this._SetState (12, false);908 }909 },910 { // State 17911 source: "/* End */",912 symbols: ["msg", "t", "v", "x"],913 comment: "",914 transition: function (){}915 }916 ]917 };918 919 window.it001.gProgramRepository ["it001_Ex_07_030"] =920 {921 globals:922 {923 symbols: ["a", "b", "c", "x"]924 },925 transitionTable:926 [927 { // State 0928 source: "x = 5;",929 symbols: ["a", "b", "c", "x"],930 comment: "",931 transition:932 function ()933 {934 this.x = 5;935 this._SetState (2, false);936 }937 },938 { // State 1939 source: "",940 symbols: ["a", "b", "c", "x"],941 comment: "",942 transition:943 function ()944 {945 this._SetState (2, false);946 }947 },948 { // State 2949 source: "a = (x >= 10);",950 symbols: ["a", "b", "c", "x"],951 comment: "<tt>true</tt> if a is at least 10",952 transition:953 function ()954 {955 this.a = (this.x >= 10);956 this._SetState (3, false);957 }958 },959 { // State 3960 source: "b = (x >= 5) && (x <= 10);",961 symbols: ["a", "b", "c", "x"],962 comment: "",963 transition:964 function ()965 {966 this.b = (this.x >= 5) && (this.x <= 10);967 this._SetState (4, false);968 }969 },970 { // State 4971 source: "c = (x % 2 == 0);",972 symbols: ["a", "b", "c", "x"],973 comment: "",974 transition:975 function ()976 {977 this.c = (this.x % 2 == 0);978 this._SetState (5, true);979 }980 },981 { // State 5982 source: "/* End */",983 symbols: ["a", "b", "c", "x"],984 comment: "",985 transition: function (){}986 }987 ]988 };989 window.it001.gProgramRepository ["it001_Ex_07_040"] =990 {991 globals:992 {993 symbols: ["a", "b"]994 },995 transitionTable:996 [997 { // State 0998 source: "a = 1;",999 symbols: ["a", "b"],1000 comment: "",1001 transition:1002 function ()1003 {1004 this.a = 1;1005 this._SetState (1, false);1006 }1007 },1008 { // State 11009 source: "b = 0;",1010 symbols: ["a", "b"],1011 comment: "",1012 transition:1013 function ()1014 {1015 this.b = 0;1016 this._SetState (2, false);1017 }1018 },1019 { // State 21020 source: "if (a == 0)",1021 symbols: ["a", "b"],1022 comment: "",1023 transition:1024 function ()1025 {1026 if (this.a == 0)1027 {1028 this._SetState (3, false);1029 }1030 else1031 {1032 this._SetState (4, false);1033 }1034 }1035 },1036 { // State 31037 source: " b = 5;",1038 symbols: ["a", "b"],1039 comment: "",1040 transition:1041 function ()1042 {1043 this.b = 5;1044 this._SetState (4, false);1045 }1046 },1047 { // State 41048 source: " console.log (\"b has changed to \" + b);",1049 symbols: ["a", "b"],1050 comment: "This will <b>always</b> execute.",1051 transition:1052 function ()1053 {1054 console.log ("b has changed to " + this.b); // This will ALWAYS execute (why?)1055 this._SetState (5, true);1056 }1057 },1058 { // State 51059 source: "/* End */",1060 symbols: ["a", "b"],1061 comment: "",1062 transition: function (){}1063 }1064 ]1065 };1066 1067 window.it001.gProgramRepository ["it001_Ex_07_050"] =1068 {1069 globals:1070 {1071 symbols: ["a", "b"]1072 },1073 transitionTable:1074 [1075 { // State 01076 source: "a = 0;",1077 symbols: ["a", "b"],1078 comment: "",1079 transition:1080 function ()1081 {1082 this.a = 0;1083 this._SetState (1, false);1084 }1085 },1086 { // State 11087 source: "b = 0;",1088 symbols: ["a", "b"],1089 comment: "",1090 transition:1091 function ()1092 {1093 this.b = 0;1094 this._SetState (2, false);1095 }1096 },1097 { // State 21098 source: "if (a == 0)",1099 symbols: ["a", "b"],1100 comment: "",1101 transition:1102 function ()1103 {1104 if (this.a == 0)1105 {1106 this._SetState (4, false);1107 }1108 else1109 {1110 this._SetState (6, true);1111 }1112 }1113 },1114 { // State 31115 source: "{",1116 symbols: ["a", "b"],1117 comment: "",1118 transition:1119 function ()1120 {1121 }1122 },1123 { // State 41124 source: " b = 5;",1125 symbols: ["a", "b"],1126 comment: "",1127 transition:1128 function ()1129 {1130 this.b = 5;1131 this._SetState (6, false);1132 }1133 },1134 { // State 51135 source: "}",1136 symbols: ["a", "b"],1137 comment: "",1138 transition:1139 function ()1140 {1141 }1142 },1143 { // State 61144 source: "/* End */",1145 symbols: ["a", "b"],1146 comment: "",1147 transition: function (){}1148 }1149 ]1150 };1151 1152 window.it001.gProgramRepository ["it001_Ex_07_060"] =1153 {1154 globals:1155 {1156 symbols: ["a"]1157 },1158 transitionTable:1159 [1160 { // State 01161 source: "a = 5;",1162 symbols: ["a"],1163 comment: "",1164 transition:1165 function ()1166 {1167 this.a = 5;1168 this._SetState (1, false);1169 }1170 },1171 { // State 11172 source: "if (a == 0);",1173 symbols: ["a"],1174 comment: "An innocent semicolon at the end of this line...",1175 transition:1176 function ()1177 {1178 this._SetState (3, false);1179 }1180 },1181 { // State 21182 source: "{",1183 symbols: ["a"],1184 comment: "",1185 transition:1186 function ()1187 {1188 }1189 },1190 { // State 31191 source: " window.alert (\"Yayy, a is zero!\");",1192 symbols: ["a"],1193 comment: "",1194 transition:1195 function ()1196 {1197 window.alert ("Yayy, a is zero!");1198 this._SetState (5, true);1199 }1200 },1201 { // State 41202 source: "}",1203 symbols: ["a"],1204 comment: "",1205 transition:1206 function ()1207 {1208 }1209 },1210 { // State 51211 source: "/* End */",1212 symbols: ["a"],1213 comment: "",1214 transition: function (){}1215 }1216 ]1217 };1218 1219 window.it001.gProgramRepository ["it001_Ex_07_070"] =1220 {1221 globals:1222 {1223 symbols: ["a", "b", "c", "d"]1224 },1225 transitionTable:1226 [1227 { // State 01228 source: "if (a == 0)",1229 symbols: ["a", "b", "c", "d"],1230 comment: "Assume a is zero...",1231 transition:1232 function ()1233 {1234 this.a = 0;1235 if (this.a == 0)1236 {1237 this._SetState (2, false);1238 }1239 else1240 {1241 this._SetState (7, true);1242 }1243 }1244 },1245 { // State 11246 source: "{",1247 symbols: ["a", "b", "c", "d"],1248 comment: "",1249 transition:1250 function ()1251 {1252 }1253 },1254 { // State 21255 source: " b = \"here is \";",1256 symbols: ["a", "b", "c", "d"],1257 comment: "",1258 transition:1259 function ()1260 {1261 this.b = "here is ";1262 this._SetState (3, false);1263 }1264 },1265 { // State 31266 source: " c = \"a block \";",1267 symbols: ["a", "b", "c", "d"],1268 comment: "",1269 transition:1270 function ()1271 {1272 this.c = "a block ";1273 this._SetState (4, false);1274 }1275 },1276 { // State 41277 source: " d = \"of statements.\";",1278 symbols: ["a", "b", "c", "d"],1279 comment: "",1280 transition:1281 function ()1282 {1283 this.d = "of statements.";1284 this._SetState (5, false);1285 }1286 },1287 { // State 51288 source: " console.log (\"a is 0, so \" + b + c + d);",1289 symbols: ["a", "b", "c", "d"],1290 comment: "",1291 transition:1292 function ()1293 {1294 console.log ("a is 0, so " + this.b + this.c + this.d);1295 this._SetState (7, true);1296 }1297 },1298 { // State 61299 source: "}",1300 symbols: ["a", "b", "c", "d"],1301 comment: "",1302 transition:1303 function ()1304 {1305 }1306 },1307 { // State 71308 source: "/* End */",1309 symbols: ["a", "b", "c", "d"],1310 comment: "",1311 transition: function (){}1312 }1313 ]1314 };1315 1316 window.it001.gProgramRepository ["it001_Ex_07_080"] =1317 {1318 globals:1319 {1320 symbols: ["a", "b", "c", "d"]1321 },1322 transitionTable:1323 [1324 { // State 01325 source: "if (a == 0)",1326 symbols: ["a", "b", "c", "d"],1327 comment: "Assume that a is 1.",1328 transition:1329 function ()1330 {1331 this.a = 1;1332 if (this.a == 0)1333 {1334 this._SetState (2, false);1335 }1336 else1337 {1338 this._SetState (9, false);1339 }1340 }1341 },1342 { // State 11343 source: "{",1344 symbols: ["a", "b", "c", "d"],1345 comment: "",1346 transition:1347 function ()1348 {1349 }1350 },1351 { // State 21352 source: " b = \"here is \";",1353 symbols: ["a", "b", "c", "d"],1354 comment: "",1355 transition:1356 function ()1357 {1358 this.b = "here is ";1359 this._SetState (3, false);1360 }1361 },1362 { // State 31363 source: " c = \"a block \";",1364 symbols: ["a", "b", "c", "d"],1365 comment: "",1366 transition:1367 function ()1368 {1369 this.c = "a block ";1370 this._SetState (4, false);1371 }1372 },1373 { // State 41374 source: " d = \"of statements.\";",1375 symbols: ["a", "b", "c", "d"],1376 comment: "",1377 transition:1378 function ()1379 {1380 this.d = "of statements.";1381 this._SetState (5, false);1382 }1383 },1384 { // State 51385 source: " console.log (\"a is 0, so \" + b + c + d);",1386 symbols: ["a", "b", "c", "d"],1387 comment: "",1388 transition:1389 function ()1390 {1391 console.log ("a is 0, so " + this.b + this.c + this.d);1392 this._SetState (14, true);1393 }1394 },1395 { // State 61396 source: "}",1397 symbols: ["a", "b", "c", "d"],1398 comment: "",1399 transition:1400 function ()1401 {1402 }1403 },1404 { // State 71405 source: "else",1406 symbols: ["a", "b", "c", "d"],1407 comment: "",1408 transition:1409 function ()1410 {1411 }1412 },1413 { // State 81414 source: "{",1415 symbols: ["a", "b", "c", "d"],1416 comment: "",1417 transition:1418 function ()1419 {1420 }1421 },1422 { // State 91423 source: " b = \"here is \";",1424 symbols: ["a", "b", "c", "d"],1425 comment: "",1426 transition:1427 function ()1428 {1429 this.b = "here is ";1430 this._SetState (10, false);1431 }1432 },1433 { // State 101434 source: " c = \"another block \";",1435 symbols: ["a", "b", "c", "d"],1436 comment: "",1437 transition:1438 function ()1439 {1440 this.c = "another block ";1441 this._SetState (11, false);1442 }1443 },1444 { // State 111445 source: " d = \"of statements.\";",1446 symbols: ["a", "b", "c", "d"],1447 comment: "",1448 transition:1449 function ()1450 {1451 this.d = "of statements.";1452 this._SetState (12, false);1453 }1454 },1455 { // State 121456 source: " console.log (\"a is NOT 0, so \" + b + c + d);",1457 symbols: ["a", "b", "c", "d"],1458 comment: "",1459 transition:1460 function ()1461 {1462 console.log ("a is NOT 0, so " + this.b + this.c + this.d);1463 this._SetState (14, true);1464 }1465 },1466 { // State 131467 source: "}",1468 symbols: ["a", "b", "c", "d"],1469 comment: "",1470 transition:1471 function ()1472 {1473 }1474 },1475 { // State 141476 source: "/* End */",1477 symbols: ["a", "b", "c", "d"],1478 comment: "",1479 transition: function (){}1480 }1481 ]1482 };1483 1484 window.it001.gProgramRepository ["it001_Ex_07_090"] =1485 {1486 globals:1487 {1488 symbols: ["a"]1489 },1490 transitionTable:1491 [1492 { // State 01493 source: "a = 1;",1494 symbols: ["a"],1495 comment: "",1496 transition:1497 function ()1498 {1499 this.a = 1;1500 this._SetState (1, false);1501 }1502 },1503 { // State 11504 source: "if (a == -1)",1505 symbols: ["a"],1506 comment: "",1507 transition:1508 function ()1509 {1510 if (this.a == -1)1511 {1512 this._SetState (3, false);1513 }1514 else1515 {1516 this._SetState (5, false);1517 }1518 }1519 },1520 { // State 21521 source: "{",1522 symbols: ["a"],1523 comment: "",1524 transition:1525 function ()1526 {1527 }1528 },1529 { // State 31530 source: " // this will not execute",1531 symbols: ["a"],1532 comment: "",1533 transition:1534 function ()1535 {1536 this._SetState (17, true);1537 }1538 },1539 { // State 41540 source: "}",1541 symbols: ["a"],1542 comment: "",1543 transition:1544 function ()1545 {1546 }1547 },1548 { // State 51549 source: "else if (a == 0)",1550 symbols: ["a"],1551 comment: "",1552 transition:1553 function ()1554 {1555 if (this.a == 0)1556 {1557 this._SetState (7, false);1558 }1559 else1560 {1561 this._SetState (9, false);1562 }1563 }1564 },1565 { // State 61566 source: "{",1567 symbols: ["a"],1568 comment: "",1569 transition:1570 function ()1571 {1572 }1573 },1574 { // State 71575 source: " // this won't execute either",1576 symbols: ["a"],1577 comment: "",1578 transition:1579 function ()1580 {1581 this._SetState (17, true);1582 }1583 },1584 { // State 81585 source: "}",1586 symbols: ["a"],1587 comment: "",1588 transition:1589 function ()1590 {1591 }1592 },1593 { // State 91594 source: "else if (a >= 1)",1595 symbols: ["a"],1596 comment: "",1597 transition:1598 function ()1599 {1600 if (this.a >= 1)1601 {1602 this._SetState (11, false);1603 }1604 else1605 {1606 this._SetState (13, false);1607 }1608 }1609 },1610 { // State 101611 source: "{",1612 symbols: ["a"],1613 comment: "",1614 transition:1615 function ()1616 {1617 }1618 },1619 { // State 111620 source: " // bingo!",1621 symbols: ["a"],1622 comment: "",1623 transition:1624 function ()1625 {1626 this._SetState (17, true);1627 }1628 },1629 { // State 121630 source: "}",1631 symbols: ["a"],1632 comment: "",1633 transition:1634 function ()1635 {1636 }1637 },1638 { // State 131639 source: "else",1640 symbols: ["a"],1641 comment: "",1642 transition:1643 function ()1644 {1645 this._SetState (15, false);1646 }1647 },1648 { // State 141649 source: "{",1650 symbols: ["a"],1651 comment: "",1652 transition:1653 function ()1654 {1655 }1656 },1657 { // State 151658 source: " // the fallback case whan nothing matches",1659 symbols: ["a"],1660 comment: "",1661 transition:1662 function ()1663 {1664 this._SetState (17, true);1665 }1666 },1667 { // State 161668 source: "}",1669 symbols: ["a"],1670 comment: "",1671 transition:1672 function ()1673 {1674 }1675 },1676 { // State 171677 source: "/* End */",1678 symbols: ["a"],1679 comment: "",1680 transition: function (){}1681 }1682 ]1683 };1684 1685 window.it001.gProgramRepository ["it001_Ex_07_100"] =1686 {1687 globals:1688 {1689 symbols: ["a"]1690 },1691 transitionTable:1692 [1693 { // State 01694 source: "a = 1;",1695 symbols: ["a"],1696 comment: "",1697 transition:1698 function ()1699 {1700 this.a = 1;1701 this._SetState (1, false);1702 }1703 },1704 { // State 11705 source: "switch (a)",1706 symbols: ["a"],1707 comment: "Match against three test cases: 0, 1, and, 5 (lines 4, 7, 10)",1708 transition:1709 function ()1710 {1711 this._SetState (3, false);1712 }1713 },1714 { // State 21715 source: "{",1716 symbols: ["a"],1717 comment: "",1718 transition:1719 function ()1720 {1721 }1722 },1723 { // State 31724 source: " case 0:",1725 symbols: ["a"],1726 comment: "Does not match. Next <tt>case</tt> statement.",1727 transition:1728 function ()1729 {1730 if (this.a == 0)1731 {1732 this._SetState (4, false);1733 }1734 else1735 {1736 this._SetState (6, false);1737 }1738 }1739 },1740 { // State 41741 source: " console.log (\"Zero\");",1742 symbols: ["a"],1743 comment: "",1744 transition:1745 function ()1746 {1747 console.log ("Zero");1748 this._SetState (5, false);1749 }1750 },1751 { // State 51752 source: " break;",1753 symbols: ["a"],1754 comment: "",1755 transition:1756 function ()1757 {1758 this._SetState (13, true);1759 }1760 },1761 { // State 61762 source: " case 1:",1763 symbols: ["a"],1764 comment: "Does match. Execute next statement.",1765 transition:1766 function ()1767 {1768 if (this.a == 1)1769 {1770 this._SetState (7, false);1771 }1772 else1773 {1774 this._SetState (9, false);1775 }1776 }1777 },1778 { // State 71779 source: " console.log (\"One\");",1780 symbols: ["a"],1781 comment: "",1782 transition:1783 function ()1784 {1785 console.log ("One");1786 this._SetState (8, false);1787 }1788 },1789 { // State 81790 source: " break;",1791 symbols: ["a"],1792 comment: "<tt>break</tt> statement leaves the <tt>switch</tt> construct.",1793 transition:1794 function ()1795 {1796 this._SetState (13, true);1797 }1798 },1799 { // State 91800 source: " case 5:",1801 symbols: ["a"],1802 comment: "",1803 transition:1804 function ()1805 {1806 if (this.a == 5)1807 {1808 this._SetState (10, false);1809 }1810 else1811 {1812 this._SetState (13, true);1813 }1814 }1815 },1816 { // State 101817 source: " console.log (\"Five\");",1818 symbols: ["a"],1819 comment: "",1820 transition:1821 function ()1822 {1823 console.log ("Five");1824 this._SetState (11, false);1825 }1826 },1827 { // State 111828 source: " break;",1829 symbols: ["a"],1830 comment: "",1831 transition:1832 function ()1833 {1834 this._SetState (13, true);1835 }1836 },1837 { // State 121838 source: "}",1839 symbols: ["a"],1840 comment: "",1841 transition:1842 function ()1843 {1844 }1845 },1846 { // State 131847 source: "/* End */",1848 symbols: ["a"],1849 comment: "",1850 transition: function (){}1851 }1852 ]1853 };1854 1855 window.it001.gProgramRepository ["it001_Ex_07_110"] =1856 {1857 globals:1858 {1859 symbols: ["a"]1860 },1861 transitionTable:1862 [1863 { // State 01864 source: "a = 1;",1865 symbols: ["a"],1866 comment: "",1867 transition:1868 function ()1869 {1870 this.a = 1;1871 this._SetState (1, false);1872 }1873 },1874 { // State 11875 source: "if (a === 0)",1876 symbols: ["a"],1877 comment: "",1878 transition:1879 function ()1880 {1881 if (this.a === 0)1882 {1883 this._SetState (3, false);1884 }1885 else1886 {1887 this._SetState (5, false);1888 }1889 }1890 },1891 { // State 21892 source: "{",1893 symbols: ["a"],1894 comment: "",1895 transition:1896 function ()1897 {1898 }1899 },1900 { // State 31901 source: " console.log (\"Zero\");",1902 symbols: ["a"],1903 comment: "",1904 transition:1905 function ()1906 {1907 console.log ("Zero");1908 this._SetState (13, true);1909 }1910 },1911 { // State 41912 source: "}",1913 symbols: ["a"],1914 comment: "",1915 transition:1916 function ()1917 {1918 }1919 },1920 { // State 51921 source: "else if (a === 1)",1922 symbols: ["a"],1923 comment: "",1924 transition:1925 function ()1926 {1927 if (this.a === 1)1928 {1929 this._SetState (7, false);1930 }1931 else1932 {1933 this._SetState (9, false);1934 }1935 }1936 },1937 { // State 61938 source: "{",1939 symbols: ["a"],1940 comment: "",1941 transition:1942 function ()1943 {1944 }1945 },1946 { // State 71947 source: " console.log (\"One\");",1948 symbols: ["a"],1949 comment: "",1950 transition:1951 function ()1952 {1953 console.log ("One");1954 this._SetState (13, true);1955 }1956 },1957 { // State 81958 source: "}",1959 symbols: ["a"],1960 comment: "",1961 transition:1962 function ()1963 {1964 }1965 },1966 { // State 91967 source: "else if (a === 5)",1968 symbols: ["a"],1969 comment: "",1970 transition:1971 function ()1972 {1973 if (this.a === 5)1974 {1975 this._SetState (11, false);1976 }1977 else1978 {1979 this._SetState (13, true);1980 }1981 }1982 },1983 { // State 101984 source: "{",1985 symbols: ["a"],1986 comment: "",1987 transition:1988 function ()1989 {1990 }1991 },1992 { // State 111993 source: " console.log (\"Five\");",1994 symbols: ["a"],1995 comment: "",1996 transition:1997 function ()1998 {1999 console.log ("Five");2000 this._SetState (13, true);2001 }2002 },2003 { // State 122004 source: "}",2005 symbols: ["a"],2006 comment: "",2007 transition:2008 function ()2009 {2010 }2011 },2012 { // State 132013 source: "/* End */",2014 symbols: ["a"],2015 comment: "",2016 transition: function (){}2017 }2018 ]2019 };2020 2021 window.it001.gProgramRepository ["it001_Ex_07_120"] =2022 {2023 globals:2024 {2025 symbols: ["a"]2026 },2027 transitionTable:2028 [2029 { // State 02030 source: "a = 1;",2031 symbols: ["a"],2032 comment: "",2033 transition:2034 function ()2035 {2036 this.a = 1;2037 this._SetState (1, false);2038 }2039 },2040 { // State 12041 source: "switch (a)",2042 symbols: ["a"],2043 comment: "",2044 transition:2045 function ()2046 {2047 this._SetState (3, false);2048 }2049 },2050 { // State 22051 source: "{",2052 symbols: ["a"],2053 comment: "",2054 transition:2055 function ()2056 {2057 }2058 },2059 { // State 32060 source: " case 0:",2061 symbols: ["a"],2062 comment: "",2063 transition:2064 function ()2065 {2066 if (this.a == 0)2067 {2068 this._SetState (4, false);2069 }2070 else2071 {2072 this._SetState (6, false);2073 }2074 }2075 },2076 { // State 42077 source: " console.log (\"zero\");",2078 symbols: ["a"],2079 comment: "",2080 transition:2081 function ()2082 {2083 console.log ("zero");2084 this._SetState (5, false);2085 }2086 },2087 { // State 52088 source: " break;",2089 symbols: ["a"],2090 comment: "",2091 transition:2092 function ()2093 {2094 this._SetState (10, true);2095 }2096 },2097 { // State 62098 source: " case 1:",2099 symbols: ["a"],2100 comment: "This one matches, but will fall through the next <tt>case</tt> statement.",2101 transition:2102 function ()2103 {2104 if (this.a == 1)2105 {2106 this._SetState (8, false);2107 }2108 else2109 {2110 this._SetState (7, false);2111 }2112 }2113 },2114 { // State 72115 source: " case 2:",2116 symbols: ["a"],2117 comment: "",2118 transition:2119 function ()2120 {2121 if (this.a == 0)2122 {2123 this._SetState (8, false);2124 }2125 else2126 {2127 this._SetState (10, true);2128 }2129 }2130 },2131 { // State 82132 source: " console.log (\"one or two\");",2133 symbols: ["a"],2134 comment: "",2135 transition:2136 function ()2137 {2138 console.log ("one or two");2139 this._SetState (10, true);2140 }2141 },2142 { // State 92143 source: "}",2144 symbols: ["a"],2145 comment: "",2146 transition:2147 function ()2148 {2149 }2150 },2151 { // State 102152 source: "/* End */",2153 symbols: ["a"],2154 comment: "",2155 transition: function (){}2156 }2157 ]2158 };2159 2160 window.it001.gProgramRepository ["it001_Ex_07_130"] =2161 {2162 globals:2163 {2164 symbols: ["a"]2165 },2166 transitionTable:2167 [2168 { // State 02169 source: "a = 1;",2170 symbols: ["a"],2171 comment: "",2172 transition:2173 function ()2174 {2175 this.a = 1;2176 this._SetState (1, false);2177 }2178 },2179 { // State 12180 source: "if (a === 0)",2181 symbols: ["a"],2182 comment: "",2183 transition:2184 function ()2185 {2186 if (this.a === 0)2187 {2188 this._SetState (3, false);2189 }2190 else2191 {2192 this._SetState (5, false);2193 }2194 }2195 },2196 { // State 22197 source: "{",2198 symbols: ["a"],2199 comment: "",2200 transition:2201 function ()2202 {2203 }2204 },2205 { // State 32206 source: " console.log (\"zero\");",2207 symbols: ["a"],2208 comment: "",2209 transition:2210 function ()2211 {2212 console.log ("zero");2213 this._SetState (9, true);2214 }2215 },2216 { // State 42217 source: "}",2218 symbols: ["a"],2219 comment: "",2220 transition:2221 function ()2222 {2223 }2224 },2225 { // State 52226 source: "else if ((a === 1) || (a === 2))",2227 symbols: ["a"],2228 comment: "",2229 transition:2230 function ()2231 {2232 if ((this.a === 1) || (this.a === 2))2233 {2234 this._SetState (7, false);2235 }2236 else2237 {2238 this._SetState (9, true);2239 }2240 }2241 },2242 { // State 62243 source: "{",2244 symbols: ["a"],2245 comment: "",2246 transition:2247 function ()2248 {2249 }2250 },2251 { // State 72252 source: " console.log (\"one or two\");",2253 symbols: ["a"],2254 comment: "",2255 transition:2256 function ()2257 {2258 console.log ("one or two");2259 this._SetState (9, true);2260 }2261 },2262 { // State 82263 source: "}",2264 symbols: ["a"],2265 comment: "",2266 transition:2267 function ()2268 {2269 }2270 },2271 { // State 92272 source: "/* End */",2273 symbols: ["a"],2274 comment: "",2275 transition: function (){}2276 }2277 ]2278 };2279 2280 window.it001.gProgramRepository ["it001_Ex_07_140"] =2281 {2282 globals:2283 {2284 symbols: ["a"]2285 },2286 transitionTable:2287 [2288 { // State 02289 source: "a = 1;",2290 symbols: ["a"],2291 comment: "",2292 transition:2293 function ()2294 {2295 this.a = 1;2296 this._SetState (1, false);2297 }2298 },2299 { // State 12300 source: "switch (a)",2301 symbols: ["a"],2302 comment: "",2303 transition:2304 function ()2305 {2306 this._SetState (3, false);2307 }2308 },2309 { // State 22310 source: "{",2311 symbols: ["a"],2312 comment: "",2313 transition:2314 function ()2315 {2316 }2317 },2318 { // State 32319 source: " case 0:",2320 symbols: ["a"],2321 comment: "",2322 transition:2323 function ()2324 {2325 if (this.a == 0)2326 {2327 this._SetState (4, false);2328 }2329 else2330 {2331 this._SetState (5, false);2332 }2333 }2334 },2335 { // State 42336 source: " console.log (\"zero\");",2337 symbols: ["a"],2338 comment: "",2339 transition:2340 function ()2341 {2342 console.log ("zero");2343 this._SetState (5, false);2344 }2345 },2346 { // State 52347 source: " case 1:",2348 symbols: ["a"],2349 comment: "",2350 transition:2351 function ()2352 {2353 if ((this.a == 0) || (this.a == 1))2354 {2355 this._SetState (6, false);2356 }2357 else2358 {2359 this._SetState (7, false);2360 }2361 }2362 },2363 { // State 62364 source: " console.log (\"one\");",2365 symbols: ["a"],2366 comment: "",2367 transition:2368 function ()2369 {2370 console.log ("one");2371 this._SetState (7, false);2372 }2373 },2374 { // State 72375 source: " case 2:",2376 symbols: ["a"],2377 comment: "",2378 transition:2379 function ()2380 {2381 if ((this.a == 0) || (this.a == 1) || (this.a == 2))2382 {2383 this._SetState (8, false);2384 }2385 else2386 {2387 this._SetState (9, false);2388 }2389 }2390 },2391 { // State 82392 source: " console.log (\"two\");",2393 symbols: ["a"],2394 comment: "",2395 transition:2396 function ()2397 {2398 console.log ("two");2399 this._SetState (9, false);2400 }2401 },2402 { // State 92403 source: " case 3:",2404 symbols: ["a"],2405 comment: "",2406 transition:2407 function ()2408 {2409 if ((this.a == 0) || (this.a == 1) || (this.a == 2) || (this.a == 3))2410 {2411 this._SetState (10, false);2412 }2413 else2414 {2415 this._SetState (12, true);2416 }2417 }2418 },2419 { // State 102420 source: " console.log (\"three\");",2421 symbols: ["a"],2422 comment: "",2423 transition:2424 function ()2425 {2426 console.log ("three");2427 this._SetState (12, true);2428 }2429 },2430 { // State 112431 source: "}",2432 symbols: ["a"],2433 comment: "",2434 transition:2435 function ()2436 {2437 }2438 },2439 { // State 122440 source: "/* End */",2441 symbols: ["a"],2442 comment: "",2443 transition: function (){}2444 }2445 ]2446 };2447 2448 window.it001.gProgramRepository ["it001_Ex_07_150"] =2449 {2450 globals:2451 {2452 symbols: ["a"]2453 },2454 transitionTable:2455 [2456 { // State 02457 source: "a = 10;",2458 symbols: ["a"],2459 comment: "",2460 transition:2461 function ()2462 {2463 this.a = 10;2464 this._SetState (1, false);2465 }2466 },2467 { // State 12468 source: "switch (a)",2469 symbols: ["a"],2470 comment: "",2471 transition:2472 function ()2473 {2474 this._SetState (3, false);2475 }2476 },2477 { // State 22478 source: "{",2479 symbols: ["a"],2480 comment: "",2481 transition:2482 function ()2483 {2484 }2485 },2486 { // State 32487 source: " case 0:",2488 symbols: ["a"],2489 comment: "",2490 transition:2491 function ()2492 {2493 if (this.a == 0)2494 {2495 this._SetState (4, false);2496 }2497 else2498 {2499 this._SetState (6, false);2500 }2501 }2502 },2503 { // State 42504 source: " console.log (\"zero\");",2505 symbols: ["a"],2506 comment: "",2507 transition:2508 function ()2509 {2510 console.log ("zero");2511 this._SetState (5, false);2512 }2513 },2514 { // State 52515 source: " break;",2516 symbols: ["a"],2517 comment: "",2518 transition:2519 function ()2520 {2521 this._SetState (18, true);2522 }2523 },2524 { // State 62525 source: " case 1:",2526 symbols: ["a"],2527 comment: "",2528 transition:2529 function ()2530 {2531 if (this.a == 1)2532 {2533 this._SetState (7, false);2534 }2535 else2536 {2537 this._SetState (9, false);2538 }2539 }2540 },2541 { // State 72542 source: " console.log (\"one\");",2543 symbols: ["a"],2544 comment: "",2545 transition:2546 function ()2547 {2548 console.log ("one");2549 this._SetState (8, false);2550 }2551 },2552 { // State 82553 source: " break;",2554 symbols: ["a"],2555 comment: "",2556 transition:2557 function ()2558 {2559 this._SetState (18, true);2560 }2561 },2562 { // State 92563 source: " case 2:",2564 symbols: ["a"],2565 comment: "",2566 transition:2567 function ()2568 {2569 if (this.a == 2)2570 {2571 this._SetState (10, false);2572 }2573 else2574 {2575 this._SetState (12, false);2576 }2577 }2578 },2579 { // State 102580 source: " console.log (\"two\");",2581 symbols: ["a"],2582 comment: "",2583 transition:2584 function ()2585 {2586 console.log ("two");2587 this._SetState (11, false);2588 }2589 },2590 { // State 112591 source: " break;",2592 symbols: ["a"],2593 comment: "",2594 transition:2595 function ()2596 {2597 this._SetState (18, true);2598 }2599 },2600 { // State 122601 source: " case 3:",2602 symbols: ["a"],2603 comment: "",2604 transition:2605 function ()2606 {2607 if (this.a == 3)2608 {2609 this._SetState (13, false);2610 }2611 else2612 {2613 this._SetState (15, false);2614 }2615 }2616 },2617 { // State 132618 source: " console.log (\"three\");",2619 symbols: ["a"],2620 comment: "",2621 transition:2622 function ()2623 {2624 console.log ("three");2625 this._SetState (14, false);2626 }2627 },2628 { // State 142629 source: " break;",2630 symbols: ["a"],2631 comment: "",2632 transition:2633 function ()2634 {2635 this._SetState (18, true);2636 }2637 },2638 { // State 152639 source: " default:",2640 symbols: ["a"],2641 comment: "",2642 transition:2643 function ()2644 {2645 this._SetState (16, false);2646 }2647 },2648 { // State 162649 source: " console.log (\"unknown number\");",2650 symbols: ["a"],2651 comment: "",2652 transition:2653 function ()2654 {2655 console.log ("unknown number");2656 this._SetState (18, true);2657 }2658 },2659 { // State 172660 source: "}",2661 symbols: ["a"],2662 comment: "",2663 transition:2664 function ()2665 {2666 }2667 },2668 { // State 182669 source: "/* End */",2670 symbols: ["a"],2671 comment: "",2672 transition: function (){}2673 }2674 ]2675 };2676 2677 window.it001.gProgramRepository ["it001_Ex_07_160"] =2678 {2679 globals:2680 {2681 symbols: ["x", "y"]2682 },2683 transitionTable:2684 [2685 { // State 02686 source: "/* Prints the squares of all values in [1, 3] to the console. */",2687 symbols: ["x", "y"],2688 comment: "",2689 transition:2690 function ()2691 {2692 this._SetState (1, false);2693 }2694 },2695 { // State 12696 source: "for (x = 1; x <= 3; x++)",2697 symbols: ["x", "y"],2698 comment: "",2699 transition:2700 function ()2701 {2702 this.x = 1;2703 this._SetState (2, false);2704 }2705 },2706 { // State 22707 source: "{",2708 symbols: ["x", "y"],2709 comment: "",2710 transition:2711 function ()2712 {2713 if (this.x <= 3)2714 {2715 this._SetState (3, false);2716 }2717 else2718 {2719 this._SetState (6, true);2720 }2721 }2722 },2723 { // State 32724 source: " y = x * x;",2725 symbols: ["x", "y"],2726 comment: "",2727 transition:2728 function ()2729 {2730 this.y = this.x * this.x;2731 this._SetState (4, false);2732 }2733 },2734 { // State 42735 source: " console.log (\"x = \" + x + \", y = \" + y);",2736 symbols: ["x", "y"],2737 comment: "",2738 transition:2739 function ()2740 {2741 console.log ("x = " + this.x + ", y = " + this.y);2742 this.x++;2743 this._SetState (2, false);2744 }2745 },2746 { // State 52747 source: "} ",2748 symbols: ["x", "y"],2749 comment: "",2750 transition:2751 function ()2752 {2753 }2754 },2755 { // State 62756 source: "/* End */",2757 symbols: ["x", "y"],2758 comment: "",2759 transition: function (){}2760 }2761 ]2762 };2763 2764 window.it001.gProgramRepository ["it001_Ex_07_170"] =2765 {2766 globals:2767 {2768 symbols: ["avg", "i", "length", "n", "sum", "x"]2769 },2770 transitionTable:2771 [2772 { // State 02773 source: "var x = [15, 20, 13, 25, 7, 9, 18];",2774 symbols: ["avg", "i", "length", "n", "sum", "x"],2775 comment: "",2776 transition:2777 function ()2778 {2779 this.x = [15, 20, 13, 25, 7, 9, 18];2780 this._SetState (6, false);2781 }2782 },2783 { // State 12784 source: "var i;",2785 symbols: ["avg", "i", "length", "n", "sum", "x"],2786 comment: "",2787 transition:2788 function ()2789 {2790 }2791 },2792 { // State 22793 source: "var n;",2794 symbols: ["avg", "i", "length", "n", "sum", "x"],2795 comment: "",2796 transition:2797 function ()2798 {2799 }2800 },2801 { // State 32802 source: "var sum;",2803 symbols: ["avg", "i", "length", "n", "sum", "x"],2804 comment: "",2805 transition:2806 function ()2807 {2808 }2809 },2810 { // State 42811 source: "var avg;",2812 symbols: ["avg", "i", "length", "n", "sum", "x"],2813 comment: "",2814 transition:2815 function ()2816 {2817 }2818 },2819 { // State 52820 source: "",2821 symbols: ["avg", "i", "length", "n", "sum", "x"],2822 comment: "",2823 transition:2824 function ()2825 {2826 }2827 },2828 { // State 62829 source: "n = x.length;",2830 symbols: ["avg", "i", "length", "n", "sum", "x"],2831 comment: "",2832 transition:2833 function ()2834 {2835 this.n = this.x.length;2836 this._SetState (7, false);2837 }2838 },2839 { // State 72840 source: "sum = 0;",2841 symbols: ["avg", "i", "length", "n", "sum", "x"],2842 comment: "",2843 transition:2844 function ()2845 {2846 this.sum = 0;2847 this._SetState (8, false);2848 }2849 },2850 { // State 82851 source: "for (i = 0; i < n; i++)",2852 symbols: ["avg", "i", "length", "n", "sum", "x"],2853 comment: "",2854 transition:2855 function ()2856 {2857 this.i = 0;2858 this._SetState (9, false);2859 }2860 },2861 { // State 92862 source: "{",2863 symbols: ["avg", "i", "length", "n", "sum", "x"],2864 comment: "",2865 transition:2866 function ()2867 {2868 if (this.i < this.n)2869 {2870 this._SetState (10, false);2871 }2872 else2873 {2874 this._SetState (12, false);2875 }2876 }2877 },2878 { // State 102879 source: " sum += x [i];",2880 symbols: ["avg", "i", "length", "n", "sum", "x"],2881 comment: "",2882 transition:2883 function ()2884 {2885 this.sum += this.x [this.i];2886 this._SetState (11, false);2887 }2888 },2889 { // State 112890 source: "}",2891 symbols: ["avg", "i", "length", "n", "sum", "x"],2892 comment: "",2893 transition:2894 function ()2895 {2896 this.i++;2897 this._SetState (9, false);2898 }2899 },2900 { // State 122901 source: "avg = sum / n;",2902 symbols: ["avg", "i", "length", "n", "sum", "x"],2903 comment: "",2904 transition:2905 function ()2906 {2907 this.avg = this.sum / this.n;2908 this._SetState (14, false);2909 }2910 },2911 { // State 132912 source: "",2913 symbols: ["avg", "i", "length", "n", "sum", "x"],2914 comment: "",2915 transition:2916 function ()2917 {2918 }2919 },2920 { // State 142921 source: "console.log (\"Average value: \" + avg);",2922 symbols: ["avg", "i", "length", "n", "sum", "x"],2923 comment: "",2924 transition:2925 function ()2926 {2927 console.log ("Average value: " + this.avg);2928 this._SetState (15, true);2929 }2930 },2931 { // State 152932 source: "/* End */",2933 symbols: ["avg", "i", "length", "n", "sum", "x"],2934 comment: "",2935 transition: function (){}2936 }2937 ]2938 };2939 2940 window.it001.gProgramRepository ["it001_Ex_07_180"] =2941 {2942 globals:2943 {2944 symbols: ["x", "y"]2945 },2946 transitionTable:2947 [2948 { // State 02949 source: "/* Prints the squares of all values in [1, 3] to the console. */",2950 symbols: ["x", "y"],2951 comment: "",2952 transition:2953 function ()2954 {2955 this._SetState (1, false);2956 }2957 },2958 { // State 12959 source: "var x = 1;",2960 symbols: ["x", "y"],2961 comment: "",2962 transition:2963 function ()2964 {2965 this.x = 1;2966 this._SetState (2, false);2967 }2968 },2969 { // State 22970 source: "while (x <= 3)",2971 symbols: ["x", "y"],2972 comment: "",2973 transition:2974 function ()2975 {2976 if (this.x <= 3)2977 {2978 this._SetState (4, false);2979 }2980 else2981 {2982 this._SetState (9, true);2983 }2984 }2985 },2986 { // State 32987 source: "{",2988 symbols: ["x", "y"],2989 comment: "",2990 transition:2991 function ()2992 {2993 }2994 },2995 { // State 42996 source: " y = x * x;",2997 symbols: ["x", "y"],2998 comment: "",2999 transition:3000 function ()3001 {3002 this.y = this.x * this.x;3003 this._SetState (5, false);3004 }3005 },3006 { // State 53007 source: " console.log (\"x = \" + x + \", y = \" + y);",3008 symbols: ["x", "y"],3009 comment: "",3010 transition:3011 function ()3012 {3013 console.log ("x = " + this.x + ", y = " + this.y);3014 this._SetState (7, false);3015 }3016 },3017 { // State 63018 source: "",3019 symbols: ["x", "y"],3020 comment: "",3021 transition:3022 function ()3023 {3024 }3025 },3026 { // State 73027 source: " x++;",3028 symbols: ["x", "y"],3029 comment: "",3030 transition:3031 function ()3032 {3033 this.x++;3034 this._SetState (2, false);3035 }3036 },3037 { // State 83038 source: "}",3039 symbols: ["x", "y"],3040 comment: "",3041 transition:3042 function ()3043 {3044 }3045 },3046 { // State 93047 source: "/* End */",3048 symbols: ["x", "y"],3049 comment: "",3050 transition: function (){}3051 }3052 ]3053 };3054 3055 window.it001.gProgramRepository ["it001_Ex_07_190"] =3056 {3057 globals:3058 {3059 symbols: ["bit", "num", "out"]3060 },3061 transitionTable:3062 [3063 { // State 03064 source: "var num = 6;",3065 symbols: ["bit", "num", "out"],3066 comment: "",3067 transition:3068 function ()3069 {3070 this.num = 6;3071 this._SetState (3, false);3072 }3073 },3074 { // State 13075 source: "var out;",3076 symbols: ["bit", "num", "out"],3077 comment: "",3078 transition:3079 function ()3080 {3081 }3082 },3083 { // State 23084 source: "",3085 symbols: ["bit", "num", "out"],3086 comment: "",3087 transition:3088 function ()3089 {3090 }3091 },3092 { // State 33093 source: "out = \"\";",3094 symbols: ["bit", "num", "out"],3095 comment: "",3096 transition:3097 function ()3098 {3099 this.out = "";3100 this._SetState (4, false);3101 }3102 },3103 { // State 43104 source: "while (num >= 1)",3105 symbols: ["bit", "num", "out"],3106 comment: "",3107 transition:3108 function ()3109 {3110 if (this.num >= 1)3111 {3112 this._SetState (6, false);3113 }3114 else3115 {3116 this._SetState (10, false);3117 }3118 }3119 },3120 { // State 53121 source: "{",3122 symbols: ["bit", "num", "out"],3123 comment: "",3124 transition:3125 function ()3126 {3127 }3128 },3129 { // State 63130 source: " bit = num & 1;",3131 symbols: ["bit", "num", "out"],3132 comment: "",3133 transition:3134 function ()3135 {3136 this.bit = this.num & 1;3137 this._SetState (7, false);3138 }3139 },3140 { // State 73141 source: " num = num >>> 1;",3142 symbols: ["bit", "num", "out"],3143 comment: "",3144 transition:3145 function ()3146 {3147 this.num = this.num >>> 1;3148 this._SetState (8, false);3149 }3150 },3151 { // State 83152 source: " out = \"\" + bit + out;",3153 symbols: ["bit", "num", "out"],3154 comment: "",3155 transition:3156 function ()3157 {3158 this.out = "" + this.bit + this.out;3159 this._SetState (4, false);3160 }3161 },3162 { // State 93163 source: "}",3164 symbols: ["bit", "num", "out"],3165 comment: "",3166 transition:3167 function ()3168 {3169 }3170 },3171 { // State 103172 source: "console.log (out);",3173 symbols: ["bit", "num", "out"],3174 comment: "",3175 transition:3176 function ()3177 {3178 console.log (this.out);3179 this._SetState (11, true);3180 }3181 },3182 { // State 113183 source: "/* End */",3184 symbols: ["bit", "num", "out"],3185 comment: "",3186 transition: function (){}3187 }3188 ]3189 };3190 3191 window.it001.gProgramRepository ["it001_Ex_07_200"] =3192 {3193 globals:3194 {3195 symbols: ["x", "y"]3196 },3197 transitionTable:3198 [3199 { // State 03200 source: "/* Prints the squares of all values in [1, 3] to the console. */",3201 symbols: ["x", "y"],3202 comment: "",3203 transition:3204 function ()3205 {3206 this._SetState (1, false);3207 }3208 },3209 { // State 13210 source: "var x = 1;",3211 symbols: ["x", "y"],3212 comment: "",3213 transition:3214 function ()3215 {3216 this.x = 1; 3217 this._SetState (2, false);3218 }3219 },3220 { // State 23221 source: "do",3222 symbols: ["x", "y"],3223 comment: "",3224 transition:3225 function ()3226 {3227 this._SetState (4, false);3228 }3229 },3230 { // State 33231 source: "{",3232 symbols: ["x", "y"],3233 comment: "",3234 transition:3235 function ()3236 {3237 }3238 },3239 { // State 43240 source: " y = x * x;",3241 symbols: ["x", "y"],3242 comment: "",3243 transition:3244 function ()3245 {3246 this.y = this.x * this.x;3247 this._SetState (5, false);3248 }3249 },3250 { // State 53251 source: " console.log (\"x = \" + x + \", y = \" + y);",3252 symbols: ["x", "y"],3253 comment: "",3254 transition:3255 function ()3256 {3257 console.log ("x = " + this.x + ", y = " + this.y);3258 this._SetState (7, false);3259 }3260 },3261 { // State 63262 source: "",3263 symbols: ["x", "y"],3264 comment: "",3265 transition:3266 function ()3267 {3268 }3269 },3270 { // State 73271 source: " x++;",3272 symbols: ["x", "y"],3273 comment: "",3274 transition:3275 function ()3276 {3277 this.x++;3278 this._SetState (9, false);3279 }3280 },3281 { // State 83282 source: "}",3283 symbols: ["x", "y"],3284 comment: "",3285 transition:3286 function ()3287 {3288 }3289 },3290 { // State 93291 source: "while (x <= 3);",3292 symbols: ["x", "y"],3293 comment: "",3294 transition:3295 function ()3296 {3297 if (this.x <= 3)3298 {3299 this._SetState (4, false);3300 }3301 else3302 {3303 this._SetState (10, true);3304 }3305 }3306 },3307 { // State 103308 source: "/* End */",3309 symbols: ["x", "y"],3310 comment: "",3311 transition: function (){}3312 }3313 ]3314 };3315 3316 window.it001.gProgramRepository ["it001_Ex_07_210"] =3317 {3318 globals:3319 {3320 symbols: ["count", "rnd", "seed"]3321 },3322 transitionTable:3323 [3324 { // State 03325 source: "var seed = 5323;",3326 symbols: ["count", "rnd", "seed"],3327 comment: "",3328 transition:3329 function ()3330 {3331 this.seed = 5323;3332 this._SetState (4, false);3333 }3334 },3335 { // State 13336 source: "var rnd;",3337 symbols: ["count", "rnd", "seed"],3338 comment: "",3339 transition:3340 function ()3341 {3342 }3343 },3344 { // State 23345 source: "var count;",3346 symbols: ["count", "rnd", "seed"],3347 comment: "",3348 transition:3349 function ()3350 {3351 }3352 },3353 { // State 33354 source: "",3355 symbols: ["count", "rnd", "seed"],3356 comment: "",3357 transition:3358 function ()3359 {3360 }3361 },3362 { // State 43363 source: "count = 0;",3364 symbols: ["count", "rnd", "seed"],3365 comment: "",3366 transition:3367 function ()3368 {3369 this.count = 0;3370 this._SetState (5, false);3371 }3372 },3373 { // State 53374 source: "do",3375 symbols: ["count", "rnd", "seed"],3376 comment: "",3377 transition:3378 function ()3379 {3380 this._SetState (7, false);3381 }3382 },3383 { // State 63384 source: "{",3385 symbols: ["count", "rnd", "seed"],3386 comment: "",3387 transition:3388 function ()3389 {3390 }3391 },3392 { // State 73393 source: " seed = 8253729 * seed + 2396403;",3394 symbols: ["count", "rnd", "seed"],3395 comment: "",3396 transition:3397 function ()3398 {3399 this.seed = 8253729 * this.seed + 2396403;3400 this._SetState (8, false);3401 }3402 },3403 { // State 83404 source: " rnd = seed % 32767;",3405 symbols: ["count", "rnd", "seed"],3406 comment: "",3407 transition:3408 function ()3409 {3410 this.rnd = this.seed % 32767;3411 this._SetState (9, false);3412 }3413 },3414 { // State 93415 source: " count++;",3416 symbols: ["count", "rnd", "seed"],3417 comment: "",3418 transition:3419 function ()3420 {3421 this.count++;3422 this._SetState (11, false);3423 }3424 },3425 { // State 103426 source: "}",3427 symbols: ["count", "rnd", "seed"],3428 comment: "",3429 transition:3430 function ()3431 {3432 }3433 },3434 { // State 113435 source: "while (rnd >= 1000);",3436 symbols: ["count", "rnd", "seed"],3437 comment: "",3438 transition:3439 function ()3440 {3441 if (this.rnd >= 1000)3442 {3443 this._SetState (7, false);3444 }3445 else3446 {3447 this._SetState (12, false);3448 }3449 }3450 },3451 { // State 123452 source: "console.log (\"Number of iterations until rnd <= 1000: \" + count);",3453 symbols: ["count", "rnd", "seed"],3454 comment: "",3455 transition:3456 function ()3457 {3458 console.log ("Number of iterations until rnd <= 1000: " + this.count);3459 this._SetState (13, true);3460 }3461 },3462 { // State 133463 source: "/* End */",3464 symbols: ["count", "rnd", "seed"],3465 comment: "",3466 transition: function (){}3467 }3468 ]3469 };3470 3471 window.it001.gProgramRepository ["it001_Ex_07_220"] =3472 {3473 globals:3474 {3475 symbols: ["a"]3476 },3477 transitionTable:3478 [3479 { // State 03480 source: "var a = 10;",3481 symbols: ["a"],3482 comment: "",3483 transition:3484 function ()3485 {3486 this.a = 10;3487 this._SetState (1, false);3488 }3489 },3490 { // State 13491 source: "while (a >= 1)",3492 symbols: ["a"],3493 comment: "",3494 transition:3495 function ()3496 {3497 if (this.a >= 1)3498 {3499 this._SetState (3, false);3500 }3501 else3502 {3503 this._SetState (9, true);3504 }3505 }3506 },3507 { // State 23508 source: "{",3509 symbols: ["a"],3510 comment: "",3511 transition:3512 function ()3513 {3514 }3515 },3516 { // State 33517 source: " a--;",3518 symbols: ["a"],3519 comment: "",3520 transition:3521 function ()3522 {3523 this.a--;3524 this._SetState (4, false);3525 }3526 },3527 { // State 43528 source: " if (a <= 8)",3529 symbols: ["a"],3530 comment: "",3531 transition:3532 function ()3533 {3534 if (this.a <= 8)3535 {3536 this._SetState (6, false);3537 }3538 else3539 {3540 this._SetState (3, false);3541 }3542 }3543 },3544 { // State 53545 source: " {",3546 symbols: ["a"],3547 comment: "",3548 transition:3549 function ()3550 {3551 }3552 },3553 { // State 63554 source: " break;",3555 symbols: ["a"],3556 comment: "",3557 transition:3558 function ()3559 {3560 this._SetState (9, true);3561 }3562 },3563 { // State 73564 source: " }",3565 symbols: ["a"],3566 comment: "",3567 transition:3568 function ()3569 {3570 }3571 },3572 { // State 83573 source: "}",3574 symbols: ["a"],3575 comment: "",3576 transition:3577 function ()3578 {3579 }3580 },3581 { // State 93582 source: "/* End */",3583 symbols: ["a"],3584 comment: "",3585 transition: function (){}3586 }3587 ]3588 };...
GitCredentialsStore.ts
Source:GitCredentialsStore.ts
...88 const errorMessage = this._getErrorMessage(89 aliasUpdatePayload.isAliasInvalid,90 this._state.startValidatingAlias,91 FieldType.Alias);92 this._setState({93 alias: aliasUpdatePayload.alias,94 isAliasInvalid: aliasUpdatePayload.isAliasInvalid,95 aliasErrorMessage: errorMessage,96 } as GitCredentialsState);97 }98 public updatePassword = (passwordUpdatePayload: ActionsHub.PasswordUpdatePayload): void => {99 const errorMessage = this._getErrorMessage(100 passwordUpdatePayload.isPasswordInvalid,101 this._state.startValidatingPassword,102 FieldType.Password);103 const isReallyEdited = this._isReallyEdited(passwordUpdatePayload.password);104 this._setState({105 password: passwordUpdatePayload.password,106 isPasswordInvalid: passwordUpdatePayload.isPasswordInvalid,107 passwordErrorMessage: errorMessage,108 isAnyPasswordFieldEdited: isReallyEdited,109 arePasswordFieldsJustClearedOrReset: !isReallyEdited,110 } as GitCredentialsState);111 }112 public updateConfirmPassword = (confirmPasswordPayload: ActionsHub.ConfirmPasswordUpdatePayload): void => {113 const errorMessage = this._getErrorMessage(114 confirmPasswordPayload.isConfirmPasswordInvalid,115 this._state.startValidatingConfirmPassword,116 FieldType.ConfirmPassword);117 const isReallyEdited = this._isReallyEdited(confirmPasswordPayload.confirmPassword);118 this._setState({119 confirmPassword: confirmPasswordPayload.confirmPassword,120 isConfirmPasswordInvalid: confirmPasswordPayload.isConfirmPasswordInvalid,121 confirmPasswordErrorMessage: errorMessage,122 isAnyPasswordFieldEdited: isReallyEdited,123 arePasswordFieldsJustClearedOrReset: !isReallyEdited,124 } as GitCredentialsState);125 }126 public enableSaveGitCredentials = (): void => {127 this._setState({128 isSaveButtonDisabled: false,129 isAlternateCredentialsSavedSuccessfully: false,130 isAliasInvalid: false,131 isPasswordInvalid: false,132 isConfirmPasswordInvalid: false,133 } as GitCredentialsState);134 }135 public disableSaveGitCredentials = (): void => {136 this._setState({137 isSaveButtonDisabled: true,138 isAlternateCredentialsSavedSuccessfully: false,139 } as GitCredentialsState);140 }141 public startWaitingOnServer = (): void => {142 this._setState({143 errorMessage: null,144 waitingOnServer: true,145 } as GitCredentialsState);146 }147 public initializePatTokenData = (payload: ActionsHub.PatTokenDataPayload): void => {148 this._setState({149 patUsername: payload.patUsername,150 patPassword: payload.patPassword,151 waitingOnServer: false,152 } as GitCredentialsState);153 }154 public initializeAlternateCredentialsData = (payload: ActionsHub.AlternateCredentialsDataPayload): void => {155 this._setState({156 isSaveButtonDisabled: true,157 isAlternateCredentialsSavedSuccessfully: false,158 isBasicAuthEnabled: !payload.basicAuthDisabledOnAccount,159 primaryUsername: payload.primaryUsername,160 alias: payload.alias,161 serverAlias: payload.alias,162 isBasicAuthSet: payload.basicAuthHasPassword,163 waitingOnServer: false,164 } as GitCredentialsState);165 this._setPasswordFieldsAndValidationStates();166 }167 public generateGitCredentialsButtonClicked = (): void => {168 this._setState({169 isGenerateGitCredentialsButtonClicked: true,170 } as GitCredentialsState);171 }172 public showGitCredentialsError = (errorMessage: string): void => {173 this._setState({174 errorMessage: errorMessage,175 isSaveButtonDisabled: true,176 waitingOnServer: false,177 } as GitCredentialsState);178 }179 public hideGitCredentialsError = (): void => {180 this._setState({181 errorMessage: null,182 } as GitCredentialsState);183 }184 public updateAlternateCredentialsData = (alias: string): void => {185 this._setState({186 serverAlias: alias,187 isSaveButtonDisabled: true,188 isAlternateCredentialsSavedSuccessfully: true,189 isBasicAuthSet: true,190 waitingOnServer: false,191 } as GitCredentialsState);192 this._setPasswordFieldsAndValidationStates();193 setTimeout(() => {194 this._setState({195 isAlternateCredentialsSavedSuccessfully: false,196 } as GitCredentialsState);197 }, 2000);198 }199 public startValidatingAlias = (): void => {200 this._setState({201 startValidatingAlias: true,202 aliasErrorMessage: this._getErrorMessage(this._state.isAliasInvalid, true, FieldType.Alias),203 } as GitCredentialsState);204 }205 public startValidatingPassword = (): void => {206 this._setState({207 startValidatingPassword: true,208 passwordErrorMessage: this._getErrorMessage(this._state.isPasswordInvalid, true, FieldType.Password),209 } as GitCredentialsState);210 }211 public startValidatingConfirmPassword = (): void => {212 this._setState({213 startValidatingConfirmPassword: true,214 confirmPasswordErrorMessage: this._getErrorMessage(this._state.isConfirmPasswordInvalid, true, FieldType.ConfirmPassword),215 } as GitCredentialsState);216 }217 public clearPasswordFields = (): void => {218 this._setState({219 password: "",220 confirmPassword: "",221 arePasswordFieldsJustClearedOrReset: true,222 } as GitCredentialsState);223 }224 public resetPasswordFields = (): void => {225 this._setPasswordFieldsAndValidationStates(true);226 }227 private _getErrorMessage = (showError: boolean, validationStarted: boolean, fieldType: FieldType): string => {228 let errorMessage = '';229 if (showError && validationStarted) {230 switch (fieldType) {231 case FieldType.Alias:232 errorMessage = AccountResources.UseProfileUsernameSecondary;233 break;234 case FieldType.Password:235 errorMessage = VCResources.GitCredentialsPasswordNotStrong;236 break;237 case FieldType.ConfirmPassword:238 errorMessage = AccountResources.PasswordsDoNotMatch;239 break;240 }241 }242 return errorMessage;243 }244 private _getServerPassword = (): string => {245 return this._state.isBasicAuthSet ? SERVER_PASSWORD_STRING : Utils_String.empty;246 }247 private _isReallyEdited = (password: string): boolean => {248 return (!this._state.arePasswordFieldsJustClearedOrReset249 || (password !== Utils_String.empty && password !== SERVER_PASSWORD_STRING));250 }251 private _setPasswordFieldsAndValidationStates = (shouldSkipAlias?: boolean): void => {252 const serverPassword = this._getServerPassword();253 this._setState({254 password: serverPassword,255 confirmPassword: serverPassword,256 isAnyPasswordFieldEdited: false,257 startValidatingAlias: shouldSkipAlias ? this._state.startValidatingAlias : false,258 startValidatingPassword: false,259 startValidatingConfirmPassword: false,260 arePasswordFieldsJustClearedOrReset: this._state.isBasicAuthSet ? true : false,261 } as GitCredentialsState);262 }263 private _setState(partialState: GitCredentialsState): void {264 for (const key in partialState) {265 this._state[key] = partialState[key];266 }267 this.emitChanged();268 }...
ProfileScreen.js
Source:ProfileScreen.js
...50 componentDidMount() {51 for (var item in UserKeys) {52 if (UserKeys.hasOwnProperty(item)) {53 AsyncStorage.getItem(item.asyncKey).then((value) => {54 this._setState(item.stateKey, value)55 })56 }57 }58 }59 // updates state callback function60 _setState = (value, stateKey) => {61 this.setState({[stateKey]: value})62 } 63 render() {64 return(65 <View style = {styles.container}>66 <MainDrawerHeader title = 'Profile' navigation = {this.props.navigation}/>67 <ScrollView>68 <View style={styles.wrapper}>...
feodorov-tfl-lab2.js
Source:feodorov-tfl-lab2.js
...6 },7 process(data) {8 switch(data) {9 case "0":10 this._setState("L");11 break;12 case "1":13 this._setState("M");14 break;15 default:16 throw new Error(`Unexpected symbol [${data}].`);17 }18 }19 }],20 ["L", {21 enter() {22 this.push("y");23 },24 process(data) {25 switch(data) {26 case "0":27 this._setState("C");28 break;29 case "1":30 this._setState("J");31 break;32 default:33 throw new Error(`Unexpected symbol [${data}].`);34 }35 }36 }],37 ["M", {38 enter() {39 this.push("y");40 },41 process(data) {42 switch(data) {43 case "0":44 this._setState("E");45 break;46 case "1":47 this._setState("H");48 break;49 default:50 throw new Error(`Unexpected symbol [${data}].`);51 }52 }53 }],54 ["C", {55 enter() {56 this.push("z");57 },58 process(data) {59 switch(data) {60 case "0":61 this._setState("B");62 break;63 case "1":64 this._setState("D");65 break;66 default:67 throw new Error(`Unexpected symbol [${data}].`);68 }69 }70 }],71 ["D", {72 enter() {73 this.push("y");74 },75 process(data) {76 switch(data) {77 case "0":78 this._setState("E");79 break;80 default:81 throw new Error(`Unexpected symbol [${data}].`);82 }83 }84 }],85 ["J", {86 enter() {87 this.push("z");88 },89 process(data) {90 switch(data) {91 case "1":92 this._setState("I");93 break;94 default:95 throw new Error(`Unexpected symbol [${data}].`);96 }97 }98 }],99 ["B", {100 enter() {101 this.push("z");102 },103 process(data) {104 switch(data) {105 case "0":106 this._setState("C");107 break;108 default:109 throw new Error(`Unexpected symbol [${data}].`);110 }111 }112 }],113 ["I", {114 enter() {115 this.push("y");116 },117 process(data) {118 switch(data) {119 case "1":120 this._setState("J");121 break;122 default:123 throw new Error(`Unexpected symbol [${data}].`);124 }125 }126 }],127 ["H", {128 enter() {129 this.push("z");130 },131 process(data) {132 switch(data) {133 case "0":134 this._setState("I");135 break;136 case "1":137 this._setState("G");138 break;139 default:140 throw new Error(`Unexpected symbol [${data}].`);141 }142 }143 }],144 ["G", {145 enter() {146 this.push("z");147 },148 process(data) {149 switch(data) {150 case "1":151 this._setState("H");152 break;153 default:154 throw new Error(`Unexpected symbol [${data}].`);155 }156 }157 }],158 ["E", {159 enter() {160 this.push("z");161 },162 process(data) {163 switch(data) {164 case "0":165 this._setState("D");166 break;167 default:168 throw new Error(`Unexpected symbol [${data}].`);169 }170 }171 }]172]);173class DFA extends Transform {174 constructor(argv) {175 super(argv);176 this._state = states.get("A");177 }178 _transform(chunk, _encoding, callback) {179 const data = chunk.toString();180 try {181 this._processData(data);182 callback();183 }184 catch (e) {185 callback(e);186 }187 }188 _processData(data) {189 this._state.process.call(this, data);190 }191 _setState(state) {192 if (states.has(state)) {193 this._state = states.get(state);194 }195 else {196 throw new Error(`Unknown state [${state}]`);197 }198 this._state.enter.call(this);199 }200}201async function* generate() {202 yield '0';203 yield '0';204}205Readable.from(generate())...
Using AI Code Generation
1const { launch } = require('qawolf');2const browser = await launch();3const page = await browser.newPage();4await page.click('input[name="q"]');5await page.type('input[name="q"]', 'hello');6await page.click('input[name="btnK"]');7await page.waitForNavigation();8await page.close();9await browser.close();10const { launch } = require('qawolf');11const browser = await launch();12const page = await browser.newPage();13await page.evaluate(() => {14});15await page.type('input[name="q"]', 'hello');16await page.click('input[name="btnK"]');17await page.waitForNavigation();18await page.close();19await browser.close();20await page.evaluate(() => {
Using AI Code Generation
1const { _setState } = require("qawolf");2});3});4});5});6});7});8});9});10});11});12});13});14});
Using AI Code Generation
1const { _setState } = require('qawolf');2console.log(state);3console.log(state);4console.log(state);5console.log(state);6console.log(state);7console.log(state);8console.log(state);9console.log(state);10console.log(state);11console.log(state);12console.log(state);13console.log(state);
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!