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 TestCase4 { 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 2048=page size in bytes XMLBuffer buf4= new XMLBuffer(5,2048); //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"); System.out.println("The exit code for inserting an entry of an attribute 'x' is "+y); //insert another record y=AI.insertEntry(1,"top","2"); //The following code will try to get the attribute value of 'x' attribute for element occurence having nodeID=1 String av=AI.getValue(1,"x"); System.out.println("The attribute value for 'x' attribute is "+av); //delete the attribute "x" for nodeid=1 y=AI.deleteEntry(1,"x"); av=AI.getValue(1,"x"); System.out.println("The attribute value for 'x' attribute is "+av);//this sould not return anything as we delted this attribute. //AI.close();//remove the comments if the file needs to be closed before exiting }//end of main() method }//end of TestCase4