public class DBSchema extends DBLineParsers
Constructor and Description |
---|
DBSchema(java.lang.String name)
This constructor is used for the incremental construction of database
tableSchemas.
|
DBSchema(java.lang.String name,
TableSchema... schemas)
create DBSchema that has SubTableSchema and a list of TableSchemas can
incrementally add subtable tableSchemas subsequently -- before schema is
instantiated as a database
|
Modifier and Type | Method and Description |
---|---|
void |
addSubTableSchema(SubTableSchema sts)
add subtable schema sts to 'this' database schema
|
void |
addSubTableSchemas(SubTableSchema... sts)
add subtableschema in bulk
|
void |
addTableSchema(TableSchema tableschema)
add table schema tableschema to 'this' database schema
|
void |
addTableSchemas(TableSchema... schemas)
for adding schemas in bulk
|
DBSchema |
copy()
copy a database schema.
|
boolean |
equals(DBSchema dbschema)
two DBSchemas are equal iff (a) they have the same SubTableSchema, (b)
they have the same set of table schemas, and (c) they have the same set
of subtableschemas; if so true is returned.
|
void |
equalsEH(DBSchema dbschema)
two DBSchemas are equal iff (a) they have the same SubTableSchema, (b)
they have the same set of table schemas, and (c) they have the same set
of subtable schemas; if so this method returns.
|
void |
finishAndPropagateAttributes()
sets DB Schema ready for instantiation; flattens the schema if not
already flattened.
|
void |
finishedAndIPropagatedAttributesMyself()
you finished a schema where you swear that you propagated all attributes
in a table hierarchy.
|
java.lang.String |
getFullName()
full (file) SubTableSchema of a schema is (SubTableSchema).schema.pl
|
java.lang.String |
getName()
return the SubTableSchema of the schema
|
SubTableSchema |
getSubTableSchema(java.lang.String tableName)
returns subtable object for given tableName, null if none exists
|
SubTableSchema |
getSubTableSchema(TableSchema ts)
returns subtable object for given tableSchema ts, null if none exists
|
SubTableSchema |
getSubTableSchemaEH(java.lang.String tableName)
returns subtable object for given tableName; throws Error if no such
tableName exists
|
SubTableSchema |
getSubTableSchemaEH(TableSchema ts)
returns subtable object for given tableSchema ts; throws Error if no such
ts exists
|
java.util.List<SubTableSchema> |
getSubTableSchemas()
return list of SubTableSchemas of this database schema
|
TableSchema |
getSuperTable(TableSchema s)
return the TableSchema of the super/dbSchema table of TableSchema s
|
TableSchema |
getTableSchema(java.lang.String tableName)
return the TableSchema with SubTableSchema tableName
|
TableSchema |
getTableSchemaEH(java.lang.String tableName)
return the TableSchema with SubTableSchema tableName with built-in error
handling
|
java.util.List<TableSchema> |
getTableSchemas()
return list of TableSchemas of this database schema
|
boolean |
isFinished() |
void |
print()
prints to System.out
|
void |
print(java.io.PrintStream out)
print the database schema definition to PrintStream out; typically used
for demonstrations as it doesn't check the format of the filename; Use
print() or print(String).
|
void |
print(java.lang.String filename)
print DBSchema in file with filename
|
static DBSchema |
readSchema(java.io.File schemafile)
another version of readSchema
|
static DBSchema |
readSchema(java.lang.String schemafile)
reads .ooschema and .schema files; throws Error when an error is
encountered.
|
static DBSchema |
readSchema(java.lang.String nameOfSchema,
java.lang.String stringDefOfSchema)
used when it is easier to pass in a string declaration of a DBSchema
rather than building it programmatically
|
void |
rename(java.lang.String name)
rename DBschema
|
int |
size()
return number of TableSchemas (equivalently the number of Tables in a
schema instance) in this dbschema
|
java.lang.String |
toString()
converts DBSchema to a string.
|
parseDBaseDecl, parseSubTableDecl, parseTableDecl, parseTableDecl, parseTupleDecl
public DBSchema(java.lang.String name, TableSchema... schemas)
name
- of DBSchemaschemas
- comma-separated list of table tableSchemaspublic DBSchema(java.lang.String name)
name
- -- SubTableSchema given to the DBSchemapublic DBSchema copy()
public static DBSchema readSchema(java.lang.String schemafile)
schemafile
- -- SubTableSchema of schema filepublic static DBSchema readSchema(java.io.File schemafile)
schemafile
- -- File to readpublic static DBSchema readSchema(java.lang.String nameOfSchema, java.lang.String stringDefOfSchema)
nameOfSchema
- -- name of pseudo filestringDefOfSchema
- -- string contents (typically multiline) of pseudo filepublic java.lang.String getName()
public java.lang.String getFullName()
public TableSchema getTableSchema(java.lang.String tableName)
tableName
- of schema to returnpublic TableSchema getTableSchemaEH(java.lang.String tableName)
tableName
- of schema to returnpublic java.util.List<TableSchema> getTableSchemas()
public java.util.List<SubTableSchema> getSubTableSchemas()
public SubTableSchema getSubTableSchema(java.lang.String tableName)
tableName
- -- SubTableSchema of table whose subtables are to be
returnedpublic SubTableSchema getSubTableSchemaEH(java.lang.String tableName)
tableName
- -- SubTableSchema of table whose subtables are to be
returnedpublic SubTableSchema getSubTableSchema(TableSchema ts)
ts
- -- TableSchema object for which subtable declaration is to be
returnedpublic SubTableSchema getSubTableSchemaEH(TableSchema ts)
ts
- -- SubTableSchema of tableSchema whose subtables are to be
returnedpublic TableSchema getSuperTable(TableSchema s)
s
- -- input TableSchemapublic boolean isFinished()
public void finishAndPropagateAttributes()
public void finishedAndIPropagatedAttributesMyself()
public int size()
public void addTableSchema(TableSchema tableschema)
tableschema
- to add to 'this' database schemapublic void addTableSchemas(TableSchema... schemas)
schemas
- -- list of table schemaspublic void addSubTableSchema(SubTableSchema sts)
sts
- subtableschema to add to 'this' databasepublic void addSubTableSchemas(SubTableSchema... sts)
sts
- -- an array of subtable schemaspublic boolean equals(DBSchema dbschema)
dbschema
- -- the other dbschemapublic void equalsEH(DBSchema dbschema)
dbschema.
- public void rename(java.lang.String name)
name
- new DBSchema SubTableSchemapublic java.lang.String toString()
toString
in class java.lang.Object
public void print(java.io.PrintStream out)
out
- PrintStream destinationpublic void print()
public void print(java.lang.String filename)
filename
- -- name of file in which to print DBSchema