Beispiel #1
0
 /**
  * Returns the DbFile that can be used to read the contents of the specified table.
  *
  * @param tableid The id of the table, as specified by the DbFile.getId() function passed to
  *     addTable
  */
 public DbFile getDbFile(int tableid) throws NoSuchElementException {
   // some code goes here
   String fileName = fileId.get(tableid);
   if (fileName.equals(null)) throw new NoSuchElementException();
   DbFile retFile = tableFile.get(fileName);
   if (retFile.equals(null)) throw new NoSuchElementException();
   else return retFile;
 }
Beispiel #2
0
 /**
  * Returns the tuple descriptor (schema) of the specified table
  *
  * @param tableid The id of the table, as specified by the DbFile.getId() function passed to
  *     addTable
  * @throws NoSuchElementException if the table doesn't exist
  */
 public TupleDesc getTupleDesc(int tableid) throws NoSuchElementException {
   // some code goes here
   String fileName = fileId.get(tableid);
   if (fileName.equals(null)) throw new NoSuchElementException();
   DbFile retTD = tableFile.get(fileName);
   if (retTD.equals(null)) throw new NoSuchElementException();
   // System.out.println(retTD);
   else return retTD.getTupleDesc();
 }