|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fesenmeyer.dbnormalizer.core.AbstractDBItem
de.fesenmeyer.dbnormalizer.core.Table
public class Table
Class representing a table. If the table is a DB-Table, i.e. if it exists in a DB or should be
created in a DB (if it is part of a normalization proposal of a DB-Table),
the flag dbTable
must be true, otherwise it must be false. This flag
can be get and set by means of the isDbTable()
and setDbTable(boolean)
methods.
Field Summary | |
---|---|
private AttributeStringSet |
attributes
The set of attributes belonging to this table. |
private Set<CandKey> |
candKeys
The candidate keys. |
private String |
catalog
The catalog this table is contained in, may be null. |
private Map<String,TableColumn> |
columnInfos
A map containing tableColumn information for each attribute. |
private TableContainer |
container
The TableContainer this table is contained in. |
private PK |
dbPK
The PK defined in the DB. |
private boolean |
dbTable
A flag which specifies if the table is a DB-Table or not. |
private List<FK> |
exportedKeys
The exported keys for this table. |
private Set<FD> |
FDMinCover
A minimal cover of the functional dependencies (FDs) contained in FDs . |
private Set<FD> |
FDs
The set of functional dependencies (FDs) for this table, just as it has been specified by the user or imported from a file. |
private List<FK> |
importedKeys
The imported keys for this table. |
private NFDeterminationResult |
nfDeterminationResult
The result of the normal form determination for this table. |
private NormalizationProposal |
normProposal
The normalization proposal for this table. |
private PK |
pk
The PK selected by DBNormalizer when calculating candidate keys or by the user. |
private String |
schema
The schema this table is contained in, may be null. |
Constructor Summary | |
---|---|
Table()
|
Method Summary | |
---|---|
void |
addColumnInfo(String colName,
TableColumn col)
Adds the TableColumn information specified by argument col for the column (attribute) specified by argument colName. |
int |
compareTo(Table table)
Compares this table to another table based on the qualified names of the tables. |
boolean |
equals(Object o)
Overridden Method, tests if this table is equal to the o argument based on the qualified name. |
AttributeStringSet |
getAttributes()
Gets the set of attributes belonging to this table. |
Set<CandKey> |
getCandKeys()
Gets this table's candidate keys (if they have already been set). |
String |
getCatalog()
Gets the name of the catalog this table is contained in. |
TableColumn |
getColumnInfo(String colName)
Gets TableColumn information for the column (attribute) specified by the colName argument. |
Collection<TableColumn> |
getColumnInfos()
Gets TableColumn information for each of the table's columns (attributes). |
TableContainer |
getContainer()
Gets the TableContainer this table is contained in. |
PK |
getDbPK()
Gets the primary key (PK) defined in the DB. |
List<FK> |
getExportedKeys()
Gets the exported keys. |
Set<FD> |
getFDMinCover()
Gets the minimal cover of FDs for this table. |
Set<FD> |
getFDs()
Gets the FDs for this table. |
List<FK> |
getImportedKeys()
Gets the imported keys. |
NFDeterminationResult |
getNfDeterminationResult()
Gets the result of the normal form determination for this table. |
NormalizationProposal |
getNormProposal()
Gets the currently set normalization proposal for this table. |
PK |
getPk()
Gets the PK for this table. |
String |
getQualifiedName()
Gets the qualified name for this table. |
String |
getSchema()
Gets the name of the schema this table is contained in. |
boolean |
isDbTable()
States whether this table is a DB-Table or not. |
void |
setAttributes(AttributeStringSet attributes)
Sets the set of attributes belonging to this table. |
void |
setCandKeys(Set<CandKey> candKeys)
Sets this table's candidate keys. |
void |
setCatalog(String catalog)
Sets the name of the catalog this table is contained in; must be null , if the table is not contained in a catalog. |
void |
setContainer(TableContainer container)
Sets the TableContainer this table is contained in; must be null , if the table is not contained in one. |
void |
setDbPK(PK dbPK)
Sets the primary key (PK) defined in the DB. |
void |
setDbTable(boolean dbTable)
Sets whether this table is a DB-Table or not. |
void |
setExportedKeys(List<FK> exportedKeys)
Sets the exported keys. |
void |
setFDMinCover(Set<FD> minCover)
Sets the minimal cover of FDs for this table. |
void |
setFDs(Set<FD> fds)
Sets the FDs for this table. |
void |
setImportedKeys(List<FK> importedKeys)
Sets the imported keys. |
void |
setNfDeterminationResult(NFDeterminationResult nfDeterminationResult)
Sets the result of the normal form determination for this table. |
void |
setNormProposal(NormalizationProposal normProposal)
Sets the normalization proposal for this table. |
void |
setPk(PK pk)
Sets the PK for this table. |
void |
setSchema(String schema)
Sets the name of the schema this table is contained in; must be null , if the table is not contained in a schema. |
Methods inherited from class de.fesenmeyer.dbnormalizer.core.AbstractDBItem |
---|
getName, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private String catalog
private String schema
private TableContainer container
TableContainer
this table is contained in.
private AttributeStringSet attributes
private Map<String,TableColumn> columnInfos
private PK dbPK
private PK pk
private List<FK> exportedKeys
DatabaseMetaData.getExportedKeys(String, String, String)
private List<FK> importedKeys
DatabaseMetaData.getImportedKeys(String, String, String)
private Set<FD> FDs
NOTE: Everytime you change these FDs, make sure you recompute the
minimal cover and update FDMinCover
, before determining
candidate keys, normal form or creating a normalization proposal.
private Set<FD> FDMinCover
FDs
.
private Set<CandKey> candKeys
private NFDeterminationResult nfDeterminationResult
private NormalizationProposal normProposal
private boolean dbTable
Table
Constructor Detail |
---|
public Table()
Method Detail |
---|
public Set<FD> getFDMinCover()
FDMinCover
public void setFDMinCover(Set<FD> minCover)
minCover
- the minimal cover of FDsFDMinCover
public AttributeStringSet getAttributes()
public void setAttributes(AttributeStringSet attributes)
attributes
- the attributespublic Set<FD> getFDs()
FDs
public void setFDs(Set<FD> fds)
fds
- the FDsFDs
public List<FK> getExportedKeys()
DatabaseMetaData.getExportedKeys(String, String, String)
public void setExportedKeys(List<FK> exportedKeys)
exportedKeys
- the exported keysDatabaseMetaData.getExportedKeys(String, String, String)
public PK getPk()
pk
public void setPk(PK pk)
pk
- the PKpk
public List<FK> getImportedKeys()
DatabaseMetaData.getImportedKeys(String, String, String)
public void setImportedKeys(List<FK> importedKeys)
importedKeys
- the imported keysDatabaseMetaData.getImportedKeys(String, String, String)
public boolean equals(Object o)
equals
in class Object
o
- the Object to test if it is equal to this table
getQualifiedName()
method returns equal values for both this table and the table
specified by the o argument;
false, otherwisepublic String getQualifiedName()
public String getCatalog()
null
, otherwisepublic void setCatalog(String catalog)
Sets the name of the catalog this table is contained in; must be
null
, if the table is not contained in a catalog.
NOTE: If this method is called, the setContainer(TableContainer)
method should also be called in order to avoid inconsistencies.
catalog
- the catalog's name or null
public String getSchema()
null
, otherwisepublic void setSchema(String schema)
Sets the name of the schema this table is contained in; must be
null
, if the table is not contained in a schema.
NOTE: If this method is called, the setContainer(TableContainer)
method should also be called in order to avoid inconsistencies.
schema
- the schema's name or null
public TableContainer getContainer()
null, otherwise
TableContainer
public void setContainer(TableContainer container)
Sets the TableContainer this table is contained in; must be
null
, if the table is not contained in one.
NOTE: If this method is called, the setCatalog(String)
and/or
setSchema(String)
method(s) should also be called in order to
avoid inconsistencies.
container
- the table's container or null
public Set<CandKey> getCandKeys()
public void setCandKeys(Set<CandKey> candKeys)
setPk(PK)
method.
candKeys
- this table's candidate keyspublic NFDeterminationResult getNfDeterminationResult()
null
, if it has not yet been set for this table.public void setNfDeterminationResult(NFDeterminationResult nfDeterminationResult)
nfDeterminationResult
- the result of the normal form determinationpublic boolean isDbTable()
true
, if it is a DB-Table; false
, otherwiseTable
public void setDbTable(boolean dbTable)
dbTable
- must be true
, if it is a DB-Table; false
, otherwiseTable
public PK getDbPK()
null
, if none has been defined in the DBpublic void setDbPK(PK dbPK)
dbPK
- the PK defined in the DB; must be null
, if
none has been defined in the DBpublic TableColumn getColumnInfo(String colName)
colName
- the column's name
null
, otherwise.public Collection<TableColumn> getColumnInfos()
public void addColumnInfo(String colName, TableColumn col)
getAttributes()
method.
colName
- the column (attribute) namecol
- the TableColumn objectpublic NormalizationProposal getNormProposal()
null
, if a normalization proposal has not yet been setpublic void setNormProposal(NormalizationProposal normProposal)
normProposal
- a normalization proposalpublic int compareTo(Table table)
compareTo
in interface Comparable<Table>
table
- another table
0
,
if this table's qualified name is smaller than the other
table's qualified name in terms of the alphabetical order.
0
,
if this table's qualified name exactly equals the other
table's qualified name.
0
,
if this table's qualified name is greater than the other
table's qualified name in terms of the alphabetical order.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |