Methoden
Class BestFit
java.lang.Object
|
+--Methoden.AllocationMethod
|
+--Methoden.BestFit
- public class BestFit
- extends AllocationMethod
Implementation of the allocation method worst-fit.
The selected memory area for allocation has the minimum rest size of
the resulting free memory area.
The free memory areas are sorted descending by size.
|
Field Summary |
static java.lang.String |
LONGNAME
Short name of this allocation method |
static java.lang.String |
SHORTNAME
Long name of this allocation method |
|
Constructor Summary |
BestFit()
First-Fit is an implementation of the allocatio method class
and searches for the next avalable free memory area starting each time
at the beginning of memory. |
| Methods inherited from class Methoden.AllocationMethod |
appendMemoryArea, createRandomUsedMemory, createUsedMemory, getFreeAreasCount, getIntFrag, getLongName, getShortName, getUsage, isUseFullFreeMemoryArea, mergeMemoryArea, removeMemoryArea, removeMemoryAreaProcess |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
SHORTNAME
public static final java.lang.String SHORTNAME
- Long name of this allocation method
LONGNAME
public static final java.lang.String LONGNAME
- Short name of this allocation method
BestFit
public BestFit()
- First-Fit is an implementation of the allocatio method class
and searches for the next avalable free memory area starting each time
at the beginning of memory.
sortFreeMemory
public void sortFreeMemory(Memory memory)
- Sorts the free memory descending by the size of each of each memory area.
- Overrides:
sortFreeMemory in class AllocationMethod
sortUsedMemory
public void sortUsedMemory(Memory memory)
- Sorts the used memory ascending by the starting position
of each memory area.
- Overrides:
sortUsedMemory in class AllocationMethod
buildFreeMemory
public Memory buildFreeMemory(Memory usedMemory)
- Build up a free memory according to the given used memory.
- Overrides:
buildFreeMemory in class AllocationMethod
getFreeArea
public MemoryArea getFreeArea(Memory freeMemory,
int reqSize)
- Returns the free memory area where the requestedSize fits optimal.
That means, that the resulting free memory area is minimal.
If none was found, return null.
- Overrides:
getFreeArea in class AllocationMethod