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
Allocator
alloc
in interface Allocator
OutOfSpaceException
Allocator.alloc(int)
public void free(int pageId, int count)
Allocator
free
in interface Allocator
Allocator.free(int, int)
public void unfree(int pageId, int count)
Allocator
unfree
in interface Allocator
Allocator.unfree(int, int)
public void clear() throws UnsupportedOperationException
Allocator
clear
in interface Allocator
UnsupportedOperationException
public void setFreeRanges(Ranges freePages) throws UnsupportedOperationException
setFreeRanges
in interface Allocator
UnsupportedOperationException
public int getLimit()
public boolean isAllocated(int page)
isAllocated
in interface Allocator
public Ranges getFreeRanges()
getFreeRanges
in interface Allocator
Copyright © 2009–2016 FuseSource, Corp.. All rights reserved.