ErrorsManager/Public/doc/es/manual/process.w.md

85 lines
2.2 KiB
Markdown
Raw Normal View History

```wmd-options
language = es
title_i18n = errors_manager_title_process
title_text = process - ErrorsManager
```
<!-- [[wmd]] -->
### process
[[@ [Array<Array<Integer, String>>] ErrorsManager.process(!Integer|String|Array<Integer> code, !Array<String> messages)]]
El método **process** es un método objeto que retorna el alfabeto actualmente en uso del objeto ErrorsManager.
```py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from Assets.ErrorsManager import ErrorsManager
i:int
errors_manager:ErrorsManager = ErrorsManager()
error_messages:tuple[str] = ["error_message_" + str(i) for i in range(16)]
print(errors_manager.process(105, error_messages))
print(errors_manager.process("pB", error_messages))
print(errors_manager.process([41, 1], error_messages))
```
```js
"use strict";
/** @type {ErrorsManager} */
const errors_manager = new ErrorsManager(),
/** @type {Array.<String>} */
error_messages = "0123456789abcdef".split("").map((_, i) => "error_message_" + i);
console.log(errors_manager.process(105, error_messages));
console.log(errors_manager.process("pB", error_messages));
console.log(errors_manager.process([41, 1], error_messages));
```
El resultado de estas pruebas es:
[|
|= i | Bit | Mensaje
| 0 | 0 | error_message_0
| 3 | 3 | error_message_3
| 5 | 5 | error_message_5
| 6 | 6 | error_message_6
|]
Esto viene siendo porque el código de error se puede ver de la siguiente forma:
[|
|= Byte | String | Array | Binario
| 0 | p | 41 | 101001
| 1 | B | 1 | 000001
|]
Si unimos todos los valores en un único binario tendríamos:
``105 = \[1, 41] = \[000001, 101001] = 000001101001 = 1101001``
Si miramos las posiciones de los bytes tenemos:
[|
|= Bit | Valor | Mensaje
| 0 | 1 | error_message_0
| 1 | 0 |
| 2 | 0 |
| 3 | 1 | error_message_3
| 4 | 0 |
| 5 | 1 | error_message_5
| 6 | 1 | error_message_6
| 7 | 0 |
| 8 | 0 |
| 9 | 0 |
| 10 | 0 |
| 11 | 0 |
|]
<!-- [[wmd]] -->