Speicher
Class MemoryArea

java.lang.Object
  |
  +--Speicher.MemoryArea

public class MemoryArea
extends java.lang.Object

This class simulates a memory area in the memory structure and provides methods to handle the memory area.


Field Summary
private  java.awt.Color color
          Color of this memory area for drawing.
static int INIT_PROCESSNR
          Initial value for the processNr of a new memory area.
static int INIT_SIZE
          Initial value for the size of a new memory area.
static int INIT_STARTPOS
          Initial value for the starting position of a new memory area.
private  int processNumber
          Number of the process to which this memory area belongs.
private  int size
          Size of this memory area in MB.
private  int startPos
          Starting position of the area where it is located.
private  int usedSize
          Really Used size of this memory area in MB.
 
Constructor Summary
MemoryArea()
          Creates a new memory area with initial values.
MemoryArea(java.awt.Color col)
          Creates a new memory area with initial values.
MemoryArea(int newStartPos, int newSize)
          Creates a new memory area with given values.
MemoryArea(int newStartPos, int newSize, java.awt.Color col)
          Creates a new memory area with given values.
 
Method Summary
 MemoryArea deepCopy()
          Returns a deep copy of the memory area, all elements are new created.
 java.awt.Color getColor()
          Returns the drawing color of this memory area.
 int getProcessNumber()
          Returns the process number to which this memory area belongs.
 int getSize()
          Returns the size of this memory area.
 int getStartPos()
          Returns the startting position of this memory area.
 int getUsedSize()
          Returns the usedSize of this memory area.
 boolean isInitial()
          Returns true, if values of this memory area are initial.
 void setColor(java.awt.Color col)
          Sets the drawing color of this memory area.
 void setProcessNumber(int newProcessNumber)
          Sets the process number to which this memory area belongs to.
 void setSize(int newSizeKB)
          Sets the size of this memory area.
 void setStartPos(int newStartPosKB)
          Sets the staringPos of this memory area in MB.
 void setUsedSize(int newSizeKB)
          Sets the usedSize of this memory area.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

startPos

private int startPos
Starting position of the area where it is located.

size

private int size
Size of this memory area in MB.

usedSize

private int usedSize
Really Used size of this memory area in MB. Different from the allocated e.g. in Buddy-System. (Internal Fragmentation)

color

private java.awt.Color color
Color of this memory area for drawing. When allocating or releasing a memory area, the color of the others should stay the same! Therefore it's necessary to store the color in each memory are for easy handling.

processNumber

private int processNumber
Number of the process to which this memory area belongs.

INIT_STARTPOS

public static final int INIT_STARTPOS
Initial value for the starting position of a new memory area.

INIT_SIZE

public static final int INIT_SIZE
Initial value for the size of a new memory area.

INIT_PROCESSNR

public static final int INIT_PROCESSNR
Initial value for the processNr of a new memory area.
Constructor Detail

MemoryArea

public MemoryArea()
Creates a new memory area with initial values.

MemoryArea

public MemoryArea(java.awt.Color col)
Creates a new memory area with initial values.

MemoryArea

public MemoryArea(int newStartPos,
                  int newSize)
Creates a new memory area with given values.

MemoryArea

public MemoryArea(int newStartPos,
                  int newSize,
                  java.awt.Color col)
Creates a new memory area with given values.
Method Detail

getStartPos

public int getStartPos()
Returns the startting position of this memory area.

getSize

public int getSize()
Returns the size of this memory area.

getUsedSize

public int getUsedSize()
Returns the usedSize of this memory area.

deepCopy

public MemoryArea deepCopy()
Returns a deep copy of the memory area, all elements are new created.

getProcessNumber

public int getProcessNumber()
Returns the process number to which this memory area belongs.

getColor

public java.awt.Color getColor()
Returns the drawing color of this memory area.

isInitial

public boolean isInitial()
Returns true, if values of this memory area are initial.

setStartPos

public void setStartPos(int newStartPosKB)
Sets the staringPos of this memory area in MB.

setColor

public void setColor(java.awt.Color col)
Sets the drawing color of this memory area.

setProcessNumber

public void setProcessNumber(int newProcessNumber)
Sets the process number to which this memory area belongs to.

setSize

public void setSize(int newSizeKB)
Sets the size of this memory area.

setUsedSize

public void setUsedSize(int newSizeKB)
Sets the usedSize of this memory area.