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.
-
labels
-
-
RelationSchema()
- This is for View and Clone functions.
-
RelationSchema(DataInputStream)
-
-
RelationSchema(ResultSet)
- Here we generate each name as "R_A".
-
RelationSchema(ResultSet, Relation, String)
- Should erase SWEEPSIGN field from the Schema.
-
RelationSchema(ResultSet, String)
- Should erase SWEEPSIGN field from the Schema.
-
RelationSchema(String[])
-
-
addCol(String)
-
-
changeAttrName(String, int)
- Change specific Attribute Name in this schema.
-
clone()
-
-
createSQL()
- this function will return SQL, for create table.
-
createSQL(String)
- this function will return SQL, for create table.
-
doProject(int[])
- This function will decrease the Schema based on the flags.
-
equals(RelationSchema)
- Check if two Schemas are quivaluent.
-
find(String)
- Check if such column name stored in such schema.
-
getAttrName(int)
- Get one specific Attribute 's name.
-
getColName(int)
- Return column Name of specific Column Number.
-
getCommon(RelationSchema)
- get the only one common Attribute of two schemas
-
getFlags(RelationSchema)
- Return a set of flags to show which column is projected.
-
getFlags(String)
- This will return flags for projection.
-
getIndex(String)
- Get Index of one labels in the schema.
-
getSQL()
- Get SQL from this Schema List.
-
isSubsetOf(RelationSchema)
- Check is current Schema is a subset of other Schema.
-
size()
- this function return the Number of labels in the schema
-
toString()
- Convert to String.
-
whereIs(String)
- Find where is such column name stored in this schema.
-
write(DataOutputStream)
- write the schema to the file
labels
Vector labels
RelationSchema
public RelationSchema()
- This is for View and Clone functions.
RelationSchema
public RelationSchema(String newSchema[])
RelationSchema
public RelationSchema(DataInputStream din)
RelationSchema
public RelationSchema(ResultSet rs) throws Exception
- Here we generate each name as "R_A".
RelationSchema
public RelationSchema(ResultSet rs,
String sign) throws Exception
- Should erase SWEEPSIGN field from the Schema.
RelationSchema
public RelationSchema(ResultSet rs,
Relation rel,
String sign) throws Exception
- Should erase SWEEPSIGN field from the Schema.
clone
public Object clone()
- Parameters:
- r - is the new cloned relation.
- Overrides:
- clone in class Object
addCol
private void addCol(String colName)
size
public int size()
- this function return the Number of labels in the schema
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).
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.
getCommon
public String getCommon(RelationSchema theSchema)
- get the only one common Attribute of two schemas
write
public void write(DataOutputStream dout)
- write the schema to the file
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"
toString
public String toString()
- Convert to String.
- Overrides:
- toString in class Object
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'.
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.
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".
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".
find
private boolean find(String colName)
- Check if such column name stored in such schema.
This is a linear searching.
whereIs
private int whereIs(String colName) throws NotFoundException
- Find where is such column name stored in this schema.
This is a linear searching.
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.
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".
equals
public boolean equals(RelationSchema rs) throws Exception
- Check if two Schemas are quivaluent.
changeAttrName
public void changeAttrName(String newName,
int index)
- Change specific Attribute Name in this schema.
getAttrName
public String getAttrName(int index)
- Get one specific Attribute 's name.
All Packages Class Hierarchy This Package Previous Next Index