Class Database
java.lang.Object
com.invirgance.convirgance.olap.sql.Database
Provides support for Database structure representation.
- Author:
- jbanes
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the provided table to the Database if it already doesn't exist.boolean
Compares the Database to another object first based on reference and then on name of the Database.getName()
Returns the name of the database.Returns the table whose name matches the passed in String.Returns the list of tables stored in the database.int
hashCode()
Returns the hashCode for the Database's name.void
removeTable
(Table table) Removes the table from the Database.void
Sets the name of the Database to the provided string.void
Sets the tables to the Database and sets the Database to each table in the list.
-
Constructor Details
-
Database
public Database()Creates a new instance of the Database object. -
Database
Creates a new instance of the Database with the specified name.- Parameters:
name
- the String representing the name.
-
-
Method Details
-
getName
Returns the name of the database.- Returns:
- name as a String.
-
setName
Sets the name of the Database to the provided string.- Parameters:
name
- The new name to use.
-
getTables
Returns the list of tables stored in the database.- Returns:
- list of Table objects.
-
addTable
Adds the provided table to the Database if it already doesn't exist. If the Database already contains the table passed in as the parameter, does nothing. This ensures that table names are not repeated when adding to the database.- Parameters:
table
- The table to add.
-
getTable
Returns the table whose name matches the passed in String. If the Database does not contain a table under such name, returns null.- Parameters:
name
- String representing the name of the table to return.- Returns:
- Table with the specified name.
-
removeTable
Removes the table from the Database.- Parameters:
table
- The table to remove.
-
setTables
Sets the tables to the Database and sets the Database to each table in the list.- Parameters:
tables
- A List of Table objects to assign to the database
-
equals
Compares the Database to another object first based on reference and then on name of the Database. -
hashCode
public int hashCode()Returns the hashCode for the Database's name.
-