//-----------------------------
//--
//-- Test class for the clock buffer manager class
//--
//------------------------------
//
// Alexander Dekhtyar
//
//-----------------------------

// Note: the test below is problem 4.2 from the CS 505 midterm
// The first sequence of commands sets up the initial state of the buffer
// The second sequence of commands follows the commands in the problem
//
//


public class clockTest01 {

	public static void main(String[] args) {

		ClockBuffer buffer = new ClockBuffer(4);
		
//---------------------------------------------------------------
		
		buffer.read("T1",1);
		buffer.read("R1",2);
		buffer.read("P2",1);
                buffer.pinSlot("P2");
                buffer.read("P3",1);
		buffer.read("T2",1);
                buffer.read("T1",1);
                buffer.read("R4",2);
		System.out.println("------------- CHECKPOINT ----------------");
		buffer.print();
		
		buffer.write("R4");
		buffer.unpinSlot("P2");
		buffer.write("P2");
		buffer.read("T3",1);
		buffer.pinSlot("T3");
		buffer.write("R3");
		buffer.read("R1",2);
		buffer.read("R5",2);
		System.out.println("------------- CHECKPOINT ----------------");
		buffer.print();
		

                buffer.unpinSlot("T3");
                buffer.write("T3");
                buffer.write("P1");
                buffer.read("T2",1);
                buffer.write("P2");
                buffer.pinSlot("T1");
                buffer.read("R6",2);
                buffer.read("R7",2);
                System.out.println("------------- CHECKPOINT ----------------");
                buffer.print();



	}

}