package Cases;

import java.io.*;
import java.io.File;

import neustore.base.DBIndex;//because we create a object of index.java
import neustore.base.LRUBuffer;//because we create an object of it




public class Test_AI_full {

	
	public static void main(String[] args)throws IOException {
		
		//all the pages will be stored under this file name
		String filename4="TESTFILE4";
		File file= new File(filename4);
		if(file.delete())
		{
			 System.out.println("The old file with that name has been deleted");
			 
		}
		else
		{
			System.out.println("The file was not found");
		}
		
		//'buf4' is an object of XMLBuffer class. Passes 2 arguments  5=Buffer size and 120=page size in bytes
		XMLBuffer buf4= new XMLBuffer(5,120);
		
		//Creating an object of AttributeIndex class and passing the 'buf4'(buffer) , filename and boolean value 'true' (indicating a new file has to be created with the passed filename)
		//If we do not plan to create a new file for AttributeIndex, then the Constructor of the AttributeIndex class should send 'false' to its super class
		
	
		
		//creating an object of XMLContent class to test its methods
		AttributeIndex AI=new AttributeIndex(buf4,filename4,1);
		
		
		//create the record in structure index as we did before proceeding
        //insert an record in attribute index  
         int y=AI.insertEntry(1,"x","123"); //The record size for this page would be 32+64+4 = 100, so only 1 record can be stored in one page
         System.out.println("The exit code for inserting an entry of an attribute 'x' is "+y);
         
        //insert another record
          y=AI.insertEntry(2,"top","2");//would go into the second page
          
          y=AI.insertEntry(2,"class","123");//would go into the third page

          y=AI.deleteEntry(2,"top"); //would delete the "top" attribute entry for nodeis=2 record and the second page becomes empty
       
       
       
       //AI.close();//remove the comments if the file needs to be closed before exiting
}//end of main() class
}//end of test_AI_full