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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/**
 * <p>A simple, fast array of bits, represented compactly by an array of ints internally.</p>
 *
 * @author Sean Owen
 */
export default class BitArray {
    private size;
    private bits;
    constructor(size?: number, bits?: Int32Array);
    getSize(): number;
    getSizeInBytes(): number;
    private ensureCapacity;
    /**
     * @param i bit to get
     * @return true iff bit i is set
     */
    get(i: number): boolean;
    /**
     * Sets bit i.
     *
     * @param i bit to set
     */
    set(i: number): void;
    /**
     * Flips bit i.
     *
     * @param i bit to set
     */
    flip(i: number): void;
    /**
     * @param from first bit to check
     * @return index of first bit that is set, starting from the given index, or size if none are set
     *  at or beyond this given index
     * @see #getNextUnset(int)
     */
    getNextSet(from: number): number;
    /**
     * @param from index to start looking for unset bit
     * @return index of next unset bit, or {@code size} if none are unset until the end
     * @see #getNextSet(int)
     */
    getNextUnset(from: number): number;
    /**
     * Sets a block of 32 bits, starting at bit i.
     *
     * @param i first bit to set
     * @param newBits the new value of the next 32 bits. Note again that the least-significant bit
     * corresponds to bit i, the next-least-significant to i+1, and so on.
     */
    setBulk(i: number, newBits: number): void;
    /**
     * Sets a range of bits.
     *
     * @param start start of range, inclusive.
     * @param end end of range, exclusive
     */
    setRange(start: number, end: number): void;
    /**
     * Clears all bits (sets to false).
     */
    clear(): void;
    /**
     * Efficient method to check if a range of bits is set, or not set.
     *
     * @param start start of range, inclusive.
     * @param end end of range, exclusive
     * @param value if true, checks that bits in range are set, otherwise checks that they are not set
     * @return true iff all bits are set or not set in range, according to value argument
     * @throws IllegalArgumentException if end is less than start or the range is not contained in the array
     */
    isRange(start: number, end: number, value: boolean): boolean;
    appendBit(bit: boolean): void;
    /**
     * Appends the least-significant bits, from value, in order from most-significant to
     * least-significant. For example, appending 6 bits from 0x000001E will append the bits
     * 0, 1, 1, 1, 1, 0 in that order.
     *
     * @param value {@code int} containing bits to append
     * @param numBits bits from value to append
     */
    appendBits(value: number, numBits: number): void;
    appendBitArray(other: BitArray): void;
    xor(other: BitArray): void;
    /**
     *
     * @param bitOffset first bit to start writing
     * @param array array to write into. Bytes are written most-significant byte first. This is the opposite
     *  of the internal representation, which is exposed by {@link #getBitArray()}
     * @param offset position in array to start writing
     * @param numBytes how many bytes to write
     */
    toBytes(bitOffset: number, array: Uint8Array, offset: number, numBytes: number): void;
    /**
     * @return underlying array of ints. The first element holds the first 32 bits, and the least
     *         significant bit is bit 0.
     */
    getBitArray(): Int32Array;
    /**
     * Reverses all bits in the array.
     */
    reverse(): void;
    private static makeArray;
    equals(o: any): boolean;
    hashCode(): number;
    toString(): string;
    clone(): BitArray;
    /**
     * converts to boolean array.
     */
    toArray(): Array<boolean>;
}