/**
 * This class implement the pure LRU algorithm
 * get the info from the aux buffer and main buffer
 * responsible to determine which file should be deleted in the aux buffer and main buffer
 */
package project;
import java.util.*;

public class PureLRU implements Replacement {

    public PureLRU () {}

    public void doAlgorithm (MainBuffer main, AuxiliaryBuffer aux, long fileSize, String fileName) {
	try
	{
            while(main.avaliableSize() < fileSize){
                String delFileName = aux.getLRUfile(fileName);
                main.removeRecord(delFileName);
                aux.removeRecord(delFileName);
		        System.out.println(delFileName+" is removed");
            }
	}
	catch(NoSuchFieldException e) {
            e.printStackTrace();
	}
    }
}
