| Modifier and Type | Field and Description |
|---|---|
| private final int | blockSize
The block size in bytes. |
| private static final boolean | |
| private int | failureFlags
Left-shifting register, which holds outcomes of recent allocations. |
| private final int | firstFreeBlock
The first usable block. |
| private final BitSet | set
The bit set. |
| Access | Constructor and Description |
|---|---|
| public | FreeSpaceBitSet(int
the first free block firstFreeBlock, int the block size blockSize)Create a new free space map. |
| Modifier and Type | Method and Description |
|---|---|
| public long | Returns: the start position in bytesthe number of bytes to allocate length)Allocate a number of blocks and mark them as used. |
| pack-priv long | Returns: the start position in bytesthe number of bytes to allocate length, long start block index of the reserved area (inclusive) reservedLow, long end block index of the reserved area (exclusive),
special value -1 means beginning of the infinite free area reservedHigh)Allocate a number of blocks and mark them as used. |
| private int | |
| public void | |
| public void | |
| pack-priv int | |
| private int | |
| private int | |
| pack-priv int | |
| pack-priv long | |
| pack-priv long | |
| pack-priv int | Returns: priority, bigger number indicate that chunk need to be moved soonerwhere chunk starts block)Calculates relative "priority" for chunk to be moved. |
| private long | |
| pack-priv boolean | |
| public boolean | Returns: true if a block is freethe position in bytes pos, int the number of bytes length)Check whether one of the blocks is free. |
| public boolean | Returns: true if a block is in usethe position in bytes pos, int the number of bytes length)Check whether one of the blocks is in use. |
| public void | |
| pack-priv long | Returns: the starting block indexthe number of blocks to allocate blocks, long start block index of the reserved area (inclusive) reservedLow, long end block index of the reserved area (exclusive),
special value -1 means beginning of the infinite free area reservedHigh)Calculate starting position of the prospective allocation. |
| public String |
| blockSize | back to summary |
|---|---|
| private final int blockSize The block size in bytes. | |
| DETAILED_INFO | back to summary |
|---|---|
| private static final boolean DETAILED_INFO | |
| failureFlags | back to summary |
|---|---|
| private int failureFlags Left-shifting register, which holds outcomes of recent allocations. Only allocations done in "reuseSpace" mode are recorded here. For example, rightmost bit set to 1 means that last allocation failed to find a hole big enough, and next bit set to 0 means that previous allocation request have found one. | |
| firstFreeBlock | back to summary |
|---|---|
| private final int firstFreeBlock The first usable block. | |
| set | back to summary |
|---|---|
| private final BitSet set The bit set. | |
| FreeSpaceBitSet | back to summary |
|---|---|
| public FreeSpaceBitSet(int firstFreeBlock, int blockSize) Create a new free space map.
| |
| allocate | back to summary |
|---|---|
| public long allocate(int length) Allocate a number of blocks and mark them as used.
| |
| allocate | back to summary |
|---|---|
| pack-priv long allocate(int length, long reservedLow, long reservedHigh) Allocate a number of blocks and mark them as used.
| |
| allocate | back to summary |
|---|---|
| private int allocate(int blocks, int reservedLow, int reservedHigh, boolean allocate) | |
| clear | back to summary |
|---|---|
| public void clear() Reset the list. | |
| free | back to summary |
|---|---|
| public void free(long pos, int length) Mark the space as free.
| |
| getAfterLastBlock | back to summary |
|---|---|
| pack-priv int getAfterLastBlock() Get the index of the first block after last occupied one. It marks the beginning of the last (infinite) free space.
| |
| getBlock | back to summary |
|---|---|
| private int getBlock(long pos) | |
| getBlockCount | back to summary |
|---|---|
| private int getBlockCount(int length) | |
| getFillRate | back to summary |
|---|---|
| pack-priv int getFillRate() Get the fill rate of the space in percent. The value 0 means the space is completely free, and 100 means it is completely full.
| |
| getFirstFree | back to summary |
|---|---|
| pack-priv long getFirstFree() Get the position of the first free space.
| |
| getLastFree | back to summary |
|---|---|
| pack-priv long getLastFree() Get the position of the last (infinite) free space.
| |
| getMovePriority | back to summary |
|---|---|
| pack-priv int getMovePriority(int block) Calculates relative "priority" for chunk to be moved.
| |
| getPos | back to summary |
|---|---|
| private long getPos(int block) | |
| isFragmented | back to summary |
|---|---|
| pack-priv boolean isFragmented() | |
| isFree | back to summary |
|---|---|
| public boolean isFree(long pos, int length) Check whether one of the blocks is free.
| |
| isUsed | back to summary |
|---|---|
| public boolean isUsed(long pos, int length) Check whether one of the blocks is in use.
| |
| markUsed | back to summary |
|---|---|
| public void markUsed(long pos, int length) Mark the space as in use.
| |
| predictAllocation | back to summary |
|---|---|
| pack-priv long predictAllocation(int blocks, long reservedLow, long reservedHigh) Calculate starting position of the prospective allocation.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |