|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.util.AbstractCollection
|
+--java.util.AbstractList
|
+--java.util.Vector
|
+--Speicher.Memory
This class simulates the memory structure and provides methods to handle the memory areas in this memory structure. The number of areas isn't fix and can be changed at runtime. To set up the maximum memory size (512 MB) the constants for the memory size have to be added and the number of memory vectors has to be increased.
| Field Summary | |
private static java.awt.Color[] |
AREAFILLEDCOLOR
Colors to fill the memory areas different. |
private static int |
CYAN
Index of this color for handling the use of colors. |
private static int |
GREEN
Index of this color for handling the use of colors. |
private java.lang.String |
lastMethod
Last used allocation method. |
private java.lang.String |
lastRequestString
Last request as a String for drawing the development of the memory history. |
private int |
lastRequestType
Type of the last request. |
private static int |
MAGENTA
Index of this color for handling the use of colors. |
private int |
memorySize
Actual size of Memory as an int-value. |
private Memory[] |
memorySizeVector
Vectors for the memory management in the allocation method "buddy system". |
private static int |
ORANGE
Index of this color for handling the use of colors. |
private static int |
PINK
Index of this color for handling the use of colors. |
private static int |
RED
Index of this color for handling the use of colors. |
static int |
SIZE_128_MB
Memory size 128 MB to calculate for drawing. |
static int |
SIZE_256_MB
Memory size 256 MB to calculate for drawing. |
static int |
SIZE_32_MB
Memory size 32 MB to calculate for drawing. |
static int |
SIZE_512_MB
Memory size 512 MB to calculate for drawing. |
static int |
SIZE_64_MB
Memory size 64 MB to calculate for drawing. |
private int[] |
usedColors
Counters for each use of a color in a memory area. |
private static int |
WHITE
Index of this color for handling the use of colors. |
private static int |
YELLOW
Index of this color for handling the use of colors. |
| Fields inherited from class java.util.Vector |
capacityIncrement, elementCount, elementData, serialVersionUID |
| Fields inherited from class java.util.AbstractList |
modCount |
| Constructor Summary | |
Memory()
Create a new instance of this Memory. |
|
Memory(int newMemoryAreaCount,
int newMemorySize)
Create a new instance of Memory with given number of memory areas and the given memorySize. |
|
| Method Summary | |
void |
appendMemoryArea(MemoryArea newMemoryArea)
Appends a new memory area into the memory structure |
void |
appendMemoryAreas(int deltaMemoryAreaCount)
Appends the given number of initial memory areas to the memory. |
static Memory |
buildFreeMemory(Memory usedMemory)
Builds a memory structure containing the free memory areas depending on the given usedMemory. |
Memory |
createRandomMemory()
Create a new instance of Memory with random values. |
void |
decColorUse(java.awt.Color color)
Decreases the use of the given Color by one. |
Memory |
deepCopy()
Creates a deep copy of memory. |
private boolean |
fitInMemory(Memory memory,
MemoryArea newMA)
Checks, if the given memory area does fit in this memory. |
int |
getIndexOfMemoryArea(MemoryArea memoryArea)
Returns the index of the given memory area. |
java.lang.String |
getLastMethod()
Returns the text of the last used allocation method. |
java.lang.String |
getLastRequestString()
Returns the text of the last request. |
int |
getLastRequestType()
Returns the type of the last request. |
MemoryArea |
getMemoryArea(int index)
Returns the memory area at a special index. |
int |
getMemoryAreaCount()
Returns the number of memory areas in this memory. |
int |
getMemoryAreaFilledCount()
Returns the number of not initial memory areas in this memory. |
MemoryArea |
getMemoryAreaPos(int memoryPos)
Returns the memory area that contains the given memory position or if none exists, return the first free memory area. |
MemoryArea |
getMemoryAreaProcess(int processNr)
Returns the memory area with the given process number. |
MemoryArea |
getMemoryAreaStart(int startPos)
Returns the memory area with a special starting position. |
int |
getMemoryAreaTotalUsedSize()
Returns the total size of all not initial memory areas. |
int |
getMemoryAreaTotaSize()
Returns the total size of all not initial memory areas. |
int |
getMemorySize()
Returns the size of this memory. |
Memory |
getMemorySizeVector(int index)
Returns the memory in the memorySizeVector with the given index. |
int |
getMemorySizeVectorLength()
Returns the length of memorySizeVector. |
int |
getMinIndexColor()
Returns the index of the color with the lowest use. |
java.awt.Color |
getNextColor()
Returns a color that is not to often used in this memory. |
void |
insertMemoryArea(MemoryArea newMemoryArea)
Inserts a new memory area into the memory structure regarding the sort starting position |
boolean |
isInitial()
Returns true, if the memory has only initial memory areas. |
boolean |
isInMemory(int startingPos)
Returns true, if a memory area with the given starting position is in memory. |
boolean |
isInMemoryProcess(int processNr)
Returns true, if a memory area with the given processNumber is in memory. |
void |
mergeFreeMemoryArea(MemoryArea memoryArea)
Merges the given memory are with any other existing or adds it to the list. |
void |
printMemory()
|
void |
printMemoryBuddy()
|
void |
removeAllMemoryAreas()
Removes all memory areas from memory. |
void |
removeMemoryArea(int startPos)
Removes memory area from memory woth the given starting position. |
void |
removeMemoryAreaProcess(int processNr)
Removes memory area from memory with the given process number. |
void |
resetColorUse()
Reset the use of olors. |
void |
setLastMethod(java.lang.String newLastMethod)
Sets the last used allocation method. |
void |
setLastRequest(int newLastRequestType,
java.lang.String newLastRequest)
Sets the last request to this memory. |
void |
setMemorySize(int newMemorySize)
Sets the size of this memory. |
void |
setMemorySizeVector(Memory newMemory,
int index)
Sets the given memory in the memorySizeVector at the given index. |
void |
sortAscProcess()
Sorts the memory allocations ascending by the processNr. |
void |
sortAscSize()
Sorts the memory allocations ascending by the size. |
void |
sortAscStart()
Sorts the memory allocations ascending by the starting position. |
void |
sortDescSize()
Sorts the memory allocations descending by the size. |
| Methods inherited from class java.util.Vector |
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, ensureCapacityHelper, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize |
| Methods inherited from class java.util.AbstractList |
iterator, listIterator, listIterator |
| Methods inherited from class java.lang.Object |
|
| Methods inherited from interface java.util.List |
iterator, listIterator, listIterator |
| Field Detail |
private static final java.awt.Color[] AREAFILLEDCOLOR
private static final int WHITE
private static final int GREEN
private static final int RED
private static final int ORANGE
private static final int MAGENTA
private static final int CYAN
private static final int PINK
private static final int YELLOW
private int[] usedColors
public static final int SIZE_32_MB
public static final int SIZE_64_MB
public static final int SIZE_128_MB
public static final int SIZE_256_MB
public static final int SIZE_512_MB
private java.lang.String lastMethod
private int lastRequestType
private java.lang.String lastRequestString
private int memorySize
private Memory[] memorySizeVector
| Constructor Detail |
public Memory()
public Memory(int newMemoryAreaCount,
int newMemorySize)
| Method Detail |
public void printMemory()
public void printMemoryBuddy()
public int getMinIndexColor()
public Memory deepCopy()
public void decColorUse(java.awt.Color color)
public void resetColorUse()
public java.awt.Color getNextColor()
public Memory createRandomMemory()
public static Memory buildFreeMemory(Memory usedMemory)
public void mergeFreeMemoryArea(MemoryArea memoryArea)
public void appendMemoryArea(MemoryArea newMemoryArea)
public void insertMemoryArea(MemoryArea newMemoryArea)
public boolean isInitial()
public boolean isInMemoryProcess(int processNr)
public boolean isInMemory(int startingPos)
public void appendMemoryAreas(int deltaMemoryAreaCount)
public void removeAllMemoryAreas()
public void removeMemoryAreaProcess(int processNr)
public void removeMemoryArea(int startPos)
private boolean fitInMemory(Memory memory,
MemoryArea newMA)
public int getLastRequestType()
public java.lang.String getLastRequestString()
public java.lang.String getLastMethod()
public Memory getMemorySizeVector(int index)
public int getMemorySizeVectorLength()
public void setMemorySizeVector(Memory newMemory,
int index)
public MemoryArea getMemoryArea(int index)
public int getIndexOfMemoryArea(MemoryArea memoryArea)
public int getMemoryAreaTotalUsedSize()
public int getMemoryAreaTotaSize()
public MemoryArea getMemoryAreaProcess(int processNr)
public MemoryArea getMemoryAreaStart(int startPos)
public MemoryArea getMemoryAreaPos(int memoryPos)
public int getMemoryAreaCount()
public int getMemoryAreaFilledCount()
public int getMemorySize()
public void setMemorySize(int newMemorySize)
public void setLastRequest(int newLastRequestType,
java.lang.String newLastRequest)
public void setLastMethod(java.lang.String newLastMethod)
public void sortDescSize()
public void sortAscSize()
public void sortAscProcess()
public void sortAscStart()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||