//----------------------------- //-- //-- 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 clockTest { public static void main(String[] args) { ClockBuffer buffer = new ClockBuffer(4); buffer.read("R1",0); buffer.pinSlot("R1"); buffer.read("R2",1); buffer.read("RI1",1); buffer.read("TI",0); buffer.hand=3; buffer.print(); //--------------------------------------------------------------- buffer.read("R2",1); buffer.print(); buffer.read("R3",1); buffer.print(); buffer.read("RI2",2); buffer.print(); buffer.unpinSlot("R1"); buffer.print(); buffer.read("TI2",2); System.out.println("------------- CHECKPOINT ----------------"); buffer.print(); buffer.read("R3",1); buffer.print(); buffer.read("T1",1); buffer.print(); buffer.read("RI1",2); buffer.print(); buffer.read("TI2",2); buffer.print(); buffer.read("R1",1); System.out.println("------------- CHECKPOINT ----------------"); buffer.print(); } }