public int getMemoryLimit() { return this.MemoryLimit; }
public boolean equals(ProcessPCB pcb) {
if(pcb.getPID() == this.getPID()) { return true; }
else return false; }
public String toString() { return this.getPID() + \ +
this.getRequiredTime() + \ + this.getPriority() + \
+ this.getStatus() + \ +
this.getMemoryBase() + \ + this.getMemoryLimit() + \; }
public void run() {
if(this.RequiredTime!=0){
this.RequiredTime = this.RequiredTime-1; this.Priority = this.Priority-1;} } }
//这是进程存放和添加迭代器的类 package Final;
import java.util.ArrayList; import java.util.Iterator; public
class
PCBRecords
implements
Iterable
private ArrayList
public ArrayList
public PCBRecords() {
this.PCBItems = new ArrayList
public void addItem(ProcessPCB PcbItem) { this.PCBItems.add(PcbItem); }
public void removeItem(ProcessPCB PCbItem) { this.PCBItems.remove(PCbItem); }
public ProcessPCB getItem(ProcessPCB processPCB) {
for (ProcessPCB pCbItem : this.PCBItems) {
if (pCbItem.equals(processPCB)) { return pCbItem; }
} return null; }
public ProcessPCB getItem(String pid) { for (ProcessPCB pcBItem : this.PCBItems) {
if (pcBItem.getPID().equals(pid)) { return pcBItem; }
} return null; }
public int getNumberOfItems() { return this.PCBItems.size(); }
public String[] getItemsProperties() { String
itemsProperties[]
=
new
String[getNumberOfItems()];
int i = 0;
for(Iterator iterator1 = PCBItems.iterator(); iterator1.hasNext();) {
ProcessPCB
stu_Item =
(ProcessPCB)iterator1.next(); itemsProperties[i++] stu_Item.toString(); }
return itemsProperties; }
public Iterator
//这是内存管理类 package Final;
public class MemoryItem { private int memoryBase=0; private int memoryLimit=0; private int availableStatus=0;
public MemoryItem(int initMemoryBase, int initMemoryLimit) {
this.memoryBase = initMemoryBase;
=