TSequence - The type of the specified sequence.public class StackAlloc32<TSequence extends IContainer32<java.lang.Integer> & IBackSequence<java.lang.Integer>> extends java.lang.Object implements IAllocator32
The container is allocated in memory and can generate at most TSequence.MaxSize() addresses.
| Constructor and Description |
|---|
StackAlloc32(TSequence sequence)
Creates a new instance of StackAlloc32 with the specified sequence.
|
StackAlloc32(TSequence sequence,
int highestAddress)
Creates a new instance of StackAlloc32 with the specified sequence and
highest address.
|
| Modifier and Type | Method and Description |
|---|---|
int |
Allocate()
Returns the next available location (address).
|
boolean |
CanAllocate()
Returns true if the allocator's Size is less than its MaxSize.
|
void |
Clear()
Frees all locations (addresses).
|
int |
Count()
Returns the number of addresses already allocated.
|
void |
Deallocate(int address)
Frees a location (address) that was allocated with
Allocate(). |
int |
MaxSize()
Returns the allocator's maximum possible size (the highest address).
|
int |
Size()
Returns the number of addresses (highest address).
|
public StackAlloc32(TSequence sequence)
sequence - The specified sequence.public StackAlloc32(TSequence sequence, int highestAddress)
sequence - The specified sequence.highestAddress - The specified highest address.public int Size()
public int MaxSize()
public int Count()
public boolean CanAllocate()
public int Allocate()
Allocate in interface IAllocator32public void Deallocate(int address)
Allocate().
It is an error to deallocate an address that was already released because it will be pushed into the sequence multiple times.
Deallocate in interface IAllocator32address - The address to be released.java.lang.RuntimeException - When the specified address is out of the
[0, Size - 1] range.public void Clear()
Copyright© 2012 Progeneric Systems, Inc. All Rights Reserved.