用 java 代码模拟操作系统页面置换算法中的 FIFO LRU .
/*
* Created on 2004-12-25
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
/**
* @Michelangelo
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
import java.util.*;
public class TestReplacement {
/**
*
*/
private final int ArraySize=20;
private int digitalArray[]=new int [ArraySize];
//private int digitalArray[]={1,2,3,4,2,1,5,6,2,1,2,3,7,6,3,2,1,2,3,6};
private static final int frameSize[]={1,2,3,4,5,6,7};
private static int errorCount=0;
Vector frame=new Vector();
public TestReplacement() {
super();
// TODO Auto-generated constructor stub
}
public static void main(String[] args) {
TestReplacement aT=new TestReplacement();
aT.generateRandomDigit();
aT.output();
System.out.println("-------------Using FIFO--------------");
System.out.println();
for(int i=0;i<frameSize.length;i++){