All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class SWEEP.RelationSchema

java.lang.Object
   |
   +----SWEEP.RelationSchema

public class RelationSchema
extends Object
implements Serializable, Cloneable
Schema will be empty.


Variable Index

 o labels

Constructor Index

 o RelationSchema()
This is for View and Clone functions.
 o RelationSchema(DataInputStream)
 o RelationSchema(ResultSet)
Here we generate each name as "R_A".
 o RelationSchema(ResultSet, Relation, String)
Should erase SWEEPSIGN field from the Schema.
 o RelationSchema(ResultSet, String)
Should erase SWEEPSIGN field from the Schema.
 o RelationSchema(String[])

Method Index

 o addCol(String)
 o changeAttrName(String, int)
Change specific Attribute Name in this schema.
 o clone()
 o createSQL()
this function will return SQL, for create table.
 o createSQL(String)
this function will return SQL, for create table.
 o doProject(int[])
This function will decrease the Schema based on the flags.
 o equals(RelationSchema)
Check if two Schemas are quivaluent.
 o find(String)
Check if such column name stored in such schema.
 o getAttrName(int)
Get one specific Attribute 's name.
 o getColName(int)
Return column Name of specific Column Number.
 o getCommon(RelationSchema)
get the only one common Attribute of two schemas
 o getFlags(RelationSchema)
Return a set of flags to show which column is projected.
 o getFlags(String)
This will return flags for projection.
 o getIndex(String)
Get Index of one labels in the schema.
 o getSQL()
Get SQL from this Schema List.
 o isSubsetOf(RelationSchema)
Check is current Schema is a subset of other Schema.
 o size()
this function return the Number of labels in the schema
 o toString()
Convert to String.
 o whereIs(String)
Find where is such column name stored in this schema.
 o write(DataOutputStream)
write the schema to the file

Variables

 o labels
 Vector labels

Constructors

 o RelationSchema
 public RelationSchema()
This is for View and Clone functions.

 o RelationSchema
 public RelationSchema(String newSchema[])
 o RelationSchema
 public RelationSchema(DataInputStream din)
 o RelationSchema
 public RelationSchema(ResultSet rs) throws Exception
Here we generate each name as "R_A".

 o RelationSchema
 public RelationSchema(ResultSet rs,
                       String sign) throws Exception
Should erase SWEEPSIGN field from the Schema.

 o RelationSchema
 public RelationSchema(ResultSet rs,
                       Relation rel,
                       String sign) throws Exception
Should erase SWEEPSIGN field from the Schema.

Methods

 o clone
 public Object clone()
Parameters:
r - is the new cloned relation.
Overrides:
clone in class Object
 o addCol
 private void addCol(String colName)
 o size
 public int size()
this function return the Number of labels in the schema

 o createSQL
 public String createSQL()
this function will return SQL, for create table. because I cannot get the type from the ResultSet, so, here, I just assume everything is char(250).

 o createSQL
 public String createSQL(String sign)
this function will return SQL, for create table. because I cannot get the type from the ResultSet, so, here, I just assume everything is char(250). It will add a SWEEPSIGN field.

 o getCommon
 public String getCommon(RelationSchema theSchema)
get the only one common Attribute of two schemas

 o write
 public void write(DataOutputStream dout)
write the schema to the file

 o getSQL
 public String getSQL()
Get SQL from this Schema List. For View Definition E.g. CREATE VIEW V (PRICE, RETIME) ..., it will returns "PRICE, RETIME"

 o toString
 public String toString()
Convert to String.

Overrides:
toString in class Object
 o getColName
 public String getColName(int index)
Return column Name of specific Column Number. E.g. a relation schema is: 'col1', 'col2', 'col3'. if input index is 0, return 'col1'; 1, return 'col2'; 2, return 'col3'.

 o getIndex
 int getIndex(String colName)
Get Index of one labels in the schema. the Index start from 1.

Parameters:
colname - name of label.
Returns:
index of the Label; 0 means not found.
 o getFlags
 public int[] getFlags(RelationSchema schema)
Return a set of flags to show which column is projected. E.g. the relation shema is 'col1', 'col2', 'col3'. projected schema is "col3, col2", then the flags are "0,2,1".

 o getFlags
 public int[] getFlags(String colName)
This will return flags for projection. The flag of the specific colName will be set to zero. At later doProject() it will be deleted from the Relation. E.g. we have schema "col1, col2, col3", we want to delete "col3", the flags are "1,1,0".

 o find
 private boolean find(String colName)
Check if such column name stored in such schema. This is a linear searching.

 o whereIs
 private int whereIs(String colName) throws NotFoundException
Find where is such column name stored in this schema. This is a linear searching.

 o isSubsetOf
 public boolean isSubsetOf(RelationSchema theSchema)
Check is current Schema is a subset of other Schema. It is used for the Projection operation of Relation class.

 o doProject
 public void doProject(int flags[]) throws Exception
This function will decrease the Schema based on the flags. E.g. if the original schema is "col1, col2, col3", flags is "2, 0, 1", then the new schema is "col3, col1".

 o equals
 public boolean equals(RelationSchema rs) throws Exception
Check if two Schemas are quivaluent.

 o changeAttrName
 public void changeAttrName(String newName,
                            int index)
Change specific Attribute Name in this schema.

 o getAttrName
 public String getAttrName(int index)
Get one specific Attribute 's name.


All Packages  Class Hierarchy  This Package  Previous  Next  Index