
/**
 * LoadVisitor.java
 *
 *
 * Created: Fri Oct 25 22:41:20 2002
 *
 * @author <a href="mailto:bina@cse.buffalo.edu "</a>
 * @version
 */
import java.io.*;
import javax.swing.JOptionPane;

public class LoadVisitor implements Visitor{
   public LoadVisitor (){
      
   }
   public Object operation(Object bt, Object inp) throws java.io.IOException
   {
      
   //get the database name
      String dbName =
         JOptionPane.showInputDialog 
	 ("Input database name to load from");
      try {
	 FileInputStream fin = new FileInputStream(dbName);
	 ObjectInputStream in = new ObjectInputStream(fin);
	 bt = (BTree)in.readObject();
	 in.close();
	 return bt;
      }
      catch(Exception exc){
	 System.out.println(exc);
	 return bt;
      }

   }
}// LoadVisitor

