public class SimpleAllocator extends Object implements Allocator
| Constructor and Description |
|---|
SimpleAllocator(int limit) |
| Modifier and Type | Method and Description |
|---|---|
int |
alloc(int size)
Allocates a continuous number of items and returns the position of first item in the sequence.
|
void |
clear()
Frees all previous allocations.
|
void |
free(int pageId,
int count)
Frees a given number of items at a given position.
|
Ranges |
getFreeRanges() |
int |
getLimit() |
boolean |
isAllocated(int page) |
void |
setFreeRanges(Ranges freePages) |
String |
toString() |
void |
unfree(int pageId,
int count)
Undoes a previous free method call.
|
public int alloc(int size)
throws OutOfSpaceException
Allocatoralloc in interface AllocatorOutOfSpaceExceptionAllocator.alloc(int)public void free(int pageId,
int count)
Allocatorfree in interface AllocatorAllocator.free(int, int)public void unfree(int pageId,
int count)
Allocatorunfree in interface AllocatorAllocator.unfree(int, int)public void clear()
throws UnsupportedOperationException
Allocatorclear in interface AllocatorUnsupportedOperationExceptionpublic void setFreeRanges(Ranges freePages) throws UnsupportedOperationException
setFreeRanges in interface AllocatorUnsupportedOperationExceptionpublic int getLimit()
public boolean isAllocated(int page)
isAllocated in interface Allocatorpublic Ranges getFreeRanges()
getFreeRanges in interface AllocatorCopyright © 2009–2015 FuseSource, Corp.. All rights reserved.