@designliquido/delegua 0.36.1 → 0.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (490) hide show
  1. package/analisador-semantico/analisador-semantico-base.d.ts +69 -69
  2. package/analisador-semantico/analisador-semantico-base.js +180 -180
  3. package/analisador-semantico/analisador-semantico.d.ts +59 -59
  4. package/analisador-semantico/analisador-semantico.js +442 -442
  5. package/analisador-semantico/analisador-semantico.js.map +1 -1
  6. package/analisador-semantico/index.d.ts +3 -3
  7. package/analisador-semantico/index.js +19 -19
  8. package/analisador-semantico/pilha-variaveis.d.ts +20 -20
  9. package/analisador-semantico/pilha-variaveis.js +25 -25
  10. package/avaliador-sintatico/avaliador-sintatico-base.d.ts +69 -69
  11. package/avaliador-sintatico/avaliador-sintatico-base.js +223 -223
  12. package/avaliador-sintatico/avaliador-sintatico-base.js.map +1 -1
  13. package/avaliador-sintatico/avaliador-sintatico.d.ts +126 -126
  14. package/avaliador-sintatico/avaliador-sintatico.js +1093 -1093
  15. package/avaliador-sintatico/avaliador-sintatico.js.map +1 -1
  16. package/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.d.ts +73 -73
  17. package/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js +648 -648
  18. package/avaliador-sintatico/dialetos/avaliador-sintatico-egua-classico.js.map +1 -1
  19. package/avaliador-sintatico/dialetos/avaliador-sintatico-guarani.d.ts +21 -21
  20. package/avaliador-sintatico/dialetos/avaliador-sintatico-guarani.js +149 -149
  21. package/avaliador-sintatico/dialetos/avaliador-sintatico-guarani.js.map +1 -1
  22. package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.d.ts +87 -87
  23. package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.js +770 -770
  24. package/avaliador-sintatico/dialetos/avaliador-sintatico-pitugues.js.map +1 -1
  25. package/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-ipt.d.ts +34 -34
  26. package/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-ipt.js +168 -168
  27. package/avaliador-sintatico/dialetos/avaliador-sintatico-portugol-ipt.js.map +1 -1
  28. package/avaliador-sintatico/dialetos/index.d.ts +3 -3
  29. package/avaliador-sintatico/dialetos/index.js +19 -19
  30. package/avaliador-sintatico/erro-avaliador-sintatico.d.ts +5 -5
  31. package/avaliador-sintatico/erro-avaliador-sintatico.js +11 -11
  32. package/avaliador-sintatico/index.d.ts +6 -6
  33. package/avaliador-sintatico/index.js +22 -22
  34. package/avaliador-sintatico/micro-avaliador-sintatico-base.d.ts +27 -27
  35. package/avaliador-sintatico/micro-avaliador-sintatico-base.js +116 -116
  36. package/avaliador-sintatico/micro-avaliador-sintatico-base.js.map +1 -1
  37. package/avaliador-sintatico/micro-avaliador-sintatico.d.ts +33 -33
  38. package/avaliador-sintatico/micro-avaliador-sintatico.js +287 -287
  39. package/avaliador-sintatico/micro-avaliador-sintatico.js.map +1 -1
  40. package/avaliador-sintatico/retornos/index.d.ts +3 -3
  41. package/avaliador-sintatico/retornos/index.js +19 -19
  42. package/avaliador-sintatico/retornos/retorno-declaracao.d.ts +3 -3
  43. package/avaliador-sintatico/retornos/retorno-declaracao.js +2 -2
  44. package/avaliador-sintatico/retornos/retorno-primario.d.ts +3 -3
  45. package/avaliador-sintatico/retornos/retorno-primario.js +2 -2
  46. package/avaliador-sintatico/retornos/retorno-resolver-declaracao.d.ts +2 -2
  47. package/avaliador-sintatico/retornos/retorno-resolver-declaracao.js +2 -2
  48. package/avaliador-sintatico/traducao/avaliador-sintatico-javascript.d.ts +59 -59
  49. package/avaliador-sintatico/traducao/avaliador-sintatico-javascript.js +150 -150
  50. package/bibliotecas/biblioteca-global.d.ts +157 -157
  51. package/bibliotecas/biblioteca-global.js +497 -498
  52. package/bibliotecas/biblioteca-global.js.map +1 -1
  53. package/bibliotecas/dialetos/egua-classico/biblioteca-global.d.ts +1 -1
  54. package/bibliotecas/dialetos/egua-classico/biblioteca-global.js +236 -236
  55. package/bibliotecas/dialetos/egua-classico/biblioteca-global.js.map +1 -1
  56. package/bibliotecas/dialetos/egua-classico/index.d.ts +2 -2
  57. package/bibliotecas/dialetos/egua-classico/index.js +32 -32
  58. package/bibliotecas/dialetos/egua-classico/index.js.map +1 -1
  59. package/bibliotecas/dialetos/egua-classico/matematica.d.ts +1 -1
  60. package/bibliotecas/dialetos/egua-classico/matematica.js +541 -541
  61. package/bibliotecas/dialetos/egua-classico/matematica.js.map +1 -1
  62. package/bibliotecas/dialetos/egua-classico/tempo.d.ts +1 -1
  63. package/bibliotecas/dialetos/egua-classico/tempo.js +39 -39
  64. package/bibliotecas/dialetos/egua-classico/tempo.js.map +1 -1
  65. package/bibliotecas/dialetos/egua-classico/textos.d.ts +8 -8
  66. package/bibliotecas/dialetos/egua-classico/textos.js +201 -201
  67. package/bibliotecas/dialetos/egua-classico/textos.js.map +1 -1
  68. package/bibliotecas/primitivas-dicionario.d.ts +6 -6
  69. package/bibliotecas/primitivas-dicionario.d.ts.map +1 -1
  70. package/bibliotecas/primitivas-dicionario.js +10 -10
  71. package/bibliotecas/primitivas-numero.d.ts +6 -6
  72. package/bibliotecas/primitivas-numero.d.ts.map +1 -1
  73. package/bibliotecas/primitivas-numero.js +10 -10
  74. package/bibliotecas/primitivas-texto.d.ts +17 -17
  75. package/bibliotecas/primitivas-texto.d.ts.map +1 -1
  76. package/bibliotecas/primitivas-texto.js +22 -22
  77. package/bibliotecas/primitivas-texto.js.map +1 -1
  78. package/bibliotecas/primitivas-vetor.d.ts +21 -21
  79. package/bibliotecas/primitivas-vetor.d.ts.map +1 -1
  80. package/bibliotecas/primitivas-vetor.js +90 -90
  81. package/bibliotecas/primitivas-vetor.js.map +1 -1
  82. package/bin/package.json +5 -4
  83. package/construtos/acesso-elemento-matriz.d.ts +12 -12
  84. package/construtos/acesso-elemento-matriz.js +17 -17
  85. package/construtos/acesso-indice-variavel.d.ts +15 -15
  86. package/construtos/acesso-indice-variavel.js +20 -20
  87. package/construtos/acesso-metodo-ou-propriedade.d.ts +14 -14
  88. package/construtos/acesso-metodo-ou-propriedade.js +19 -19
  89. package/construtos/agrupamento.d.ts +14 -14
  90. package/construtos/agrupamento.js +19 -19
  91. package/construtos/atribuicao-por-indice.d.ts +11 -11
  92. package/construtos/atribuicao-por-indice.js +16 -16
  93. package/construtos/atribuicao-por-indices-matriz.d.ts +12 -12
  94. package/construtos/atribuicao-por-indices-matriz.js +17 -17
  95. package/construtos/atribuir.d.ts +15 -15
  96. package/construtos/atribuir.js +24 -24
  97. package/construtos/atribuir.js.map +1 -1
  98. package/construtos/binario.d.ts +33 -33
  99. package/construtos/binario.js +38 -38
  100. package/construtos/chamada.d.ts +15 -15
  101. package/construtos/chamada.js +21 -21
  102. package/construtos/comentario.d.ts +15 -15
  103. package/construtos/comentario.js +20 -20
  104. package/construtos/constante.d.ts +12 -12
  105. package/construtos/constante.js +17 -17
  106. package/construtos/construto.d.ts +7 -7
  107. package/construtos/construto.js +2 -2
  108. package/construtos/decorador.d.ts +14 -14
  109. package/construtos/decorador.js +19 -19
  110. package/construtos/definir-valor.d.ts +11 -11
  111. package/construtos/definir-valor.js +16 -16
  112. package/construtos/dicionario.d.ts +10 -10
  113. package/construtos/dicionario.js +15 -15
  114. package/construtos/expressao-regular.d.ts +10 -10
  115. package/construtos/expressao-regular.js +15 -15
  116. package/construtos/fim-para.d.ts +22 -22
  117. package/construtos/fim-para.js +25 -25
  118. package/construtos/formatacao-escrita.d.ts +16 -16
  119. package/construtos/formatacao-escrita.js +21 -21
  120. package/construtos/funcao.d.ts +12 -12
  121. package/construtos/funcao.js +16 -16
  122. package/construtos/index.d.ts +29 -29
  123. package/construtos/index.js +45 -45
  124. package/construtos/isto.d.ts +9 -9
  125. package/construtos/isto.js +14 -14
  126. package/construtos/literal.d.ts +10 -10
  127. package/construtos/literal.js +14 -14
  128. package/construtos/logico.d.ts +11 -11
  129. package/construtos/logico.js +16 -16
  130. package/construtos/qual-tipo.d.ts +11 -11
  131. package/construtos/qual-tipo.js +16 -16
  132. package/construtos/super.d.ts +10 -10
  133. package/construtos/super.js +15 -15
  134. package/construtos/tipo-de.d.ts +10 -10
  135. package/construtos/tipo-de.js +15 -15
  136. package/construtos/tuplas/deceto.d.ts +18 -18
  137. package/construtos/tuplas/deceto.js +32 -32
  138. package/construtos/tuplas/dupla.d.ts +6 -6
  139. package/construtos/tuplas/dupla.js +12 -12
  140. package/construtos/tuplas/index.d.ts +13 -13
  141. package/construtos/tuplas/index.js +67 -67
  142. package/construtos/tuplas/index.js.map +1 -1
  143. package/construtos/tuplas/noneto.d.ts +15 -15
  144. package/construtos/tuplas/noneto.js +25 -25
  145. package/construtos/tuplas/octeto.d.ts +14 -14
  146. package/construtos/tuplas/octeto.js +24 -24
  147. package/construtos/tuplas/quarteto.d.ts +8 -8
  148. package/construtos/tuplas/quarteto.js +14 -14
  149. package/construtos/tuplas/quinteto.d.ts +9 -9
  150. package/construtos/tuplas/quinteto.js +15 -15
  151. package/construtos/tuplas/septeto.d.ts +13 -13
  152. package/construtos/tuplas/septeto.js +23 -23
  153. package/construtos/tuplas/sexteto.d.ts +10 -10
  154. package/construtos/tuplas/sexteto.js +16 -16
  155. package/construtos/tuplas/trio.d.ts +7 -7
  156. package/construtos/tuplas/trio.js +13 -13
  157. package/construtos/tuplas/tupla.d.ts +8 -8
  158. package/construtos/tuplas/tupla.js +9 -9
  159. package/construtos/unario.d.ts +11 -11
  160. package/construtos/unario.js +16 -16
  161. package/construtos/variavel.d.ts +9 -9
  162. package/construtos/variavel.js +14 -14
  163. package/construtos/vetor.d.ts +11 -11
  164. package/construtos/vetor.js +21 -21
  165. package/construtos/vetor.js.map +1 -1
  166. package/declaracoes/aleatorio.d.ts +15 -15
  167. package/declaracoes/aleatorio.js +15 -15
  168. package/declaracoes/bloco.d.ts +7 -7
  169. package/declaracoes/bloco.js +14 -14
  170. package/declaracoes/cabecalho-programa.d.ts +7 -7
  171. package/declaracoes/cabecalho-programa.js +14 -14
  172. package/declaracoes/classe.d.ts +14 -14
  173. package/declaracoes/classe.js +18 -18
  174. package/declaracoes/const-multiplo.d.ts +14 -14
  175. package/declaracoes/const-multiplo.js +19 -19
  176. package/declaracoes/const.d.ts +14 -14
  177. package/declaracoes/const.js +19 -19
  178. package/declaracoes/continua.d.ts +6 -6
  179. package/declaracoes/continua.js +13 -13
  180. package/declaracoes/declaracao.d.ts +8 -8
  181. package/declaracoes/declaracao.js +17 -17
  182. package/declaracoes/enquanto.d.ts +10 -10
  183. package/declaracoes/enquanto.js +15 -15
  184. package/declaracoes/escolha.d.ts +14 -14
  185. package/declaracoes/escolha.js +19 -19
  186. package/declaracoes/escreva-mesma-linha.d.ts +8 -8
  187. package/declaracoes/escreva-mesma-linha.js +14 -14
  188. package/declaracoes/escreva.d.ts +8 -8
  189. package/declaracoes/escreva.js +14 -14
  190. package/declaracoes/expressao.d.ts +8 -8
  191. package/declaracoes/expressao.js +14 -14
  192. package/declaracoes/falhar.d.ts +8 -8
  193. package/declaracoes/falhar.js +15 -15
  194. package/declaracoes/fazer.d.ts +10 -10
  195. package/declaracoes/fazer.js +15 -15
  196. package/declaracoes/funcao.d.ts +11 -11
  197. package/declaracoes/funcao.js +17 -17
  198. package/declaracoes/importar.d.ts +9 -9
  199. package/declaracoes/importar.js +15 -15
  200. package/declaracoes/index.d.ts +31 -31
  201. package/declaracoes/index.js +47 -47
  202. package/declaracoes/inicio-algoritmo.d.ts +6 -6
  203. package/declaracoes/inicio-algoritmo.js +13 -13
  204. package/declaracoes/leia-multiplo.d.ts +14 -14
  205. package/declaracoes/leia-multiplo.js +21 -21
  206. package/declaracoes/leia.d.ts +17 -17
  207. package/declaracoes/leia.js +21 -21
  208. package/declaracoes/para-cada.d.ts +11 -11
  209. package/declaracoes/para-cada.js +17 -17
  210. package/declaracoes/para.d.ts +19 -19
  211. package/declaracoes/para.js +24 -24
  212. package/declaracoes/propriedade-classe.d.ts +10 -10
  213. package/declaracoes/propriedade-classe.js +16 -16
  214. package/declaracoes/retorna.d.ts +8 -8
  215. package/declaracoes/retorna.js +15 -15
  216. package/declaracoes/se.d.ts +11 -11
  217. package/declaracoes/se.js +17 -17
  218. package/declaracoes/sustar.d.ts +6 -6
  219. package/declaracoes/sustar.js +13 -13
  220. package/declaracoes/tendo-como.d.ts +16 -16
  221. package/declaracoes/tendo-como.js +21 -21
  222. package/declaracoes/tente.d.ts +14 -14
  223. package/declaracoes/tente.js +20 -20
  224. package/declaracoes/var-multiplo.d.ts +15 -15
  225. package/declaracoes/var-multiplo.js +20 -20
  226. package/declaracoes/var.d.ts +16 -16
  227. package/declaracoes/var.js +21 -21
  228. package/depuracao/cyrb53.d.ts +9 -9
  229. package/depuracao/cyrb53.js +22 -22
  230. package/depuracao/cyrb53.js.map +1 -1
  231. package/depuracao/index.d.ts +2 -2
  232. package/depuracao/index.js +23 -23
  233. package/depuracao/ponto-parada.d.ts +4 -4
  234. package/depuracao/ponto-parada.js +2 -2
  235. package/espaco-variaveis.d.ts +19 -19
  236. package/espaco-variaveis.js +19 -19
  237. package/estruturas/chamavel.d.ts +7 -7
  238. package/estruturas/chamavel.js +12 -12
  239. package/estruturas/classe-padrao.d.ts +31 -31
  240. package/estruturas/classe-padrao.js +39 -39
  241. package/estruturas/delegua-funcao.d.ts +29 -29
  242. package/estruturas/delegua-funcao.js +141 -141
  243. package/estruturas/delegua-funcao.js.map +1 -1
  244. package/estruturas/descritor-tipo-classe.d.ts +37 -37
  245. package/estruturas/descritor-tipo-classe.js +79 -79
  246. package/estruturas/descritor-tipo-classe.js.map +1 -1
  247. package/estruturas/funcao-padrao.d.ts +23 -23
  248. package/estruturas/funcao-padrao.js +34 -34
  249. package/estruturas/index.d.ts +9 -9
  250. package/estruturas/index.js +25 -25
  251. package/estruturas/metodo-primitiva.d.ts +28 -28
  252. package/estruturas/metodo-primitiva.js +40 -40
  253. package/estruturas/modulo.d.ts +18 -18
  254. package/estruturas/modulo.js +24 -24
  255. package/estruturas/objeto-delegua-classe.d.ts +26 -26
  256. package/estruturas/objeto-delegua-classe.js +53 -53
  257. package/estruturas/objeto-delegua-classe.js.map +1 -1
  258. package/estruturas/objeto-padrao.d.ts +18 -18
  259. package/estruturas/objeto-padrao.js +32 -32
  260. package/estruturas/objeto-padrao.js.map +1 -1
  261. package/excecoes/erro-em-tempo-de-execucao.d.ts +7 -7
  262. package/excecoes/erro-em-tempo-de-execucao.js +13 -13
  263. package/excecoes/index.d.ts +1 -1
  264. package/excecoes/index.js +17 -17
  265. package/formatadores/formatador-delegua.d.ts +79 -79
  266. package/formatadores/formatador-delegua.js +676 -676
  267. package/formatadores/formatador-delegua.js.map +1 -1
  268. package/formatadores/index.d.ts +1 -1
  269. package/formatadores/index.js +17 -17
  270. package/geracao-identificadores/index.d.ts +1 -1
  271. package/geracao-identificadores/index.js +22 -23
  272. package/geracao-identificadores/index.js.map +1 -1
  273. package/index.d.ts +9 -9
  274. package/index.js +27 -27
  275. package/interfaces/analisador-semantico-interface.d.ts +6 -6
  276. package/interfaces/analisador-semantico-interface.js +2 -2
  277. package/interfaces/avaliador-sintatico-interface.d.ts +55 -55
  278. package/interfaces/avaliador-sintatico-interface.js +2 -2
  279. package/interfaces/construtos/index.d.ts +4 -4
  280. package/interfaces/construtos/index.js +2 -2
  281. package/interfaces/erros/diagnostico-analisador-semantico.d.ts +14 -14
  282. package/interfaces/erros/diagnostico-analisador-semantico.js +10 -10
  283. package/interfaces/erros/diagnostico-analisador-semantico.js.map +1 -1
  284. package/interfaces/erros/erro-interpretador.d.ts +8 -8
  285. package/interfaces/erros/erro-interpretador.js +2 -2
  286. package/interfaces/erros/index.d.ts +1 -1
  287. package/interfaces/erros/index.js +17 -17
  288. package/interfaces/escopo-execucao.d.ts +12 -12
  289. package/interfaces/escopo-execucao.js +2 -2
  290. package/interfaces/formatador-comum-interface.d.ts +11 -11
  291. package/interfaces/formatador-comum-interface.js +2 -2
  292. package/interfaces/funcao-hipotetica-interface.d.ts +3 -3
  293. package/interfaces/funcao-hipotetica-interface.js +2 -2
  294. package/interfaces/index.d.ts +16 -16
  295. package/interfaces/index.js +32 -32
  296. package/interfaces/interpretador-com-depuracao-interface.d.ts +17 -17
  297. package/interfaces/interpretador-com-depuracao-interface.js +2 -2
  298. package/interfaces/interpretador-interface-potigol.d.ts +5 -5
  299. package/interfaces/interpretador-interface-potigol.js +2 -2
  300. package/interfaces/interpretador-interface.d.ts +20 -20
  301. package/interfaces/interpretador-interface.js +2 -2
  302. package/interfaces/lexador-interface.d.ts +23 -23
  303. package/interfaces/lexador-interface.js +2 -2
  304. package/interfaces/parametro-interface.d.ts +15 -15
  305. package/interfaces/parametro-interface.js +2 -2
  306. package/interfaces/pilha-escopos-execucao-interface.d.ts +26 -26
  307. package/interfaces/pilha-escopos-execucao-interface.js +2 -2
  308. package/interfaces/pilha-interface.d.ts +7 -7
  309. package/interfaces/pilha-interface.js +2 -2
  310. package/interfaces/resolvedor-interface.d.ts +41 -41
  311. package/interfaces/resolvedor-interface.js +2 -2
  312. package/interfaces/retornos/index.d.ts +4 -4
  313. package/interfaces/retornos/index.js +20 -20
  314. package/interfaces/retornos/retorno-analisador-semantico.d.ts +4 -4
  315. package/interfaces/retornos/retorno-analisador-semantico.js +2 -2
  316. package/interfaces/retornos/retorno-avaliador-sintatico.d.ts +5 -5
  317. package/interfaces/retornos/retorno-avaliador-sintatico.js +2 -2
  318. package/interfaces/retornos/retorno-execucao-interface.d.ts +5 -5
  319. package/interfaces/retornos/retorno-execucao-interface.js +2 -2
  320. package/interfaces/retornos/retorno-interpretador.d.ts +5 -5
  321. package/interfaces/retornos/retorno-interpretador.js +2 -2
  322. package/interfaces/retornos/retorno-lexador.d.ts +9 -9
  323. package/interfaces/retornos/retorno-lexador.js +2 -2
  324. package/interfaces/simbolo-interface.d.ts +7 -7
  325. package/interfaces/simbolo-interface.js +2 -2
  326. package/interfaces/tradutor-interface.d.ts +3 -3
  327. package/interfaces/tradutor-interface.js +2 -2
  328. package/interfaces/variavel-hipotetica-interface.d.ts +8 -8
  329. package/interfaces/variavel-hipotetica-interface.js +2 -2
  330. package/interfaces/variavel-interface.d.ts +8 -8
  331. package/interfaces/variavel-interface.js +2 -2
  332. package/interfaces/visitante-comum-interface.d.ts +58 -58
  333. package/interfaces/visitante-comum-interface.js +2 -2
  334. package/interpretador/argumento-interface.d.ts +4 -4
  335. package/interpretador/argumento-interface.js +2 -2
  336. package/interpretador/comum.d.ts +2 -2
  337. package/interpretador/comum.js +51 -52
  338. package/interpretador/comum.js.map +1 -1
  339. package/interpretador/dialetos/egua-classico/index.d.ts +1 -1
  340. package/interpretador/dialetos/egua-classico/index.js +17 -17
  341. package/interpretador/dialetos/egua-classico/interpretador-egua-classico.d.ts +119 -119
  342. package/interpretador/dialetos/egua-classico/interpretador-egua-classico.js +815 -815
  343. package/interpretador/dialetos/egua-classico/interpretador-egua-classico.js.map +1 -1
  344. package/interpretador/dialetos/egua-classico/resolvedor/erro-resolvedor.d.ts +5 -5
  345. package/interpretador/dialetos/egua-classico/resolvedor/erro-resolvedor.js +11 -11
  346. package/interpretador/dialetos/egua-classico/resolvedor/index.d.ts +3 -3
  347. package/interpretador/dialetos/egua-classico/resolvedor/index.js +19 -19
  348. package/interpretador/dialetos/egua-classico/resolvedor/pilha-escopos.d.ts +9 -9
  349. package/interpretador/dialetos/egua-classico/resolvedor/pilha-escopos.js +25 -25
  350. package/interpretador/dialetos/egua-classico/resolvedor/resolvedor.d.ts +106 -106
  351. package/interpretador/dialetos/egua-classico/resolvedor/resolvedor.js +441 -441
  352. package/interpretador/dialetos/egua-classico/resolvedor/resolvedor.js.map +1 -1
  353. package/interpretador/dialetos/egua-classico/resolvedor/retorno-resolvedor.d.ts +6 -6
  354. package/interpretador/dialetos/egua-classico/resolvedor/retorno-resolvedor.js +2 -2
  355. package/interpretador/dialetos/index.d.ts +2 -2
  356. package/interpretador/dialetos/index.js +18 -18
  357. package/interpretador/dialetos/portugol-ipt/index.d.ts +1 -1
  358. package/interpretador/dialetos/portugol-ipt/index.js +17 -17
  359. package/interpretador/dialetos/portugol-ipt/interpretador-portugol-ipt.d.ts +133 -133
  360. package/interpretador/dialetos/portugol-ipt/interpretador-portugol-ipt.js +501 -501
  361. package/interpretador/dialetos/portugol-ipt/interpretador-portugol-ipt.js.map +1 -1
  362. package/interpretador/index.d.ts +3 -3
  363. package/interpretador/index.js +19 -19
  364. package/interpretador/inferenciador.d.ts +15 -15
  365. package/interpretador/inferenciador.d.ts.map +1 -1
  366. package/interpretador/inferenciador.js +80 -80
  367. package/interpretador/inferenciador.js.map +1 -1
  368. package/interpretador/interpretador-base.d.ts +268 -268
  369. package/interpretador/interpretador-base.js +1399 -1399
  370. package/interpretador/interpretador-base.js.map +1 -1
  371. package/interpretador/interpretador-com-depuracao.d.ts +190 -190
  372. package/interpretador/interpretador-com-depuracao.js +568 -568
  373. package/interpretador/interpretador-com-depuracao.js.map +1 -1
  374. package/interpretador/pilha-escopos-execucao.d.ts +39 -39
  375. package/interpretador/pilha-escopos-execucao.js +243 -243
  376. package/interpretador/pilha-escopos-execucao.js.map +1 -1
  377. package/lexador/dialetos/index.d.ts +4 -4
  378. package/lexador/dialetos/index.js +20 -20
  379. package/lexador/dialetos/lexador-egua-classico.d.ts +36 -36
  380. package/lexador/dialetos/lexador-egua-classico.js +286 -286
  381. package/lexador/dialetos/lexador-egua-classico.js.map +1 -1
  382. package/lexador/dialetos/lexador-guarani.d.ts +10 -10
  383. package/lexador/dialetos/lexador-guarani.js +113 -113
  384. package/lexador/dialetos/lexador-guarani.js.map +1 -1
  385. package/lexador/dialetos/lexador-pitugues.d.ts +51 -51
  386. package/lexador/dialetos/lexador-pitugues.js +398 -398
  387. package/lexador/dialetos/lexador-pitugues.js.map +1 -1
  388. package/lexador/dialetos/lexador-portugol-ipt.d.ts +33 -33
  389. package/lexador/dialetos/lexador-portugol-ipt.js +237 -237
  390. package/lexador/dialetos/lexador-portugol-ipt.js.map +1 -1
  391. package/lexador/dialetos/palavras-reservadas/egua-classico.d.ts +32 -32
  392. package/lexador/dialetos/palavras-reservadas/egua-classico.js +39 -39
  393. package/lexador/dialetos/palavras-reservadas/guarani.d.ts +3 -3
  394. package/lexador/dialetos/palavras-reservadas/guarani.js +10 -10
  395. package/lexador/dialetos/palavras-reservadas/portugol-ipt.d.ts +13 -13
  396. package/lexador/dialetos/palavras-reservadas/portugol-ipt.js +20 -20
  397. package/lexador/dialetos/palavras-reservadas/rantiaquin.d.ts +1 -1
  398. package/lexador/dialetos/palavras-reservadas/rantiaquin.js +4 -4
  399. package/lexador/dialetos/pragma.d.ts +8 -8
  400. package/lexador/dialetos/pragma.js +2 -2
  401. package/lexador/erro-lexador.d.ts +5 -5
  402. package/lexador/erro-lexador.js +2 -2
  403. package/lexador/index.d.ts +4 -4
  404. package/lexador/index.js +20 -20
  405. package/lexador/lexador-base-linha-unica.d.ts +28 -28
  406. package/lexador/lexador-base-linha-unica.js +82 -82
  407. package/lexador/lexador-base-linha-unica.js.map +1 -1
  408. package/lexador/lexador-base.d.ts +41 -41
  409. package/lexador/lexador-base.js +112 -112
  410. package/lexador/lexador-base.js.map +1 -1
  411. package/lexador/lexador.d.ts +43 -43
  412. package/lexador/lexador.js +440 -440
  413. package/lexador/lexador.js.map +1 -1
  414. package/lexador/micro-lexador.d.ts +29 -29
  415. package/lexador/micro-lexador.js +207 -207
  416. package/lexador/micro-lexador.js.map +1 -1
  417. package/lexador/palavras-reservadas.d.ts +54 -54
  418. package/lexador/palavras-reservadas.js +61 -61
  419. package/lexador/simbolo.d.ts +10 -10
  420. package/lexador/simbolo.js +16 -16
  421. package/lexador/traducao/lexador-javascript.d.ts +28 -28
  422. package/lexador/traducao/lexador-javascript.js +58 -58
  423. package/package.json +5 -4
  424. package/quebras/index.d.ts +10 -10
  425. package/quebras/index.js +19 -19
  426. package/tipo-dados-elementar.d.ts +1 -1
  427. package/tipo-dados-elementar.js +2 -2
  428. package/tipos-de-dados/delegua.d.ts +18 -18
  429. package/tipos-de-dados/delegua.js +19 -19
  430. package/tipos-de-dados/listas-delegua.d.ts +6 -6
  431. package/tipos-de-dados/listas-delegua.js +7 -7
  432. package/tipos-de-dados/listas-primitivos.d.ts +5 -5
  433. package/tipos-de-dados/listas-primitivos.js +6 -6
  434. package/tipos-de-dados/primitivos.d.ts +16 -16
  435. package/tipos-de-dados/primitivos.js +17 -17
  436. package/tipos-de-simbolos/comum.d.ts +23 -23
  437. package/tipos-de-simbolos/comum.js +24 -24
  438. package/tipos-de-simbolos/delegua.d.ts +91 -91
  439. package/tipos-de-simbolos/delegua.js +92 -92
  440. package/tipos-de-simbolos/egua-classico.d.ts +75 -75
  441. package/tipos-de-simbolos/egua-classico.js +76 -76
  442. package/tipos-de-simbolos/guarani.d.ts +14 -14
  443. package/tipos-de-simbolos/guarani.js +15 -15
  444. package/tipos-de-simbolos/guarani.js.map +1 -1
  445. package/tipos-de-simbolos/microgramaticas/delegua.d.ts +46 -46
  446. package/tipos-de-simbolos/microgramaticas/delegua.js +47 -47
  447. package/tipos-de-simbolos/pitugues.d.ts +75 -75
  448. package/tipos-de-simbolos/pitugues.js +76 -76
  449. package/tipos-de-simbolos/portugol-ipt.d.ts +36 -36
  450. package/tipos-de-simbolos/portugol-ipt.js +37 -37
  451. package/tipos-de-simbolos/rantiaquin.d.ts +2 -2
  452. package/tipos-de-simbolos/rantiaquin.js +3 -3
  453. package/tradutores/dicionarios/dicionario-delegua-javascript.d.ts +2 -2
  454. package/tradutores/dicionarios/dicionario-delegua-javascript.js +10 -10
  455. package/tradutores/dicionarios/index.d.ts +1 -1
  456. package/tradutores/dicionarios/index.js +17 -17
  457. package/tradutores/index.d.ts +6 -6
  458. package/tradutores/index.js +22 -22
  459. package/tradutores/python/python3-lexer.d.ts +152 -152
  460. package/tradutores/python/python3-lexer.js +1227 -1227
  461. package/tradutores/python/python3-lexer.js.map +1 -1
  462. package/tradutores/python/python3-listener.d.ts +964 -964
  463. package/tradutores/python/python3-listener.js +3 -3
  464. package/tradutores/python/python3-parser.d.ts +1342 -1342
  465. package/tradutores/python/python3-parser.js +11226 -11226
  466. package/tradutores/python/python3-parser.js.map +1 -1
  467. package/tradutores/python/python3-visitor.d.ts +619 -619
  468. package/tradutores/python/python3-visitor.js +3 -3
  469. package/tradutores/tradutor-assembly-x64.d.ts +19 -19
  470. package/tradutores/tradutor-assembly-x64.js +128 -128
  471. package/tradutores/tradutor-assembly-x64.js.map +1 -1
  472. package/tradutores/tradutor-assemblyscript.d.ts +91 -91
  473. package/tradutores/tradutor-assemblyscript.js +590 -590
  474. package/tradutores/tradutor-assemblyscript.js.map +1 -1
  475. package/tradutores/tradutor-javascript.d.ts +95 -95
  476. package/tradutores/tradutor-javascript.js +577 -577
  477. package/tradutores/tradutor-javascript.js.map +1 -1
  478. package/tradutores/tradutor-portugol-ipt.d.ts +21 -21
  479. package/tradutores/tradutor-portugol-ipt.js +60 -60
  480. package/tradutores/tradutor-portugol-ipt.js.map +1 -1
  481. package/tradutores/tradutor-python.d.ts +65 -65
  482. package/tradutores/tradutor-python.js +461 -461
  483. package/tradutores/tradutor-python.js.map +1 -1
  484. package/tradutores/tradutor-reverso-javascript.d.ts +50 -50
  485. package/tradutores/tradutor-reverso-javascript.js +392 -392
  486. package/tradutores/tradutor-reverso-javascript.js.map +1 -1
  487. package/tradutores/tradutor-reverso-python.d.ts +32 -32
  488. package/tradutores/tradutor-reverso-python.js +71 -71
  489. package/tradutores/tradutor-reverso-python.js.map +1 -1
  490. package/umd/delegua.js +26337 -26340
