Class Database

java.lang.Object
com.invirgance.convirgance.olap.sql.Database

public class Database extends Object
Provides support for Database structure representation.
Author:
jbanes
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of the Database object.
    Creates a new instance of the Database with the specified name.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTable(Table table)
    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.
    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
    Returns the hashCode for the Database's name.
    void
    Removes the table from the Database.
    void
    Sets the name of the Database to the provided string.
    void
    setTables(List<Table> tables)
    Sets the tables to the Database and sets the Database to each table in the list.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Database

      public Database()
      Creates a new instance of the Database object.
    • Database

      public Database(String name)
      Creates a new instance of the Database with the specified name.
      Parameters:
      name - the String representing the name.
  • Method Details

    • getName

      public String getName()
      Returns the name of the database.
      Returns:
      name as a String.
    • setName

      public void setName(String name)
      Sets the name of the Database to the provided string.
      Parameters:
      name - The new name to use.
    • getTables

      public List<Table> getTables()
      Returns the list of tables stored in the database.
      Returns:
      list of Table objects.
    • addTable

      public void addTable(Table table)
      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

      public Table getTable(String name)
      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

      public void removeTable(Table table)
      Removes the table from the Database.
      Parameters:
      table - The table to remove.
    • setTables

      public void setTables(List<Table> tables)
      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

      public boolean equals(Object obj)
      Compares the Database to another object first based on reference and then on name of the Database.
      Overrides:
      equals in class Object
      Parameters:
      obj - A database to compare to.
      Returns:
      true if the databases are the same by memory reference or by name, false otherwise.
    • hashCode

      public int hashCode()
      Returns the hashCode for the Database's name.
      Overrides:
      hashCode in class Object
      Returns:
      int representing the hashCode.