TSequence - The type of the specified sequence.public class StackAlloc64<TSequence extends IContainer64<java.lang.Long> & IBackSequence<java.lang.Long>> extends java.lang.Object implements IAllocator64
The container is allocated in memory and can generate at most TSequence.MaxSize() addresses.
| Constructor and Description |
|---|
StackAlloc64(TSequence sequence)
Creates a new instance of StackAlloc64 with the specified sequence.
|
StackAlloc64(TSequence sequence,
long highestAddress)
Creates a new instance of StackAlloc64 with the specified sequence
and highest address.
|
| Modifier and Type | Method and Description |
|---|---|
long |
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).
|
long |
Count()
Returns the number of addresses already allocated.
|
void |
Deallocate(long address)
Frees a location (address) that was allocated with
Allocate(). |
long |
MaxSize()
Returns the allocator's maximum possible size (the highest address).
|
long |
Size()
Returns the number of addresses (highest address).
|
public StackAlloc64(TSequence sequence)
sequence - The specified sequence.public StackAlloc64(TSequence sequence, long highestAddress)
sequence - The specified sequence.highestAddress - The specified highest address.public long Size()
public long MaxSize()
public long Count()
public boolean CanAllocate()
public long Allocate()
Allocate in interface IAllocator64public void Deallocate(long 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 IAllocator64address - 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.