• Home
  • Blog
  • CS 3743 UTSA Database Systems for Synonyms Functions Program

CS 3743 UTSA Database Systems for Synonyms Functions Program

0 comments

I am working on a partially completed Java program that implements probing to handle synonyms. It is maven project set up for JDK 11. I used IntelliJ for this program. This is the second part of a 2-part assignment. I’ve attached word docs containing the completed code for the necessary classes for this project. This is the following structure:

package hashdb:

   -HashFile.java

   -HashHeader.java

   -Vehicle.java

package main

   -P2Main.java

   -StudentFunctions.java

package misc:

   -MutableInteger

   -ParseException

   -ReturnCodes

I need help completing the following 7 functions, found in StudentFunctions.java:

public static int hashCreate(String fileName, HashHeader hashHeader) {
/**
* hashCreate
* This function creates a hash file containing only the HashHeader record.
* • If the file already exists, return RC_FILE_EXISTS
* • Create the binary file by opening it.
* • Write the HashHeader record to the file at RBN 0.
* • close the file.
* • return RC_OK.
*/
  
}
public static int hashOpen(String fileName, HashFile hashFile) {
/**
* hashOpen
* This function opens an existing hash file which must contain a HashHeader record
* , and sets the file member of hashFile
* It returns the HashHeader record by setting the HashHeader member in hashFile
* If it doesn't exist, return RC_FILE_NOT_FOUND.
* Read the HashHeader record from file and return it through the parameter.
* If the read fails, return RC_HEADER_NOT_FOUND.
* return RC_OK
*/
}
public static int readRec(HashFile hashFile, int rbn, Vehicle vehicle) {    
/**
* readRec(
* This function reads a record at the specified RBN in the specified file.
* Determine the RBA based on RBN and the HashHeader's recSize
* Use seek to position the file in that location.
* Read that record and return it through the vehicle parameter.
* If the location is not found, return RC_LOC_NOT_FOUND.  Otherwise, return RC_OK.
* Note: if the location is found, that does NOT imply that a vehicle
* was written to that location.  Why?
 */
   return ReturnCodes.RC_LOC_NOT_FOUND;
}
public static int writeRec(HashFile hashFile, int rbn, Vehicle vehicle) {
/**
* writeRec
* This function writes a record to the specified RBN in the specified file.
* Determine the RBA based on RBN and the HashHeader's recSize
* Use seek to position the file in that location.
* Write that record to the file.
* If the write fails, return RC_LOC_NOT_WRITTEN.
* Otherwise, return RC_OK.
*/
   return ReturnCodes.RC_LOC_NOT_WRITTEN;

public static int vehicleRead(HashFile hashFile, int rbn, Vehicle vehicle) {
/**
    * vehicleRead
    * Description in uploaded PDF file "cs3743_program_2.pdf"
    */
      
   return ReturnCodes.RC_REC_NOT_FOUND;
}
}
public static int vehicleInsert(HashFile hashFile, Vehicle vehicle) {
/**
* vehicleInsert
* Description in uploaded PDF file "cs3743_program_2.pdf"
*/    
   return ReturnCodes.RC_SYNONYM;
}
public static int vehicleUpdate(HashFile hashFile, Vehicle vehicle) {   
/**
    * vehicleUpdate
    * This function tries to find the given vehicle using its ...getVehicleId().
    * If found, it updates the contents of the vehicle in the hash file.
    * If not found, it returns RC_REC_NOT_FOUND.
    * Note that this function must understand probing.
    * NOTE: You can make your life easier with this function if you use MutableInteger and call some of your other functions to help out.
    */
}

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}