Speicher
Class Memory

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.Vector
                    |
                    +--Speicher.Memory
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class Memory
extends java.util.Vector

Memory simulates the memory structure and makes methods available to handle the pages in this memory structure. The number of pages is not fix and can change at runtime. The pages are not sorted (e.g. by the fremeNumber or pageNumber) and page has an own field where the frameNumber, pageNumber and so an are stored. The memory structure is therefore independent from the content. That means the pages can be placed at every position in this memory structure without changing anything!

See Also:
Serialized Form

Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData, serialVersionUID
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Memory(int size, int refBits, int modRefBits)
           
 
Method Summary
 void addPage(int index, Page newPage)
          Inserts the given page at the given index in memory, increasing the size of memory Higher elements are shifted to the end
 void addPage(Page newPage)
          Appends the given page in memory increasing the size of memory.
 void clearAllIndexPointer()
          Clears all indexPointers in the memory pages.
 Memory deepCopy()
          Creates a deep copy of memory.
 Page getFirstPage()
          Returns the first page in memory (index = 0).
 Page getLastPage()
          Returns the last page in memory (index = size -1).
 Page getPage(int index)
          Returns the page at the given index in memory.
 Page getPageF(int frameNr)
          Returns null or the page that is placed in the given frameNumber.
 Page getPageV(int pageNr)
          Returns null, or the page with the given page number.
 int indexOfPointer()
          Returns the index of the first Page with a set pointer.
 boolean isInMemoryAT(int accessTime)
          Returns true, if a page with the given access time is in memory.
 boolean isInMemoryPageNr(int pageNr)
          Returns true, if the given page is in memory present.
 int lastIndex()
          Returns the index of the last vector in the memory.
 Page recolorMarkedPage()
          Returns null, or the first page, that has an individual color.
 void removePage(Page removePage)
          Removes the given page from memory decreasing the size of memory.
 void setPage(int index, Page newPage)
          Sets the given page on the given index in memory and replaces the old one
 
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
, finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

Memory

public Memory(int size,
              int refBits,
              int modRefBits)
Method Detail

isInMemoryPageNr

public boolean isInMemoryPageNr(int pageNr)
Returns true, if the given page is in memory present.

isInMemoryAT

public boolean isInMemoryAT(int accessTime)
Returns true, if a page with the given access time is in memory.

recolorMarkedPage

public Page recolorMarkedPage()
Returns null, or the first page, that has an individual color.

setPage

public void setPage(int index,
                    Page newPage)
Sets the given page on the given index in memory and replaces the old one

getPageF

public Page getPageF(int frameNr)
Returns null or the page that is placed in the given frameNumber.

getFirstPage

public Page getFirstPage()
Returns the first page in memory (index = 0).

getPage

public Page getPage(int index)
Returns the page at the given index in memory.

getLastPage

public Page getLastPage()
Returns the last page in memory (index = size -1).

addPage

public void addPage(Page newPage)
Appends the given page in memory increasing the size of memory.

addPage

public void addPage(int index,
                    Page newPage)
Inserts the given page at the given index in memory, increasing the size of memory Higher elements are shifted to the end

removePage

public void removePage(Page removePage)
Removes the given page from memory decreasing the size of memory.

clearAllIndexPointer

public void clearAllIndexPointer()
Clears all indexPointers in the memory pages.

indexOfPointer

public int indexOfPointer()
Returns the index of the first Page with a set pointer.

lastIndex

public int lastIndex()
Returns the index of the last vector in the memory.

getPageV

public Page getPageV(int pageNr)
Returns null, or the page with the given page number.

deepCopy

public Memory deepCopy()
Creates a deep copy of memory. All elements are new created References to elements are solved and these elements are new created! The new Memory is independent from the old one! This function isn't implemented in standard java!