import java.io.*; import java.util.*; // This class support the creation of database relations, several // relational algebra operators and basic data manipulation operators. public class Relation implements Serializable { // F I E L D S // Name of the relation. private String relName=null; // Attribute names for the relation private Vector attributes=null; // Domain classes (types of attributes) private Vector domains=null; // Actual data storage (list of tuples) for the relation. private Vector table=null; // Counter to facilitate creating uniques names. private int counter=0; // Map associating relation names with relation memory images. private static Map catalogMap; // Static block to load the system catalog and all relations listed // in the catalog. static { catalogMap=new HashMap(); FileInputStream fin,fin2 = null; BufferedReader infile,infile2 = null; try { fin = new FileInputStream("catalog.dat"); infile = new BufferedReader(new InputStreamReader(fin)); int numRelations=0; String s = infile.readLine(); try { numRelations = Integer.parseInt(s); } catch (NumberFormatException e) { System.out.println("Invalid number"); } for (int i=0; i