balloc 1.0.1 → 1.3.0

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,29 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.3.0] - 2026-11-19
9
+
10
+ ### Added
11
+ - `shrink()` method ([#5](https://github.com/AugustoVasques75/balloc/issues/5)).
12
+
13
+ ### Changed
14
+ - `withView()` now supports multiple blocks ([#6](https://github.com/AugustoVasques75/balloc/issues/6)).
15
+
16
+ ### Fixed
17
+ - Removed extraneous sections from API documentation.
18
+
19
+ ## [1.2.0]
20
+
21
+ ### Added
22
+ - `withView()` method ([#3](https://github.com/AugustoVasques75/balloc/issues/3)).
23
+ - `indexOf()` method ([#1](https://github.com/AugustoVasques75/balloc/issues/1)).
24
+ - `lastIndexOf()` method.
25
+ - `isFull()` method ([#2](https://github.com/AugustoVasques75/balloc/issues/2)).
26
+
27
+ ### Fixed
28
+ - Duplicate memory allocation in constructor ([#4](https://github.com/AugustoVasques75/balloc/issues/4)).
29
+ - Typos in documentation.
package/README.MD CHANGED
@@ -113,36 +113,36 @@ yarn add Balloc
113
113
  In HTML, use the unpkg CDN:
114
114
 
115
115
  ```text
116
- https://unpkg.com/Balloc
116
+ [https://unpkg.com/Balloc](https://unpkg.com/Balloc)
117
117
 
118
118
  ```
119
119
 
120
120
  Or use its localized docstring versions for some languages:
121
121
 
122
122
  ```
123
- Arabic: https://unpkg.com/Balloc/src/ar/Balloc.mjs
124
- English: https://unpkg.com/Balloc/src/en/Balloc.mjs
125
- Spanish: https://unpkg.com/Balloc/src/es/Balloc.mjs
126
- Japanese: https://unpkg.com/Balloc/src/jp/Balloc.mjs
127
- Chinese: https://unpkg.com/Balloc/src/zh/Balloc.mjs
123
+ Arabic: [https://unpkg.com/Balloc/src/ar/Balloc.mjs](https://unpkg.com/Balloc/src/ar/Balloc.mjs)
124
+ English: [https://unpkg.com/Balloc/src/en/Balloc.mjs](https://unpkg.com/Balloc/src/en/Balloc.mjs)
125
+ Spanish: [https://unpkg.com/Balloc/src/es/Balloc.mjs](https://unpkg.com/Balloc/src/es/Balloc.mjs)
126
+ Japanese: [https://unpkg.com/Balloc/src/jp/Balloc.mjs](https://unpkg.com/Balloc/src/jp/Balloc.mjs)
127
+ Chinese: [https://unpkg.com/Balloc/src/zh/Balloc.mjs](https://unpkg.com/Balloc/src/zh/Balloc.mjs)
128
128
 
129
129
  ```
130
130
 
131
131
  Ou ainda utilize o CDN jsDelivr:
132
132
 
133
133
  ```text
134
- https://cdn.jsdelivr.net/npm/Balloc
134
+ [https://cdn.jsdelivr.net/npm/Balloc](https://cdn.jsdelivr.net/npm/Balloc)
135
135
 
136
136
  ```
137
137
 
138
138
  CDNs with localization support:
139
139
 
140
140
  ```
141
- Arabic: https://cdn.jsdelivr.net/npm/Balloc/src/ar/Balloc.mjs
142
- English: https://cdn.jsdelivr.net/npm/Balloc/src/en/Balloc.mjs
143
- Spanish: https://cdn.jsdelivr.net/npm/Balloc/src/es/Balloc.mjs
144
- Japanese: https://cdn.jsdelivr.net/npm/Balloc/src/jp/Balloc.mjs
145
- Chinese: https://cdn.jsdelivr.net/npm/Balloc/src/zh/Balloc.mjs
141
+ Arabic: [https://cdn.jsdelivr.net/npm/Balloc/src/ar/Balloc.mjs](https://cdn.jsdelivr.net/npm/Balloc/src/ar/Balloc.mjs)
142
+ English: [https://cdn.jsdelivr.net/npm/Balloc/src/en/Balloc.mjs](https://cdn.jsdelivr.net/npm/Balloc/src/en/Balloc.mjs)
143
+ Spanish: [https://cdn.jsdelivr.net/npm/Balloc/src/es/Balloc.mjs](https://cdn.jsdelivr.net/npm/Balloc/src/es/Balloc.mjs)
144
+ Japanese: [https://cdn.jsdelivr.net/npm/Balloc/src/jp/Balloc.mjs](https://cdn.jsdelivr.net/npm/Balloc/src/jp/Balloc.mjs)
145
+ Chinese: [https://cdn.jsdelivr.net/npm/Balloc/src/zh/Balloc.mjs](https://cdn.jsdelivr.net/npm/Balloc/src/zh/Balloc.mjs)
146
146
 
147
147
  ```
148
148
 
@@ -278,6 +278,7 @@ alloc()
278
278
  ├── acesso / modificação
279
279
  │
280
280
  ├── realloc()
281
+ ├── shrink()
281
282
  │
282
283
  └── free()
283
284
  │
@@ -304,7 +305,7 @@ The complete API documentation is available in the [`./docs`](./docs) directory
304
305
  | Chinese | [./docs/API — balloc.zh.md](./docs/API%20—%20balloc.zh.md) |
305
306
  | Spanish | [./docs/API — balloc.es.md](./docs/API%20—%20balloc.es.md) |
306
307
  | English | [./docs/API — balloc.en.md](./docs/API%20—%20balloc.en.md) |
307
- | Japanese | [./docs/API — balloc.ja.md](./docs/API%20—%20balloc.ja.md) |
308
+ | Japanese | [./docs/API — balloc.jp.md](./docs/API%20—%20balloc.jp.md) |
308
309
  | Portuguese | [./docs/API — balloc.pt.md](./docs/API%20—%20balloc.pt.md) |
309
310
 
310
311
 
@@ -327,9 +328,11 @@ The following is a summary of these groups:
327
328
  | --- | --- |
328
329
  | `alloc()` | Allocate a block |
329
330
  | `realloc()` | Increase block capacity |
331
+ | `shrink()` | Reduce block capacity to fit occupied elements |
330
332
  | `free()` | Free a block |
331
333
  | `gc()` | Compact the data heap |
332
334
 
335
+
333
336
  ### Stack operations
334
337
 
335
338
  | API | Description |
@@ -351,6 +354,8 @@ The following is a summary of these groups:
351
354
  | API | Description |
352
355
  | --- | --- |
353
356
  | `has()` | Search for a value |
357
+ | `indexOf()` | Search for a value (first match) |
358
+ | `lastIndexOf()` | Search for a value (last match) |
354
359
  | `get()` | Read an element |
355
360
  | `set()` | Write an element |
356
361
  | `clear()` | Clear occupancy and fill the block |
@@ -358,6 +363,7 @@ The following is a summary of these groups:
358
363
  | `fillAll()` | Fill and occupy the entire block |
359
364
  | `put()` | Copy an array into a block |
360
365
  | `pick()` | Copy occupied elements out of a block |
366
+ | `withView()` | Borrow a typed view over occupied elements |
361
367
 
362
368
  ### Block interchange
363
369
 
@@ -383,12 +389,14 @@ The following is a summary of these groups:
383
389
  | `byteSize()` | Physical block size in bytes |
384
390
  | `occupied()` | Number of occupied elements |
385
391
  | `length()` | Physical element capacity |
392
+ | `isFull()` | Check whether the block is completely occupied |
386
393
  | `recycleCount()` | Number of recyclable regions |
387
394
  | `recycleBytes` | Currently recyclable bytes |
388
395
  | `allocatedBytes` | Bytes associated with non-recycled regions |
389
396
  | `unallocatedBytes` | Space remaining after the bump pointer |
390
397
  | `fragmentationRatio` | Recycled bytes / used heap area |
391
398
 
399
+
392
400
  ### Internal functions
393
401
 
394
402
  These are a special class of API primarily used internally by the allocator and generally not recommended for day-to-day code, as they may cause undocumented side effects. They are intended for library extensions and modifications where a thorough understanding of the Balloc source code is essential.
@@ -426,7 +434,7 @@ If you like this project and want to support its development:
426
434
 
427
435
  | Pix QR Code | Copy-and-Paste / Random Key |
428
436
  | :---: | :--- |
429
- | <img src="./img/pix.png" alt="Pix QR Code" width="200"> | **Random Key:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
437
+ | ![Pix QR Code](https://raw.githubusercontent.com/AugustoVasques75/balloc/main/img/pix.png) | **Random Key:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
430
438
 
431
439
  ## License
432
440
 
package/README.ar.md CHANGED
@@ -278,7 +278,7 @@ alloc()
278
278
  | الصينية | [./docs/API — balloc.zh.md](./docs/API%20—%20balloc.zh.md) |
279
279
  | الإسبانية | [./docs/API — balloc.es.md](./docs/API%20—%20balloc.es.md) |
280
280
  | الإنجليزية | [./docs/API — balloc.en.md](./docs/API%20—%20balloc.en.md) |
281
- | اليابانية | [./docs/API — balloc.ja.md](./docs/API%20—%20balloc.ja.md) |
281
+ | اليابانية | [./docs/API — balloc.jp.md](./docs/API%20—%20balloc.jp.md) |
282
282
  | البرتغالية | [./docs/API — balloc.pt.md](./docs/API%20—%20balloc.pt.md) |
283
283
 
284
284
  تُصنَّف أساليب API بحسب الوظيفة ضمن المجموعات التالية:
@@ -300,6 +300,7 @@ alloc()
300
300
  |---|---|
301
301
  | `alloc()` | تخصيص كتلة |
302
302
  | `realloc()` | زيادة سعة الكتلة |
303
+ | `shrink()` | تقليل سعة الكتلة لتناسب العناصر المشغولة |
303
304
  | `free()` | تحرير كتلة |
304
305
  | `gc()` | ضغط كومة البيانات |
305
306
 
@@ -324,6 +325,8 @@ alloc()
324
325
  | API | الوصف |
325
326
  |---|---|
326
327
  | `has()` | البحث عن قيمة |
328
+ | `indexOf()` | البحث عن أول ظهور لقيمة |
329
+ | `lastIndexOf()` | البحث عن آخر ظهور لقيمة |
327
330
  | `get()` | قراءة عنصر |
328
331
  | `set()` | كتابة عنصر |
329
332
  | `clear()` | مسح حالة الإشغال وملء الكتلة |
@@ -331,6 +334,7 @@ alloc()
331
334
  | `fillAll()` | ملء الكتلة بالكامل وجعل جميع عناصرها مشغولة |
332
335
  | `put()` | نسخ مصفوفة إلى كتلة |
333
336
  | `pick()` | نسخ العناصر المشغولة من كتلة إلى خارجها |
337
+ | `withView()` | استعارة عروض TypedArray للعناصر المشغولة |
334
338
 
335
339
  ### تبادل البيانات بين الكتل
336
340
 
@@ -356,12 +360,12 @@ alloc()
356
360
  | `byteSize()` | إرجاع الحجم المادي للكتلة بالبايت |
357
361
  | `occupied()` | إرجاع عدد العناصر المشغولة |
358
362
  | `length()` | إرجاع السعة المادية بالعناصر |
363
+ | `isFull()` | التحقق مما إذا كانت الكتلة مشغولة بالكامل |
359
364
  | `recycleCount()` | إرجاع عدد المناطق القابلة لإعادة الاستخدام |
360
365
  | `recycleBytes` | عدد البايتات القابلة لإعادة الاستخدام حاليًا |
361
366
  | `allocatedBytes` | عدد البايتات المرتبطة بمناطق غير قابلة لإعادة الاستخدام |
362
367
  | `unallocatedBytes` | المساحة المتبقية بعد مؤشر التخصيص المتزايد |
363
368
  | `fragmentationRatio` | البايتات القابلة لإعادة الاستخدام / مساحة الكومة المستخدمة |
364
-
365
369
  ### الدوال الداخلية
366
370
 
367
371
  تمثل هذه الدوال حالة خاصة من واجهة API، وتُستخدم أساسًا داخل المُخصِّص نفسه. لا يُوصى عادةً باستعمالها في الشيفرة اليومية، إذ قد تُحدث آثارًا جانبية غير موثقة. وهي مخصصة لتوسيع المكتبة أو تعديلها، ويتطلب استخدامها فهمًا كاملًا للشيفرة المصدرية لـBalloc.
@@ -398,7 +402,7 @@ alloc()
398
402
 
399
403
  | رمز QR لخدمة Pix | مفتاح النسخ واللصق / المفتاح العشوائي |
400
404
  | :---: | :--- |
401
- | ![رمز QR لخدمة Pix](./img/pix.png) | **المفتاح العشوائي:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
405
+ | ![رمز QR لخدمة Pix](https://raw.githubusercontent.com/AugustoVasques75/balloc/main/img/pix.png) | **المفتاح العشوائي:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
402
406
 
403
407
  ## الترخيص
404
408
 
package/README.en.md CHANGED
@@ -304,7 +304,7 @@ The complete API documentation is available in the [`./docs`](./docs) directory
304
304
  | Chinese | [./docs/API — balloc.zh.md](./docs/API%20—%20balloc.zh.md) |
305
305
  | Spanish | [./docs/API — balloc.es.md](./docs/API%20—%20balloc.es.md) |
306
306
  | English | [./docs/API — balloc.en.md](./docs/API%20—%20balloc.en.md) |
307
- | Japanese | [./docs/API — balloc.ja.md](./docs/API%20—%20balloc.ja.md) |
307
+ | Japanese | [./docs/API — balloc.jp.md](./docs/API%20—%20balloc.jp.md) |
308
308
  | Portuguese | [./docs/API — balloc.pt.md](./docs/API%20—%20balloc.pt.md) |
309
309
 
310
310
 
@@ -327,6 +327,7 @@ The following is a summary of these groups:
327
327
  | --- | --- |
328
328
  | `alloc()` | Allocate a block |
329
329
  | `realloc()` | Increase block capacity |
330
+ | `shrink()` | Reduce block capacity to fit occupied elements |
330
331
  | `free()` | Free a block |
331
332
  | `gc()` | Compact the data heap |
332
333
 
@@ -351,6 +352,8 @@ The following is a summary of these groups:
351
352
  | API | Description |
352
353
  | --- | --- |
353
354
  | `has()` | Search for a value |
355
+ | `indexOf()` | Search for a value (first match) |
356
+ | `lastIndexOf()` | Search for a value (last match) |
354
357
  | `get()` | Read an element |
355
358
  | `set()` | Write an element |
356
359
  | `clear()` | Clear occupancy and fill the block |
@@ -358,6 +361,7 @@ The following is a summary of these groups:
358
361
  | `fillAll()` | Fill and occupy the entire block |
359
362
  | `put()` | Copy an array into a block |
360
363
  | `pick()` | Copy occupied elements out of a block |
364
+ | `withView()` | Borrow typed views over occupied elements |
361
365
 
362
366
  ### Block interchange
363
367
 
@@ -383,12 +387,12 @@ The following is a summary of these groups:
383
387
  | `byteSize()` | Physical block size in bytes |
384
388
  | `occupied()` | Number of occupied elements |
385
389
  | `length()` | Physical element capacity |
390
+ | `isFull()` | Check whether the block is completely occupied |
386
391
  | `recycleCount()` | Number of recyclable regions |
387
392
  | `recycleBytes` | Currently recyclable bytes |
388
393
  | `allocatedBytes` | Bytes associated with non-recycled regions |
389
394
  | `unallocatedBytes` | Space remaining after the bump pointer |
390
395
  | `fragmentationRatio` | Recycled bytes / used heap area |
391
-
392
396
  ### Internal functions
393
397
 
394
398
  These are a special class of API primarily used internally by the allocator and generally not recommended for day-to-day code, as they may cause undocumented side effects. They are intended for library extensions and modifications where a thorough understanding of the Balloc source code is essential.
@@ -426,7 +430,7 @@ If you like this project and want to support its development:
426
430
 
427
431
  | Pix QR Code | Copy-and-Paste / Random Key |
428
432
  | :---: | :--- |
429
- | ![Pix QR Code](./img/pix.png) | **Random Key:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
433
+ | ![Pix QR Code](https://raw.githubusercontent.com/AugustoVasques75/balloc/main/img/pix.png) | **Random Key:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
430
434
 
431
435
  ## License
432
436
 
package/README.es.md CHANGED
@@ -278,7 +278,7 @@ La documentación completa de la API está disponible en la carpeta [`./docs`](.
278
278
  | Chino | [./docs/API — balloc.zh.md](./docs/API%20—%20balloc.zh.md) |
279
279
  | Español | [./docs/API — balloc.es.md](./docs/API%20—%20balloc.es.md) |
280
280
  | Inglés | [./docs/API — balloc.en.md](./docs/API%20—%20balloc.en.md) |
281
- | Japonés | [./docs/API — balloc.ja.md](./docs/API%20—%20balloc.ja.md) |
281
+ | Japonés | [./docs/API — balloc.jp.md](./docs/API%20—%20balloc.jp.md) |
282
282
  | Portugués | [./docs/API — balloc.pt.md](./docs/API%20—%20balloc.pt.md) |
283
283
 
284
284
  Los métodos de la API están agrupados por afinidad:
@@ -300,6 +300,7 @@ A continuación, un resumen de estos grupos:
300
300
  | --- | --- |
301
301
  | `alloc()` | Asignar un bloque |
302
302
  | `realloc()` | Aumentar la capacidad del bloque |
303
+ | `shrink()` | Reducir la capacidad del bloque para ajustarla a los elementos ocupados |
303
304
  | `free()` | Liberar un bloque |
304
305
  | `gc()` | Compactar el heap de datos |
305
306
 
@@ -324,6 +325,8 @@ A continuación, un resumen de estos grupos:
324
325
  | API | Descripción |
325
326
  | --- | --- |
326
327
  | `has()` | Buscar un valor |
328
+ | `indexOf()` | Buscar la primera aparición de un valor |
329
+ | `lastIndexOf()` | Buscar la última aparición de un valor |
327
330
  | `get()` | Leer un elemento |
328
331
  | `set()` | Escribir un elemento |
329
332
  | `clear()` | Limpiar la ocupación y resetear el bloque |
@@ -331,6 +334,7 @@ A continuación, un resumen de estos grupos:
331
334
  | `fillAll()` | Rellenar y ocupar todo el bloque |
332
335
  | `put()` | Copiar un array a un bloque |
333
336
  | `pick()` | Copiar elementos ocupados fuera de un bloque |
337
+ | `withView()` | Tomar prestadas vistas tipadas de los elementos ocupados |
334
338
 
335
339
  ### Intercambio entre bloques
336
340
 
@@ -356,12 +360,12 @@ A continuación, un resumen de estos grupos:
356
360
  | `byteSize()` | Tamaño físico del bloque en bytes |
357
361
  | `occupied()` | Recuento de elementos ocupados |
358
362
  | `length()` | Capacidad física de elementos |
363
+ | `isFull()` | Comprobar si el bloque está completamente ocupado |
359
364
  | `recycleCount()` | Número de regiones reciclables |
360
365
  | `recycleBytes` | Bytes actualmente reciclables |
361
366
  | `allocatedBytes` | Bytes asociados a regiones no recicladas |
362
367
  | `unallocatedBytes` | Espacio restante tras el puntero de bump |
363
368
  | `fragmentationRatio` | Bytes reciclados / área de heap usada |
364
-
365
369
  ### Funciones internas
366
370
 
367
371
  Son un caso especial de API utilizada primariamente dentro del propio asignador y normalmente no se recomiendan para el uso diario, ya que pueden causar efectos secundarios no documentados. Su uso está destinado a extensiones y modificaciones de la biblioteca donde sea fundamental la comprensión total del código fuente de Balloc.
@@ -398,7 +402,7 @@ Si te gusta este proyecto y quieres apoyar su desarrollo:
398
402
 
399
403
  | QR Code Pix | Clave Copia y Pega / Aleatoria |
400
404
  | :---: | :--- |
401
- | ![Pix QR Code](./img/pix.png) | **Clave Aleatoria:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
405
+ | ![Pix QR Code](https://raw.githubusercontent.com/AugustoVasques75/balloc/main/img/pix.png) | **Clave Aleatoria:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
402
406
 
403
407
  ## Licencia
404
408
 
package/README.jp.md CHANGED
@@ -277,7 +277,7 @@ APIの完全なドキュメントは[`./docs`](./docs)フォルダーにあり
277
277
  | 中国語 | [./docs/API — balloc.zh.md](./docs/API%20—%20balloc.zh.md) |
278
278
  | スペイン語 | [./docs/API — balloc.es.md](./docs/API%20—%20balloc.es.md) |
279
279
  | 英語 | [./docs/API — balloc.en.md](./docs/API%20—%20balloc.en.md) |
280
- | 日本語 | [./docs/API — balloc.ja.md](./docs/API%20—%20balloc.ja.md) |
280
+ | 日本語 | [./docs/API — balloc.jp.md](./docs/API%20—%20balloc.jp.md) |
281
281
  | ポルトガル語 | [./docs/API — balloc.pt.md](./docs/API%20—%20balloc.pt.md) |
282
282
 
283
283
  APIメソッドは機能ごとに次のグループに分類されています。
@@ -299,6 +299,7 @@ APIメソッドは機能ごとに次のグループに分類されています
299
299
  |---|---|
300
300
  | `alloc()` | ブロックを割り当てる |
301
301
  | `realloc()` | ブロックの容量を拡張する |
302
+ | `shrink()` | 使用中の要素数に合わせてブロック容量を縮小する |
302
303
  | `free()` | ブロックを解放する |
303
304
  | `gc()` | データヒープをコンパクションする |
304
305
 
@@ -323,6 +324,8 @@ APIメソッドは機能ごとに次のグループに分類されています
323
324
  | API | 説明 |
324
325
  |---|---|
325
326
  | `has()` | 値を検索する |
327
+ | `indexOf()` | 値が最初に現れる位置を検索する |
328
+ | `lastIndexOf()` | 値が最後に現れる位置を検索する |
326
329
  | `get()` | 要素を読み取る |
327
330
  | `set()` | 要素を書き込む |
328
331
  | `clear()` | 使用状態をクリアし、ブロックを値で埋める |
@@ -330,6 +333,7 @@ APIメソッドは機能ごとに次のグループに分類されています
330
333
  | `fillAll()` | ブロック全体を埋め、すべての要素を使用済みにする |
331
334
  | `put()` | 配列をブロックにコピーする |
332
335
  | `pick()` | 使用中の要素をブロックから外部へコピーする |
336
+ | `withView()` | 使用中の要素に対応する型付きビューを借用する |
333
337
 
334
338
  ### ブロック間のデータ交換
335
339
 
@@ -355,12 +359,12 @@ APIメソッドは機能ごとに次のグループに分類されています
355
359
  | `byteSize()` | ブロックの物理サイズをバイト単位で返す |
356
360
  | `occupied()` | 使用中の要素数を返す |
357
361
  | `length()` | 物理容量(要素数)を返す |
362
+ | `isFull()` | ブロックが完全に使用中か確認する |
358
363
  | `recycleCount()` | 再利用可能な領域の数を返す |
359
364
  | `recycleBytes` | 現在再利用可能なバイト数 |
360
365
  | `allocatedBytes` | 再利用対象ではない領域に割り当てられているバイト数 |
361
366
  | `unallocatedBytes` | バンプポインター以降の残り領域のバイト数 |
362
367
  | `fragmentationRatio` | 再利用済みバイト数/使用中ヒープ領域 |
363
-
364
368
  ### 内部関数
365
369
 
366
370
  内部関数は、主にアロケータ内部で使用される特殊なAPIです。未記載の副作用が生じる可能性があるため、日常的なコードでの使用は通常推奨されません。Ballocのソースコードを十分に理解したうえで行う、ライブラリの拡張や変更を目的としています。
@@ -397,7 +401,7 @@ APIメソッドは機能ごとに次のグループに分類されています
397
401
 
398
402
  | Pix QRコード | コピー&ペースト用キー/ランダムキー |
399
403
  | :---: | :--- |
400
- | ![Pix QR Code](./img/pix.png) | **ランダムキー:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
404
+ | ![Pix QR Code](https://raw.githubusercontent.com/AugustoVasques75/balloc/main/img/pix.png) | **ランダムキー:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
401
405
 
402
406
  ## ライセンス
403
407
 
package/README.pt.md CHANGED
@@ -327,6 +327,7 @@ Segue um resumo desses agrupamentos:
327
327
  | --- | --- |
328
328
  | `alloc()` | Alocar um bloco |
329
329
  | `realloc()` | Aumentar a capacidade do bloco |
330
+ | `shrink()` | Reduzir a capacidade do bloco para acomodar os elementos ocupados |
330
331
  | `free()` | Liberar um bloco |
331
332
  | `gc()` | Compactar o heap de dados |
332
333
 
@@ -350,14 +351,14 @@ Segue um resumo desses agrupamentos:
350
351
 
351
352
  | API | Descrição |
352
353
  | --- | --- |
353
- | `has()` | Buscar por um valor |
354
- | `get()` | Ler um elemento |
354
+ | `has()` | Verificar a existência de um valor |
355
+ | `indexOf()` | Localizar a primeira ocorrência de um valor |\n| `lastIndexOf()` | Localizar a última ocorrência de um valor |\n| `get()` | Ler um elemento |
355
356
  | `set()` | Escrever um elemento |
356
357
  | `clear()` | Limpar a ocupação e preencher o bloco |
357
358
  | `fill()` | Preencher um intervalo |
358
359
  | `fillAll()` | Preencher e ocupar todo o bloco |
359
360
  | `put()` | Copiar um array para um bloco |
360
- | `pick()` | Copiar elementos ocupados para fora de um bloco |
361
+ | `withView()` | Emprestar views tipadas dos elementos ocupados |
361
362
 
362
363
  ### Intercâmbio entre blocos
363
364
 
@@ -382,13 +383,12 @@ Segue um resumo desses agrupamentos:
382
383
  | --- | --- |
383
384
  | `byteSize()` | Tamanho físico do bloco em bytes |
384
385
  | `occupied()` | Contagem de elementos ocupados |
385
- | `length()` | Capacidade física de elementos |
386
+ | `length()` | Capacidade física de elementos |\n| `isFull()` | Verificar se o bloco está completamente ocupado |
386
387
  | `recycleCount()` | Número de regiões recicláveis |
387
388
  | `recycleBytes` | Bytes atualmente recicláveis |
388
389
  | `allocatedBytes` | Bytes associados a regiões não recicladas |
389
390
  | `unallocatedBytes` | Espaço restante após o ponteiro do bump |
390
391
  | `fragmentationRatio` | Bytes reciclados / área de heap usada |
391
-
392
392
  ### Funções internas
393
393
 
394
394
  São um caso especial de API utilizada primariamente dentro do próprio alocador e normalmente não recomendadas para uso no código do dia a dia, pois podem causar efeitos colaterais não documentados. Seu uso destina-se a extensões e modificações da biblioteca onde é fundamental o entendimento e a compreensão total do código-fonte de Balloc.
@@ -426,7 +426,7 @@ Se você gosta deste projeto e quer apoiar o seu desenvolvimento:
426
426
 
427
427
  | QR Code Pix | Chave Copia e Cola / Aleatória |
428
428
  | :---: | :--- |
429
- | ![Pix QR Code](./img/pix.png) | **Chave Aleatória:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
429
+ | ![Pix QR Code](https://raw.githubusercontent.com/AugustoVasques75/balloc/main/img/pix.png) | **Chave Aleatória:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
430
430
 
431
431
  ## Licença
432
432
 
package/README.zh.md CHANGED
@@ -277,7 +277,7 @@ Balloc 提供以下几种数据访问模型:
277
277
  | 中文 | [./docs/API — balloc.zh.md](./docs/API%20—%20balloc.zh.md) |
278
278
  | 西班牙语 | [./docs/API — balloc.es.md](./docs/API%20—%20balloc.es.md) |
279
279
  | 英语 | [./docs/API — balloc.en.md](./docs/API%20—%20balloc.en.md) |
280
- | 日语 | [./docs/API — balloc.ja.md](./docs/API%20—%20balloc.ja.md) |
280
+ | 日语 | [./docs/API — balloc.jp.md](./docs/API%20—%20balloc.jp.md) |
281
281
  | 葡萄牙语 | [./docs/API — balloc.pt.md](./docs/API%20—%20balloc.pt.md) |
282
282
 
283
283
  API 方法按功能归为以下类别:
@@ -299,6 +299,7 @@ API 方法按功能归为以下类别:
299
299
  |---|---|
300
300
  | `alloc()` | 分配数据块 |
301
301
  | `realloc()` | 扩展数据块容量 |
302
+ | `shrink()` | 将数据块容量缩减至适合已占用元素的大小 |
302
303
  | `free()` | 释放数据块 |
303
304
  | `gc()` | 压缩数据堆 |
304
305
 
@@ -323,6 +324,8 @@ API 方法按功能归为以下类别:
323
324
  | API | 说明 |
324
325
  |---|---|
325
326
  | `has()` | 搜索指定值 |
327
+ | `indexOf()` | 查找值首次出现的位置 |
328
+ | `lastIndexOf()` | 查找值最后一次出现的位置 |
326
329
  | `get()` | 读取元素 |
327
330
  | `set()` | 写入元素 |
328
331
  | `clear()` | 清除占用状态并填充数据块 |
@@ -330,6 +333,7 @@ API 方法按功能归为以下类别:
330
333
  | `fillAll()` | 填充整个数据块并将其全部标记为已占用 |
331
334
  | `put()` | 将数组复制到数据块 |
332
335
  | `pick()` | 将已占用的元素复制出数据块 |
336
+ | `withView()` | 借用覆盖已占用元素的类型化视图 |
333
337
 
334
338
  ### 数据块间交换
335
339
 
@@ -355,12 +359,12 @@ API 方法按功能归为以下类别:
355
359
  | `byteSize()` | 返回数据块的物理大小,单位为字节 |
356
360
  | `occupied()` | 返回已占用的元素数量 |
357
361
  | `length()` | 返回物理容量(元素数量) |
362
+ | `isFull()` | 检查数据块是否已完全占用 |
358
363
  | `recycleCount()` | 返回可回收区域的数量 |
359
364
  | `recycleBytes` | 当前可回收的字节数 |
360
365
  | `allocatedBytes` | 已分配给非回收区域的字节数 |
361
366
  | `unallocatedBytes` | bump 指针之后的剩余空间 |
362
367
  | `fragmentationRatio` | 可回收字节数/已使用堆区域 |
363
-
364
368
  ### 内部函数
365
369
 
366
370
  内部函数属于特殊 API,主要供分配器内部使用。由于可能产生未文档化的副作用,通常不建议在日常业务代码中调用。它们面向对 Balloc 源码有充分理解、需要扩展或修改库的开发者。
@@ -397,7 +401,7 @@ API 方法按功能归为以下类别:
397
401
 
398
402
  | Pix 二维码 | 复制粘贴密钥/随机密钥 |
399
403
  | :---: | :--- |
400
- | ![Pix QR Code](./img/pix.png) | **随机密钥:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
404
+ | ![Pix QR Code](https://raw.githubusercontent.com/AugustoVasques75/balloc/main/img/pix.png) | **随机密钥:**<br>`e87d773a-0b97-4410-8fc3-f7ec04cce6a2` |
401
405
 
402
406
  ## 许可证
403
407