@@ -1,542 +1,542 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /* eslint-disable prefer-rest-params */
4
- const excecoes_1 = require("../../../excecoes");
5
- module.exports.graus = function (angle) {
6
- const valorAngle = angle.hasOwnProperty('valor') ? angle.valor : angle;
7
- if (isNaN(valorAngle) || valorAngle === null)
8
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover um número para mat.graus(ângulo).');
9
- return valorAngle * (180 / Math.PI);
10
- };
11
- module.exports.mediana = function (a) {
12
- if (isNaN(a) || a === null)
13
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para mediana(a).');
14
- a.sort(function (a, b) {
15
- return a - b;
16
- });
17
- const mid = a.length / 2;
18
- return mid % 1 ? a[mid - 0.5] : (a[mid - 1] + a[mid]) / 2;
19
- };
20
- /**
21
- * Calcula a moda de um vetor.
22
- * @param {inteiro[]} vetor Vetor de inteiros.
23
- * @returns Valor inteiro da moda.
24
- */
25
- module.exports.moda = function (numbers) {
26
- if (!Array.isArray(numbers))
27
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Parâmetro `vetor` deve ser um vetor na função moda(vetor).');
28
- if (numbers.some(isNaN))
29
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Todos os elementos de `vetor` deve ser numéricos na função moda(vetor).');
30
- let modes = [], count = [], i, number, maxIndex = 0;
31
- for (i = 0; i < numbers.length; i += 1) {
32
- number = numbers[i];
33
- count[number] = (count[number] || 0) + 1;
34
- if (count[number] > maxIndex) {
35
- maxIndex = count[number];
36
- }
37
- }
38
- for (i in count)
39
- if (count.hasOwnProperty(i)) {
40
- if (count[i] === maxIndex) {
41
- modes.push(Number(i));
42
- }
43
- }
44
- return modes;
45
- };
46
- module.exports.pi = Math.PI;
47
- module.exports.radiano = function (angulo) {
48
- const valorAngulo = angulo.hasOwnProperty('valor') ? angulo.valor : angulo;
49
- if (!Number.isInteger(valorAngulo))
50
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover um número inteiro para o parâmetro `angulo`, em radiano(angulo).');
51
- return valorAngulo * (Math.PI / 180);
52
- };
53
- //FUNÇÃO AFIM E QUADRÁTICA
54
- /**
55
- * Gera valores para abscissa.
56
- * @param {inteiro} distancia A distância entra dois pontos.
57
- * @param {inteiro} valorPontoCentral O ponto central na abscissa.
58
- * @param {inteiro} numeroPontos Número de pontos a serem gerados (padrão: 7).
59
- * @returns Um vetor, contendo o número de pontos informado ou definido por padrão em uma abscissa.
60
- * Se o número informado é par, um ponto negativo a mais é gerado.
61
- */
62
- module.exports.gerarPontosAbscissa = function (distancia, valorPontoCentral, numeroPontos) {
63
- const distanciaResolvido = distancia.hasOwnProperty('valor') ? distancia.valor : distancia;
64
- const valorPontoCentralResolvido = valorPontoCentral.hasOwnProperty('valor')
65
- ? valorPontoCentral.valor
66
- : valorPontoCentral;
67
- let numeroPontosResolvido = numeroPontos.hasOwnProperty('valor') ? numeroPontos.valor : numeroPontos;
68
- if (!Number.isInteger(distanciaResolvido))
69
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover um valor inteiro para o parâmetro `distancia`, em gerarPontosAbscissa(distancia, valorInicial).');
70
- if (!Number.isInteger(valorPontoCentralResolvido))
71
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover um valor inteiro para o parâmetro `valorInicial`, em gerarPontosAbscissa(distancia, valorInicial).');
72
- if (!numeroPontosResolvido) {
73
- numeroPontosResolvido = 7;
74
- }
75
- const elementoInicial = valorPontoCentralResolvido - ((numeroPontosResolvido / 2) >> 0) * distanciaResolvido;
76
- const x = [];
77
- for (let i = 0; i < numeroPontosResolvido; i++) {
78
- x.push(elementoInicial + i * distanciaResolvido);
79
- }
80
- return x;
81
- };
82
- //Raíz da Função Afim
83
- module.exports.fun1R = function (a, b) {
84
- const valorAResolvido = a.hasOwnProperty('valor') ? a.valor : a;
85
- const valorBResolvido = b.hasOwnProperty('valor') ? b.valor : b;
86
- if (isNaN(valorAResolvido) || valorAResolvido === null || isNaN(valorBResolvido) || valorBResolvido === null)
87
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para fun1R(valor1,valor2).');
88
- return (-1 * valorBResolvido) / valorAResolvido;
89
- };
90
- //Intervalo Preenchido
91
- module.exports.linspace = function (startValue, stopValue, cardinality) {
92
- const startValueResolvido = startValue.hasOwnProperty('valor') ? startValue.valor : startValue;
93
- const stopValueResolvido = stopValue.hasOwnProperty('valor') ? stopValue.valor : stopValue;
94
- const cardinalityResolvido = cardinality.hasOwnProperty('valor') ? cardinality.valor : cardinality;
95
- if (isNaN(startValueResolvido) ||
96
- startValueResolvido === null ||
97
- isNaN(stopValueResolvido) ||
98
- stopValueResolvido === null ||
99
- isNaN(cardinalityResolvido) ||
100
- cardinalityResolvido === null)
101
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para linspace(valor1,valor2,valor3).');
102
- const lista = [];
103
- const step = (stopValueResolvido - startValueResolvido) / (cardinalityResolvido - 1);
104
- for (let i = 0; i < cardinalityResolvido; i++) {
105
- lista.push(startValueResolvido + step * i);
106
- }
107
- return lista;
108
- };
109
- //Raízes da Função Quadrática
110
- module.exports.fun2R = function (a, b, c) {
111
- const valueA = a.hasOwnProperty('valor') ? a.valor : a;
112
- const valueB = b.hasOwnProperty('valor') ? b.valor : b;
113
- const valueC = c.hasOwnProperty('valor') ? c.valor : c;
114
- if (isNaN(valueA) || valueA === null)
115
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para fun2R(a,b,c).');
116
- const r1 = (-1 * valueB + Math.sqrt(Math.pow(valueB, 2) - 4 * valueA * valueC)) / (2 * valueA);
117
- const r2 = (-1 * valueB - Math.sqrt(Math.pow(valueB, 2) - 4 * valueA * valueC)) / (2 * valueA);
118
- const xv = (-1 * valueB) / (2 * valueA);
119
- const yv = ((-1 * (Math.pow(valueB, 2) - 4 * valueA * valueC)) / 4) * valueA;
120
- return [xv, yv];
121
- };
122
- //Aproximação de valores
123
- const aprox = function (x, z) {
124
- let valueX = x.hasOwnProperty('valor') ? x.valor : x;
125
- let valueZ = z.hasOwnProperty('valor') ? z.valor : z;
126
- if (isNaN(valueX) || valueX === null || isNaN(valueZ) || valueZ === null)
127
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para aprox(x,z).');
128
- if (valueZ == undefined) {
129
- valueZ = 2;
130
- }
131
- if (typeof valueX == 'number') {
132
- valueX = valueX.toFixed(valueZ);
133
- }
134
- else if (valueX[0].length == undefined) {
135
- // 1D array
136
- for (let i = 0; i < valueX.length; i++) {
137
- valueX[i] = parseFloat(valueX[i].toFixed(valueZ));
138
- }
139
- }
140
- else
141
- for (let i = 0; i < valueX.length; i++) {
142
- // 2D array
143
- for (let j = 0; j < valueX[0].length; j++) {
144
- valueX[i][j] = parseFloat(valueX[i][j].toFixed(valueZ));
145
- }
146
- }
147
- return valueX;
148
- };
149
- module.exports.aprox = aprox;
150
- //Parâmetros da Função
151
- const matrizn = function (z) {
152
- const valueZ = z.hasOwnProperty('valor') ? z.valor : z;
153
- if (isNaN(valueZ) || valueZ === null)
154
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para matrizn(z).');
155
- const n = arguments.length;
156
- const data = Array.from(Array(1), () => new Array(n));
157
- for (let i = 0; i < n; i++) {
158
- data[0][i] = arguments[i];
159
- }
160
- return data;
161
- };
162
- module.exports.matrizn = matrizn;
163
- //Vetor de pontos aleatórios
164
- module.exports.pontosAleatorios = function (n) {
165
- const valueN = n.hasOwnProperty('valor') ? n.valor : n;
166
- if (isNaN(valueN) || valueN === null)
167
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para pale(n).');
168
- let ex;
169
- if (ex == undefined) {
170
- ex = 0;
171
- }
172
- const x = [];
173
- x[0] = 100;
174
- for (let i = 1; i < valueN; i++) {
175
- x[i] = ex + x[i - 1] + Math.random() * 2 - 1;
176
- }
177
- const xx = aprox(x, 2);
178
- return xx;
179
- };
180
- //Intervalo A-B
181
- module.exports.vet = function (a, b) {
182
- const valueA = a.hasOwnProperty('valor') ? a.valor : a;
183
- const valueB = b.hasOwnProperty('valor') ? b.valor : b;
184
- if (isNaN(valueA) || valueA === null || isNaN(valueB) || valueB === null)
185
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para vet(a,b).');
186
- const data = Array.from(Array(1), () => new Array(valueB - valueA + 1));
187
- for (let i = 0; i < data[0].length; i++) {
188
- data[0][i] = valueA + i;
189
- }
190
- return matrizn(data);
191
- };
192
- /**
193
- * Conta quantas vezes um determinado valor aparece em um vetor.
194
- * @param {qualquer[]} vetor Vetor de elementos
195
- * @param {qualquer} valor Valor a ser encontrado no vetor
196
- * @returns Valor inteiro, com o número de vezes que `valor` foi encontrado em `vetor`.
197
- */
198
- module.exports.numeroOcorrencias = function (vetor, valor) {
199
- if (!Array.isArray(vetor))
200
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Parâmetro `vetor` deve ser um vetor, em numeroOcorrencias(vetor, valor).');
201
- return vetor.filter((v) => v === valor).length;
202
- };
203
- /* ESTATÍSTICA */
204
- /**
205
- * Encontra o elemento máximo em um vetor.
206
- * @param {inteiro[]} vetor Um vetor de números inteiros.
207
- * @returns O maior número encontrado em um vetor.
208
- */
209
- module.exports.max = function (vetor) {
210
- if (!Array.isArray(vetor))
211
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Parâmetro `vetor` deve ser um vetor, em max(vetor).');
212
- if (vetor.some(isNaN))
213
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Todos os elementos de `vetor` deve ser numéricos, em max(vetor).');
214
- return Math.max.apply(null, vetor);
215
- };
216
- /**
217
- * Encontra o elemento mínimo em um vetor.
218
- * @param {inteiro[]} vetor Um vetor de números inteiros.
219
- * @returns O menor número encontrado em um vetor.
220
- */
221
- module.exports.min = function (vetor) {
222
- if (!Array.isArray(vetor))
223
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Parâmetro `vetor` deve ser um vetor, em min(vetor).');
224
- if (vetor.some(isNaN))
225
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Todos os elementos de `vetor` deve ser numéricos, em min(vetor).');
226
- return Math.min.apply(null, vetor);
227
- };
228
- //Soma de determinada matriz
229
- const smtr = function (a) {
230
- const valueA = a.hasOwnProperty('valor') ? a.valor : a;
231
- if (isNaN(valueA) || valueA === null)
232
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para smtr(a).');
233
- let z = 0;
234
- if (valueA.length == 1) {
235
- // valueA is valueA 1D row array
236
- for (let j = 0; j < valueA[0].length; j++) {
237
- z = z + valueA[0][j];
238
- }
239
- }
240
- else if (valueA[0].length == 1) {
241
- // valueA is valueA 1D column array
242
- for (let i = 0; i < valueA.length; i++) {
243
- z = z + valueA[i][0];
244
- }
245
- }
246
- else {
247
- for (let j = 0; j < valueA.length; j++) {
248
- z = z + valueA[j];
249
- }
250
- }
251
- return aprox(z, 2);
252
- };
253
- module.exports.smtr = smtr;
254
- // Retorna a média de um vetor de números
255
- module.exports.media = function () {
256
- const argumentsLength = Object.keys(arguments).length;
257
- if (argumentsLength <= 0) {
258
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve fornecer um parâmetro para a função.');
259
- }
260
- if (argumentsLength > 1) {
261
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'A função recebe apenas um parâmetro.');
262
- }
263
- // Pega o primeiro argumento do objeto de argumentos
264
- const args = arguments['0'];
265
- if (!Array.isArray(args)) {
266
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve fornecer um parâmetro do tipo vetor.');
267
- }
268
- // Valida se o array está vazio.
269
- if (!args.length) {
270
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Vetor vazio. Você deve fornecer ao menos um valor ao vetor.');
271
- }
272
- // Valida se o array contém apenas valores do tipo número.
273
- args.forEach((item) => {
274
- if (typeof item !== 'number') {
275
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve fornecer um vetor contendo apenas valores do tipo número.');
276
- }
277
- });
278
- // Soma todos os itens.
279
- const valoresSomados = args.reduce((acumulador, itemAtual) => acumulador + itemAtual, 0);
280
- // Faz o cáculo da média em si e retorna.
281
- return valoresSomados / args.length;
282
- };
283
- //Média aritmética de uma matriz
284
- const ve = function (a) {
285
- const valueA = a.hasOwnProperty('valor') ? a.valor : a;
286
- if (isNaN(valueA) || valueA === null)
287
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para ve(a).');
288
- if (valueA.length == 1) {
289
- return aprox(smtr(valueA) / valueA[0].length, 4);
290
- } // a is a row array
291
- if (valueA[0].length == 1) {
292
- return aprox(smtr(valueA) / valueA.length, 4);
293
- } // a is a column array
294
- if (valueA[0].length == undefined) {
295
- return a(smtr(valueA) / valueA.length, 4);
296
- }
297
- };
298
- module.exports.ve = ve;
299
- //Soma dos quadrados dos resíduos (sqr) de uma matriz
300
- const sqr = function (a) {
301
- const valueA = a.hasOwnProperty('valor') ? a.valor : a;
302
- if (isNaN(valueA) || valueA === null)
303
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para sqr(a).');
304
- const mean = ve(valueA);
305
- let sum = 0;
306
- let i = valueA.length;
307
- let tmp;
308
- while (--i >= 0) {
309
- tmp = valueA[i] - mean;
310
- sum += tmp * tmp;
311
- }
312
- return sum;
313
- };
314
- module.exports.sqr = sqr;
315
- //Variação de uma matriz
316
- module.exports.variancia = function (array, flag) {
317
- if (isNaN(array) || array === null || isNaN(flag) || flag === null)
318
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para variancia(matriz, flag).');
319
- if (flag == undefined) {
320
- flag = 1;
321
- }
322
- return sqr(array) / (array.length - (flag ? 1 : 0));
323
- };
324
- //Covariância de duas matrizes
325
- module.exports.colet = function (array1, array2) {
326
- if (isNaN(array1) || array1 === null || isNaN(array1) || array2 === null)
327
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para covar(matriz1, matriz2).');
328
- let u = ve(array1);
329
- let v = ve(array2);
330
- let arr1Len = array1.length;
331
- let sq_dev = new Array(arr1Len);
332
- for (let i = 0; i < arr1Len; i++)
333
- sq_dev[i] = (array1[i] - u) * (array2[i] - v);
334
- return smtr(sq_dev) / (arr1Len - 1);
335
- };
336
- /*TRIGONOMETRIA*/
337
- //Seno de um número
338
- module.exports.sen = function (x) {
339
- const valorX = x.hasOwnProperty('valor') ? x.valor : x;
340
- if (isNaN(valorX) || valorX === null)
341
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para sen(x).');
342
- return Math.sin(valorX);
343
- };
344
- //Cosseno de um número
345
- module.exports.cos = function (x) {
346
- const valorX = x.hasOwnProperty('valor') ? x.valor : x;
347
- if (isNaN(valorX) || valorX === null)
348
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para cos(x).');
349
- return Math.cos(valorX);
350
- };
351
- //Tangente de um número
352
- module.exports.tan = function (x) {
353
- const valorX = x.hasOwnProperty('valor') ? x.valor : x;
354
- if (isNaN(valorX) || valorX === null)
355
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para tan(x).');
356
- return Math.tan(valorX);
357
- };
358
- //Arco cosseno de um número
359
- module.exports.arcos = function (x) {
360
- const valorX = x.hasOwnProperty('valor') ? x.valor : x;
361
- if (isNaN(valorX) || valorX === null)
362
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para arcos(x).');
363
- return Math.acos(valorX);
364
- };
365
- //Arco seno de um número
366
- module.exports.arsen = function (x) {
367
- const valorX = x.hasOwnProperty('valor') ? x.valor : x;
368
- if (isNaN(valorX) || valorX === null)
369
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para arsen(x).');
370
- return Math.asin(valorX);
371
- };
372
- //Arco tangente de um número
373
- module.exports.artan = function (x) {
374
- const valorX = x.hasOwnProperty('valor') ? x.valor : x;
375
- if (isNaN(valorX) || valorX === null)
376
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para artan(x).');
377
- return Math.atan(valorX);
378
- };
379
- //Exponencial
380
- module.exports.exp = function (x) {
381
- const valorX = x.hasOwnProperty('valor') ? x.valor : x;
382
- if (isNaN(valorX) || valorX === null)
383
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para exp(x).');
384
- return Math.exp(valorX);
385
- };
386
- //Logaritmo natural
387
- module.exports.log = function (x) {
388
- const valorX = x.hasOwnProperty('valor') ? x.valor : x;
389
- if (isNaN(valorX) || valorX === null)
390
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para log(x).');
391
- return Math.log(valorX);
392
- };
393
- // Retorna a base elevada ao expoente
394
- const pot = function (base, expoente) {
395
- const valorBaseResolvido = base.hasOwnProperty('valor') ? base.valor : base;
396
- const valorExpoenteResolvido = expoente.hasOwnProperty('valor') ? expoente.valor : expoente;
397
- if (typeof valorBaseResolvido !== 'number' || typeof valorExpoenteResolvido !== 'number') {
398
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Os parâmetros devem ser do tipo número.');
399
- }
400
- return Math.pow(valorBaseResolvido, valorExpoenteResolvido);
401
- };
402
- module.exports.potencia = pot;
403
- //Raíz quadrada
404
- module.exports.raizq = function (x) {
405
- const valorX = x.hasOwnProperty('valor') ? x.valor : x;
406
- if (isNaN(valorX) || valorX === null)
407
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para raizq(x).');
408
- return Math.sqrt(valorX);
409
- };
410
- /*CINEMÁTICA*/
411
- //Velocidade média
412
- module.exports.velocidadeMedia = function (s, t) {
413
- const valorS = s.hasOwnProperty('valor') ? s.valor : s;
414
- const valorT = t.hasOwnProperty('valor') ? t.valor : t;
415
- if (isNaN(valorS) || valorS === null || isNaN(valorT) || valorT === null)
416
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para velocidadeMedia(d,t).');
417
- return valorS / valorT;
418
- };
419
- //Espaço percorrido
420
- module.exports.deltaS = function (s0, s) {
421
- const valorS0 = s0.hasOwnProperty('valor') ? s0.valor : s0;
422
- const valorS = s.hasOwnProperty('valor') ? s.valor : s;
423
- if (isNaN(valorS0) || valorS0 === null || isNaN(valorS) || valorS === null)
424
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para deltas(e0,e1).');
425
- let ds = valorS - valorS0;
426
- return ds;
427
- };
428
- //Tempo Percorrido
429
- module.exports.deltaT = function (t0, t) {
430
- const valorT0 = t0.hasOwnProperty('valor') ? t0.valor : t0;
431
- const valorT = t.hasOwnProperty('valor') ? t.valor : t;
432
- if (isNaN(valorT0) || valorT0 === null || isNaN(valorT) || valorT === null)
433
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para deltat(t,t1).');
434
- let dt = valorT - valorT0;
435
- return dt;
436
- };
437
- // Cálculo de aceleração
438
- module.exports.aceleracao = function (velocidadeFinal, velocidadeInicial, tempoFinal, tempoInicial) {
439
- const velocidadeFinalResolvido = velocidadeFinal.hasOwnProperty('valor') ? velocidadeFinal.valor : velocidadeFinal;
440
- const velocidadeInicialResolvido = velocidadeInicial.hasOwnProperty('valor')
441
- ? velocidadeInicial.valor
442
- : velocidadeInicial;
443
- const tempoFinalResolvido = tempoFinal.hasOwnProperty('valor') ? tempoFinal.valor : tempoFinal;
444
- const tempoInicialResolvido = tempoInicial.hasOwnProperty('valor') ? tempoInicial.valor : tempoInicial;
445
- if (velocidadeFinalResolvido === null ||
446
- velocidadeInicialResolvido === null ||
447
- tempoFinalResolvido === null ||
448
- tempoInicialResolvido === null) {
449
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Devem ser fornecidos quatro parâmetros obrigatórios.');
450
- }
451
- if (typeof velocidadeFinalResolvido !== 'number' ||
452
- typeof velocidadeInicialResolvido !== 'number' ||
453
- typeof tempoFinalResolvido !== 'number' ||
454
- typeof tempoInicialResolvido !== 'number') {
455
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Todos os parâmetros devem ser do tipo número.');
456
- }
457
- return (velocidadeFinalResolvido - velocidadeInicialResolvido) / (tempoFinalResolvido - tempoInicialResolvido);
458
- };
459
- //Função Horária da Posição (M.R.U)
460
- module.exports.mrufh = function (s0, v, t) {
461
- const valorS0 = s0.hasOwnProperty('valor') ? s0.valor : s0;
462
- const valorV = v.hasOwnProperty('valor') ? v.valor : v;
463
- let valorT = t.hasOwnProperty('valor') ? t.valor : t;
464
- if (isNaN(valorS0) || valorS0 === null)
465
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para mrufh(s0,v,t).');
466
- valorT = valorT + 1;
467
- const s = [];
468
- let index = 0;
469
- for (let i = 0; i < valorT; i++) {
470
- s[index] = valorS0 + valorV * i;
471
- index++;
472
- }
473
- return ['Função: ' + valorS0 + '+(' + valorV + ')*t' + '<br>' + 'Posições: ' + s];
474
- };
475
- //Gráfico da velocidade (M.R.U.V)
476
- module.exports.mruv = function (s0, s, a) {
477
- const valorS0 = s0.hasOwnProperty('valor') ? s0.valor : s0;
478
- const valorS = s.hasOwnProperty('valor') ? s.valor : s;
479
- const valorA = a.hasOwnProperty('valor') ? a.valor : a;
480
- if (isNaN(valorS0) || valorS0 === null || isNaN(valorS) || valorS === null || isNaN(valorA) || valorA === null)
481
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para mruv(Pi, Vf, A).');
482
- const vf = [];
483
- const x = [];
484
- let v = [];
485
- let index = 0;
486
- for (let i = 0; i < valorS; i++) {
487
- v = index;
488
- vf[index] = Math.sqrt(2 * valorA * (index - valorS0));
489
- x[index] = i;
490
- index++;
491
- }
492
- return vf;
493
- };
494
- /*Controle e Servomecanismos*/
495
- module.exports.pid = function (Mo, t, K, T1, T2) {
496
- const valorMo = Mo.hasOwnProperty('valor') ? Mo.valor : Mo;
497
- const valorT = t.hasOwnProperty('valor') ? t.valor : t;
498
- const valorK = K.hasOwnProperty('valor') ? K.valor : K;
499
- const valorT1 = T1.hasOwnProperty('valor') ? T1.valor : T1;
500
- const valorT2 = T2.hasOwnProperty('valor') ? T2.valor : T2;
501
- if (isNaN(valorMo) ||
502
- valorMo === null ||
503
- isNaN(valorT) ||
504
- valorT === null ||
505
- isNaN(valorK) ||
506
- valorK === null ||
507
- isNaN(valorT1) ||
508
- valorT1 === null ||
509
- isNaN(valorT2) ||
510
- valorT2 === null) {
511
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para pid(Ov, Ts, K, T1, T2).');
512
- }
513
- let pi = Math.PI; //Pi da bilbioteca Math.js
514
- //AvalorMortecimento Relativo
515
- let csi = (-1 * Math.log(valorMo / 100)) / Math.sqrt(Math.pow(pi, 2) + pot(Math.log(valorMo / 100), 2));
516
- //Frequência Natural
517
- let Wn = 4 / (t * csi);
518
- //Controlador Proporcional (P)
519
- let Kp = 20 * (Math.pow(csi, 2) * Math.pow(Wn, 2) * valorT1 * valorT2) +
520
- (Math.pow(Wn, 2) * valorT1 * valorT2 - 1) / valorK;
521
- //Controlador Integral (I)
522
- let Ki = (10 * csi * Math.pow(Wn, 3) * valorT1 * valorT2) / valorK;
523
- //Controlador Derivativo (D)
524
- let Kd = (12 * csi * Wn * valorT1 * valorT2 - valorT1 - valorT2) / valorK;
525
- return [csi, Wn, Kp, Ki, Kd];
526
- };
527
- // Retorna o comprimento de um vetor
528
- module.exports.comp = function (array) {
529
- if (!Array.isArray(array)) {
530
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'O valor passado pra função deve ser um vetor.');
531
- }
532
- return array.length;
533
- };
534
- // Retorna o menor número inteiro dentre o valor de "value"
535
- module.exports.minaprox = function (value) {
536
- const valueResolvido = value.hasOwnProperty('valor') ? value.valor : value;
537
- if (typeof valueResolvido !== 'number') {
538
- throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'O valor passado pra função deve ser um número.');
539
- }
540
- return Math.floor(valueResolvido);
541
- };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /* eslint-disable prefer-rest-params */
4
+ const excecoes_1 = require("../../../excecoes");
5
+ module.exports.graus = function (angle) {
6
+ const valorAngle = angle.hasOwnProperty('valor') ? angle.valor : angle;
7
+ if (isNaN(valorAngle) || valorAngle === null)
8
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover um número para mat.graus(ângulo).');
9
+ return valorAngle * (180 / Math.PI);
10
+ };
11
+ module.exports.mediana = function (a) {
12
+ if (isNaN(a) || a === null)
13
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para mediana(a).');
14
+ a.sort(function (a, b) {
15
+ return a - b;
16
+ });
17
+ const mid = a.length / 2;
18
+ return mid % 1 ? a[mid - 0.5] : (a[mid - 1] + a[mid]) / 2;
19
+ };
20
+ /**
21
+ * Calcula a moda de um vetor.
22
+ * @param {inteiro[]} vetor Vetor de inteiros.
23
+ * @returns Valor inteiro da moda.
24
+ */
25
+ module.exports.moda = function (numbers) {
26
+ if (!Array.isArray(numbers))
27
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Parâmetro `vetor` deve ser um vetor na função moda(vetor).');
28
+ if (numbers.some(isNaN))
29
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Todos os elementos de `vetor` deve ser numéricos na função moda(vetor).');
30
+ let modes = [], count = [], i, number, maxIndex = 0;
31
+ for (i = 0; i < numbers.length; i += 1) {
32
+ number = numbers[i];
33
+ count[number] = (count[number] || 0) + 1;
34
+ if (count[number] > maxIndex) {
35
+ maxIndex = count[number];
36
+ }
37
+ }
38
+ for (i in count)
39
+ if (count.hasOwnProperty(i)) {
40
+ if (count[i] === maxIndex) {
41
+ modes.push(Number(i));
42
+ }
43
+ }
44
+ return modes;
45
+ };
46
+ module.exports.pi = Math.PI;
47
+ module.exports.radiano = function (angulo) {
48
+ const valorAngulo = angulo.hasOwnProperty('valor') ? angulo.valor : angulo;
49
+ if (!Number.isInteger(valorAngulo))
50
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover um número inteiro para o parâmetro `angulo`, em radiano(angulo).');
51
+ return valorAngulo * (Math.PI / 180);
52
+ };
53
+ //FUNÇÃO AFIM E QUADRÁTICA
54
+ /**
55
+ * Gera valores para abscissa.
56
+ * @param {inteiro} distancia A distância entra dois pontos.
57
+ * @param {inteiro} valorPontoCentral O ponto central na abscissa.
58
+ * @param {inteiro} numeroPontos Número de pontos a serem gerados (padrão: 7).
59
+ * @returns Um vetor, contendo o número de pontos informado ou definido por padrão em uma abscissa.
60
+ * Se o número informado é par, um ponto negativo a mais é gerado.
61
+ */
62
+ module.exports.gerarPontosAbscissa = function (distancia, valorPontoCentral, numeroPontos) {
63
+ const distanciaResolvido = distancia.hasOwnProperty('valor') ? distancia.valor : distancia;
64
+ const valorPontoCentralResolvido = valorPontoCentral.hasOwnProperty('valor')
65
+ ? valorPontoCentral.valor
66
+ : valorPontoCentral;
67
+ let numeroPontosResolvido = numeroPontos.hasOwnProperty('valor') ? numeroPontos.valor : numeroPontos;
68
+ if (!Number.isInteger(distanciaResolvido))
69
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover um valor inteiro para o parâmetro `distancia`, em gerarPontosAbscissa(distancia, valorInicial).');
70
+ if (!Number.isInteger(valorPontoCentralResolvido))
71
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover um valor inteiro para o parâmetro `valorInicial`, em gerarPontosAbscissa(distancia, valorInicial).');
72
+ if (!numeroPontosResolvido) {
73
+ numeroPontosResolvido = 7;
74
+ }
75
+ const elementoInicial = valorPontoCentralResolvido - ((numeroPontosResolvido / 2) >> 0) * distanciaResolvido;
76
+ const x = [];
77
+ for (let i = 0; i < numeroPontosResolvido; i++) {
78
+ x.push(elementoInicial + i * distanciaResolvido);
79
+ }
80
+ return x;
81
+ };
82
+ //Raíz da Função Afim
83
+ module.exports.fun1R = function (a, b) {
84
+ const valorAResolvido = a.hasOwnProperty('valor') ? a.valor : a;
85
+ const valorBResolvido = b.hasOwnProperty('valor') ? b.valor : b;
86
+ if (isNaN(valorAResolvido) || valorAResolvido === null || isNaN(valorBResolvido) || valorBResolvido === null)
87
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para fun1R(valor1,valor2).');
88
+ return (-1 * valorBResolvido) / valorAResolvido;
89
+ };
90
+ //Intervalo Preenchido
91
+ module.exports.linspace = function (startValue, stopValue, cardinality) {
92
+ const startValueResolvido = startValue.hasOwnProperty('valor') ? startValue.valor : startValue;
93
+ const stopValueResolvido = stopValue.hasOwnProperty('valor') ? stopValue.valor : stopValue;
94
+ const cardinalityResolvido = cardinality.hasOwnProperty('valor') ? cardinality.valor : cardinality;
95
+ if (isNaN(startValueResolvido) ||
96
+ startValueResolvido === null ||
97
+ isNaN(stopValueResolvido) ||
98
+ stopValueResolvido === null ||
99
+ isNaN(cardinalityResolvido) ||
100
+ cardinalityResolvido === null)
101
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para linspace(valor1,valor2,valor3).');
102
+ const lista = [];
103
+ const step = (stopValueResolvido - startValueResolvido) / (cardinalityResolvido - 1);
104
+ for (let i = 0; i < cardinalityResolvido; i++) {
105
+ lista.push(startValueResolvido + step * i);
106
+ }
107
+ return lista;
108
+ };
109
+ //Raízes da Função Quadrática
110
+ module.exports.fun2R = function (a, b, c) {
111
+ const valueA = a.hasOwnProperty('valor') ? a.valor : a;
112
+ const valueB = b.hasOwnProperty('valor') ? b.valor : b;
113
+ const valueC = c.hasOwnProperty('valor') ? c.valor : c;
114
+ if (isNaN(valueA) || valueA === null)
115
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para fun2R(a,b,c).');
116
+ const r1 = (-1 * valueB + Math.sqrt(Math.pow(valueB, 2) - 4 * valueA * valueC)) / (2 * valueA);
117
+ const r2 = (-1 * valueB - Math.sqrt(Math.pow(valueB, 2) - 4 * valueA * valueC)) / (2 * valueA);
118
+ const xv = (-1 * valueB) / (2 * valueA);
119
+ const yv = ((-1 * (Math.pow(valueB, 2) - 4 * valueA * valueC)) / 4) * valueA;
120
+ return [xv, yv];
121
+ };
122
+ //Aproximação de valores
123
+ const aprox = function (x, z) {
124
+ let valueX = x.hasOwnProperty('valor') ? x.valor : x;
125
+ let valueZ = z.hasOwnProperty('valor') ? z.valor : z;
126
+ if (isNaN(valueX) || valueX === null || isNaN(valueZ) || valueZ === null)
127
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para aprox(x,z).');
128
+ if (valueZ == undefined) {
129
+ valueZ = 2;
130
+ }
131
+ if (typeof valueX == 'number') {
132
+ valueX = valueX.toFixed(valueZ);
133
+ }
134
+ else if (valueX[0].length == undefined) {
135
+ // 1D array
136
+ for (let i = 0; i < valueX.length; i++) {
137
+ valueX[i] = parseFloat(valueX[i].toFixed(valueZ));
138
+ }
139
+ }
140
+ else
141
+ for (let i = 0; i < valueX.length; i++) {
142
+ // 2D array
143
+ for (let j = 0; j < valueX[0].length; j++) {
144
+ valueX[i][j] = parseFloat(valueX[i][j].toFixed(valueZ));
145
+ }
146
+ }
147
+ return valueX;
148
+ };
149
+ module.exports.aprox = aprox;
150
+ //Parâmetros da Função
151
+ const matrizn = function (z) {
152
+ const valueZ = z.hasOwnProperty('valor') ? z.valor : z;
153
+ if (isNaN(valueZ) || valueZ === null)
154
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para matrizn(z).');
155
+ const n = arguments.length;
156
+ const data = Array.from(Array(1), () => new Array(n));
157
+ for (let i = 0; i < n; i++) {
158
+ data[0][i] = arguments[i];
159
+ }
160
+ return data;
161
+ };
162
+ module.exports.matrizn = matrizn;
163
+ //Vetor de pontos aleatórios
164
+ module.exports.pontosAleatorios = function (n) {
165
+ const valueN = n.hasOwnProperty('valor') ? n.valor : n;
166
+ if (isNaN(valueN) || valueN === null)
167
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para pale(n).');
168
+ let ex;
169
+ if (ex == undefined) {
170
+ ex = 0;
171
+ }
172
+ const x = [];
173
+ x[0] = 100;
174
+ for (let i = 1; i < valueN; i++) {
175
+ x[i] = ex + x[i - 1] + Math.random() * 2 - 1;
176
+ }
177
+ const xx = aprox(x, 2);
178
+ return xx;
179
+ };
180
+ //Intervalo A-B
181
+ module.exports.vet = function (a, b) {
182
+ const valueA = a.hasOwnProperty('valor') ? a.valor : a;
183
+ const valueB = b.hasOwnProperty('valor') ? b.valor : b;
184
+ if (isNaN(valueA) || valueA === null || isNaN(valueB) || valueB === null)
185
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para vet(a,b).');
186
+ const data = Array.from(Array(1), () => new Array(valueB - valueA + 1));
187
+ for (let i = 0; i < data[0].length; i++) {
188
+ data[0][i] = valueA + i;
189
+ }
190
+ return matrizn(data);
191
+ };
192
+ /**
193
+ * Conta quantas vezes um determinado valor aparece em um vetor.
194
+ * @param {qualquer[]} vetor Vetor de elementos
195
+ * @param {qualquer} valor Valor a ser encontrado no vetor
196
+ * @returns Valor inteiro, com o número de vezes que `valor` foi encontrado em `vetor`.
197
+ */
198
+ module.exports.numeroOcorrencias = function (vetor, valor) {
199
+ if (!Array.isArray(vetor))
200
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Parâmetro `vetor` deve ser um vetor, em numeroOcorrencias(vetor, valor).');
201
+ return vetor.filter((v) => v === valor).length;
202
+ };
203
+ /* ESTATÍSTICA */
204
+ /**
205
+ * Encontra o elemento máximo em um vetor.
206
+ * @param {inteiro[]} vetor Um vetor de números inteiros.
207
+ * @returns O maior número encontrado em um vetor.
208
+ */
209
+ module.exports.max = function (vetor) {
210
+ if (!Array.isArray(vetor))
211
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Parâmetro `vetor` deve ser um vetor, em max(vetor).');
212
+ if (vetor.some(isNaN))
213
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Todos os elementos de `vetor` deve ser numéricos, em max(vetor).');
214
+ return Math.max.apply(null, vetor);
215
+ };
216
+ /**
217
+ * Encontra o elemento mínimo em um vetor.
218
+ * @param {inteiro[]} vetor Um vetor de números inteiros.
219
+ * @returns O menor número encontrado em um vetor.
220
+ */
221
+ module.exports.min = function (vetor) {
222
+ if (!Array.isArray(vetor))
223
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Parâmetro `vetor` deve ser um vetor, em min(vetor).');
224
+ if (vetor.some(isNaN))
225
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Todos os elementos de `vetor` deve ser numéricos, em min(vetor).');
226
+ return Math.min.apply(null, vetor);
227
+ };
228
+ //Soma de determinada matriz
229
+ const smtr = function (a) {
230
+ const valueA = a.hasOwnProperty('valor') ? a.valor : a;
231
+ if (isNaN(valueA) || valueA === null)
232
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para smtr(a).');
233
+ let z = 0;
234
+ if (valueA.length == 1) {
235
+ // valueA is valueA 1D row array
236
+ for (let j = 0; j < valueA[0].length; j++) {
237
+ z = z + valueA[0][j];
238
+ }
239
+ }
240
+ else if (valueA[0].length == 1) {
241
+ // valueA is valueA 1D column array
242
+ for (let i = 0; i < valueA.length; i++) {
243
+ z = z + valueA[i][0];
244
+ }
245
+ }
246
+ else {
247
+ for (let j = 0; j < valueA.length; j++) {
248
+ z = z + valueA[j];
249
+ }
250
+ }
251
+ return aprox(z, 2);
252
+ };
253
+ module.exports.smtr = smtr;
254
+ // Retorna a média de um vetor de números
255
+ module.exports.media = function () {
256
+ const argumentsLength = Object.keys(arguments).length;
257
+ if (argumentsLength <= 0) {
258
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve fornecer um parâmetro para a função.');
259
+ }
260
+ if (argumentsLength > 1) {
261
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'A função recebe apenas um parâmetro.');
262
+ }
263
+ // Pega o primeiro argumento do objeto de argumentos
264
+ const args = arguments['0'];
265
+ if (!Array.isArray(args)) {
266
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve fornecer um parâmetro do tipo vetor.');
267
+ }
268
+ // Valida se o array está vazio.
269
+ if (!args.length) {
270
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Vetor vazio. Você deve fornecer ao menos um valor ao vetor.');
271
+ }
272
+ // Valida se o array contém apenas valores do tipo número.
273
+ args.forEach((item) => {
274
+ if (typeof item !== 'number') {
275
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve fornecer um vetor contendo apenas valores do tipo número.');
276
+ }
277
+ });
278
+ // Soma todos os itens.
279
+ const valoresSomados = args.reduce((acumulador, itemAtual) => acumulador + itemAtual, 0);
280
+ // Faz o cáculo da média em si e retorna.
281
+ return valoresSomados / args.length;
282
+ };
283
+ //Média aritmética de uma matriz
284
+ const ve = function (a) {
285
+ const valueA = a.hasOwnProperty('valor') ? a.valor : a;
286
+ if (isNaN(valueA) || valueA === null)
287
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para ve(a).');
288
+ if (valueA.length == 1) {
289
+ return aprox(smtr(valueA) / valueA[0].length, 4);
290
+ } // a is a row array
291
+ if (valueA[0].length == 1) {
292
+ return aprox(smtr(valueA) / valueA.length, 4);
293
+ } // a is a column array
294
+ if (valueA[0].length == undefined) {
295
+ return a(smtr(valueA) / valueA.length, 4);
296
+ }
297
+ };
298
+ module.exports.ve = ve;
299
+ //Soma dos quadrados dos resíduos (sqr) de uma matriz
300
+ const sqr = function (a) {
301
+ const valueA = a.hasOwnProperty('valor') ? a.valor : a;
302
+ if (isNaN(valueA) || valueA === null)
303
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para sqr(a).');
304
+ const mean = ve(valueA);
305
+ let sum = 0;
306
+ let i = valueA.length;
307
+ let tmp;
308
+ while (--i >= 0) {
309
+ tmp = valueA[i] - mean;
310
+ sum += tmp * tmp;
311
+ }
312
+ return sum;
313
+ };
314
+ module.exports.sqr = sqr;
315
+ //Variação de uma matriz
316
+ module.exports.variancia = function (array, flag) {
317
+ if (isNaN(array) || array === null || isNaN(flag) || flag === null)
318
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para variancia(matriz, flag).');
319
+ if (flag == undefined) {
320
+ flag = 1;
321
+ }
322
+ return sqr(array) / (array.length - (flag ? 1 : 0));
323
+ };
324
+ //Covariância de duas matrizes
325
+ module.exports.colet = function (array1, array2) {
326
+ if (isNaN(array1) || array1 === null || isNaN(array1) || array2 === null)
327
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para covar(matriz1, matriz2).');
328
+ let u = ve(array1);
329
+ let v = ve(array2);
330
+ let arr1Len = array1.length;
331
+ let sq_dev = new Array(arr1Len);
332
+ for (let i = 0; i < arr1Len; i++)
333
+ sq_dev[i] = (array1[i] - u) * (array2[i] - v);
334
+ return smtr(sq_dev) / (arr1Len - 1);
335
+ };
336
+ /*TRIGONOMETRIA*/
337
+ //Seno de um número
338
+ module.exports.sen = function (x) {
339
+ const valorX = x.hasOwnProperty('valor') ? x.valor : x;
340
+ if (isNaN(valorX) || valorX === null)
341
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para sen(x).');
342
+ return Math.sin(valorX);
343
+ };
344
+ //Cosseno de um número
345
+ module.exports.cos = function (x) {
346
+ const valorX = x.hasOwnProperty('valor') ? x.valor : x;
347
+ if (isNaN(valorX) || valorX === null)
348
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para cos(x).');
349
+ return Math.cos(valorX);
350
+ };
351
+ //Tangente de um número
352
+ module.exports.tan = function (x) {
353
+ const valorX = x.hasOwnProperty('valor') ? x.valor : x;
354
+ if (isNaN(valorX) || valorX === null)
355
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para tan(x).');
356
+ return Math.tan(valorX);
357
+ };
358
+ //Arco cosseno de um número
359
+ module.exports.arcos = function (x) {
360
+ const valorX = x.hasOwnProperty('valor') ? x.valor : x;
361
+ if (isNaN(valorX) || valorX === null)
362
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para arcos(x).');
363
+ return Math.acos(valorX);
364
+ };
365
+ //Arco seno de um número
366
+ module.exports.arsen = function (x) {
367
+ const valorX = x.hasOwnProperty('valor') ? x.valor : x;
368
+ if (isNaN(valorX) || valorX === null)
369
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para arsen(x).');
370
+ return Math.asin(valorX);
371
+ };
372
+ //Arco tangente de um número
373
+ module.exports.artan = function (x) {
374
+ const valorX = x.hasOwnProperty('valor') ? x.valor : x;
375
+ if (isNaN(valorX) || valorX === null)
376
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para artan(x).');
377
+ return Math.atan(valorX);
378
+ };
379
+ //Exponencial
380
+ module.exports.exp = function (x) {
381
+ const valorX = x.hasOwnProperty('valor') ? x.valor : x;
382
+ if (isNaN(valorX) || valorX === null)
383
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para exp(x).');
384
+ return Math.exp(valorX);
385
+ };
386
+ //Logaritmo natural
387
+ module.exports.log = function (x) {
388
+ const valorX = x.hasOwnProperty('valor') ? x.valor : x;
389
+ if (isNaN(valorX) || valorX === null)
390
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para log(x).');
391
+ return Math.log(valorX);
392
+ };
393
+ // Retorna a base elevada ao expoente
394
+ const pot = function (base, expoente) {
395
+ const valorBaseResolvido = base.hasOwnProperty('valor') ? base.valor : base;
396
+ const valorExpoenteResolvido = expoente.hasOwnProperty('valor') ? expoente.valor : expoente;
397
+ if (typeof valorBaseResolvido !== 'number' || typeof valorExpoenteResolvido !== 'number') {
398
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Os parâmetros devem ser do tipo número.');
399
+ }
400
+ return Math.pow(valorBaseResolvido, valorExpoenteResolvido);
401
+ };
402
+ module.exports.potencia = pot;
403
+ //Raíz quadrada
404
+ module.exports.raizq = function (x) {
405
+ const valorX = x.hasOwnProperty('valor') ? x.valor : x;
406
+ if (isNaN(valorX) || valorX === null)
407
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para raizq(x).');
408
+ return Math.sqrt(valorX);
409
+ };
410
+ /*CINEMÁTICA*/
411
+ //Velocidade média
412
+ module.exports.velocidadeMedia = function (s, t) {
413
+ const valorS = s.hasOwnProperty('valor') ? s.valor : s;
414
+ const valorT = t.hasOwnProperty('valor') ? t.valor : t;
415
+ if (isNaN(valorS) || valorS === null || isNaN(valorT) || valorT === null)
416
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para velocidadeMedia(d,t).');
417
+ return valorS / valorT;
418
+ };
419
+ //Espaço percorrido
420
+ module.exports.deltaS = function (s0, s) {
421
+ const valorS0 = s0.hasOwnProperty('valor') ? s0.valor : s0;
422
+ const valorS = s.hasOwnProperty('valor') ? s.valor : s;
423
+ if (isNaN(valorS0) || valorS0 === null || isNaN(valorS) || valorS === null)
424
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para deltas(e0,e1).');
425
+ let ds = valorS - valorS0;
426
+ return ds;
427
+ };
428
+ //Tempo Percorrido
429
+ module.exports.deltaT = function (t0, t) {
430
+ const valorT0 = t0.hasOwnProperty('valor') ? t0.valor : t0;
431
+ const valorT = t.hasOwnProperty('valor') ? t.valor : t;
432
+ if (isNaN(valorT0) || valorT0 === null || isNaN(valorT) || valorT === null)
433
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para deltat(t,t1).');
434
+ let dt = valorT - valorT0;
435
+ return dt;
436
+ };
437
+ // Cálculo de aceleração
438
+ module.exports.aceleracao = function (velocidadeFinal, velocidadeInicial, tempoFinal, tempoInicial) {
439
+ const velocidadeFinalResolvido = velocidadeFinal.hasOwnProperty('valor') ? velocidadeFinal.valor : velocidadeFinal;
440
+ const velocidadeInicialResolvido = velocidadeInicial.hasOwnProperty('valor')
441
+ ? velocidadeInicial.valor
442
+ : velocidadeInicial;
443
+ const tempoFinalResolvido = tempoFinal.hasOwnProperty('valor') ? tempoFinal.valor : tempoFinal;
444
+ const tempoInicialResolvido = tempoInicial.hasOwnProperty('valor') ? tempoInicial.valor : tempoInicial;
445
+ if (velocidadeFinalResolvido === null ||
446
+ velocidadeInicialResolvido === null ||
447
+ tempoFinalResolvido === null ||
448
+ tempoInicialResolvido === null) {
449
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Devem ser fornecidos quatro parâmetros obrigatórios.');
450
+ }
451
+ if (typeof velocidadeFinalResolvido !== 'number' ||
452
+ typeof velocidadeInicialResolvido !== 'number' ||
453
+ typeof tempoFinalResolvido !== 'number' ||
454
+ typeof tempoInicialResolvido !== 'number') {
455
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Todos os parâmetros devem ser do tipo número.');
456
+ }
457
+ return (velocidadeFinalResolvido - velocidadeInicialResolvido) / (tempoFinalResolvido - tempoInicialResolvido);
458
+ };
459
+ //Função Horária da Posição (M.R.U)
460
+ module.exports.mrufh = function (s0, v, t) {
461
+ const valorS0 = s0.hasOwnProperty('valor') ? s0.valor : s0;
462
+ const valorV = v.hasOwnProperty('valor') ? v.valor : v;
463
+ let valorT = t.hasOwnProperty('valor') ? t.valor : t;
464
+ if (isNaN(valorS0) || valorS0 === null)
465
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para mrufh(s0,v,t).');
466
+ valorT = valorT + 1;
467
+ const s = [];
468
+ let index = 0;
469
+ for (let i = 0; i < valorT; i++) {
470
+ s[index] = valorS0 + valorV * i;
471
+ index++;
472
+ }
473
+ return ['Função: ' + valorS0 + '+(' + valorV + ')*t' + '<br>' + 'Posições: ' + s];
474
+ };
475
+ //Gráfico da velocidade (M.R.U.V)
476
+ module.exports.mruv = function (s0, s, a) {
477
+ const valorS0 = s0.hasOwnProperty('valor') ? s0.valor : s0;
478
+ const valorS = s.hasOwnProperty('valor') ? s.valor : s;
479
+ const valorA = a.hasOwnProperty('valor') ? a.valor : a;
480
+ if (isNaN(valorS0) || valorS0 === null || isNaN(valorS) || valorS === null || isNaN(valorA) || valorA === null)
481
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para mruv(Pi, Vf, A).');
482
+ const vf = [];
483
+ const x = [];
484
+ let v = [];
485
+ let index = 0;
486
+ for (let i = 0; i < valorS; i++) {
487
+ v = index;
488
+ vf[index] = Math.sqrt(2 * valorA * (index - valorS0));
489
+ x[index] = i;
490
+ index++;
491
+ }
492
+ return vf;
493
+ };
494
+ /*Controle e Servomecanismos*/
495
+ module.exports.pid = function (Mo, t, K, T1, T2) {
496
+ const valorMo = Mo.hasOwnProperty('valor') ? Mo.valor : Mo;
497
+ const valorT = t.hasOwnProperty('valor') ? t.valor : t;
498
+ const valorK = K.hasOwnProperty('valor') ? K.valor : K;
499
+ const valorT1 = T1.hasOwnProperty('valor') ? T1.valor : T1;
500
+ const valorT2 = T2.hasOwnProperty('valor') ? T2.valor : T2;
501
+ if (isNaN(valorMo) ||
502
+ valorMo === null ||
503
+ isNaN(valorT) ||
504
+ valorT === null ||
505
+ isNaN(valorK) ||
506
+ valorK === null ||
507
+ isNaN(valorT1) ||
508
+ valorT1 === null ||
509
+ isNaN(valorT2) ||
510
+ valorT2 === null) {
511
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'Você deve prover valores para pid(Ov, Ts, K, T1, T2).');
512
+ }
513
+ let pi = Math.PI; //Pi da bilbioteca Math.js
514
+ //AvalorMortecimento Relativo
515
+ let csi = (-1 * Math.log(valorMo / 100)) / Math.sqrt(Math.pow(pi, 2) + pot(Math.log(valorMo / 100), 2));
516
+ //Frequência Natural
517
+ let Wn = 4 / (t * csi);
518
+ //Controlador Proporcional (P)
519
+ let Kp = 20 * (Math.pow(csi, 2) * Math.pow(Wn, 2) * valorT1 * valorT2) +
520
+ (Math.pow(Wn, 2) * valorT1 * valorT2 - 1) / valorK;
521
+ //Controlador Integral (I)
522
+ let Ki = (10 * csi * Math.pow(Wn, 3) * valorT1 * valorT2) / valorK;
523
+ //Controlador Derivativo (D)
524
+ let Kd = (12 * csi * Wn * valorT1 * valorT2 - valorT1 - valorT2) / valorK;
525
+ return [csi, Wn, Kp, Ki, Kd];
526
+ };
527
+ // Retorna o comprimento de um vetor
528
+ module.exports.comp = function (array) {
529
+ if (!Array.isArray(array)) {
530
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'O valor passado pra função deve ser um vetor.');
531
+ }
532
+ return array.length;
533
+ };
534
+ // Retorna o menor número inteiro dentre o valor de "value"
535
+ module.exports.minaprox = function (value) {
536
+ const valueResolvido = value.hasOwnProperty('valor') ? value.valor : value;
537
+ if (typeof valueResolvido !== 'number') {
538
+ throw new excecoes_1.ErroEmTempoDeExecucao(this.token, 'O valor passado pra função deve ser um número.');
539
+ }
540
+ return Math.floor(valueResolvido);
541
+ };
542
542
  //# sourceMappingURL=matematica.js.map