Houjie
2025-07-24 52a3ff1bce1417b39f6872d8e8cb378e9c2ccc6f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/**
 * <p>Encapsulates a set of error-correction blocks in one symbol version. Most versions will
 * use blocks of differing sizes within one version, so, this encapsulates the parameters for
 * each set of blocks. It also holds the number of error-correction codewords per block since it
 * will be the same across all blocks within one version.</p>
 */
export default class ECBlocks {
    constructor(ecCodewordsPerBlock /*int*/, ...ecBlocks) {
        this.ecCodewordsPerBlock = ecCodewordsPerBlock;
        this.ecBlocks = ecBlocks;
    }
    getECCodewordsPerBlock() {
        return this.ecCodewordsPerBlock;
    }
    getNumBlocks() {
        let total = 0;
        const ecBlocks = this.ecBlocks;
        for (const ecBlock of ecBlocks) {
            total += ecBlock.getCount();
        }
        return total;
    }
    getTotalECCodewords() {
        return this.ecCodewordsPerBlock * this.getNumBlocks();
    }
    getECBlocks() {
        return this.ecBlocks;
    }
}