001: /**
002: * Sequoia: Database clustering technology.
003: * Copyright (C) 2002-2004 French National Institute For Research In Computer
004: * Science And Control (INRIA).
005: * Contact: sequoia@continuent.org
006: *
007: * Licensed under the Apache License, Version 2.0 (the "License");
008: * you may not use this file except in compliance with the License.
009: * You may obtain a copy of the License at
010: *
011: * http://www.apache.org/licenses/LICENSE-2.0
012: *
013: * Unless required by applicable law or agreed to in writing, software
014: * distributed under the License is distributed on an "AS IS" BASIS,
015: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016: * See the License for the specific language governing permissions and
017: * limitations under the License.
018: *
019: * Initial developer(s): Emmanuel Cecchet.
020: * Contributor(s): Mathieu Peltier.
021: */package org.continuent.sequoia.common.sql.schema;
022:
023: /**
024: * A <code>TableColumn</code> is used to carry parsing information and
025: * contains a database table name and one of its column.
026: *
027: * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet</a>
028: * @author <a href="mailto:Mathieu.Peltier@inrialpes.fr">Mathieu Peltier</a>
029: * @version 1.0
030: */
031: public class TableColumn {
032: /** The table name. */
033: private String tableName;
034:
035: /** The column name. */
036: private String columnName;
037:
038: /**
039: * Creates a new <code>TableColumn</code>.
040: *
041: * @param tableName the table name
042: * @param columnName the column name
043: */
044: public TableColumn(String tableName, String columnName) {
045: if (tableName == null)
046: throw new IllegalArgumentException(
047: "Illegal null table name in TableColumn constructor");
048:
049: if (columnName == null)
050: throw new IllegalArgumentException(
051: "Illegal null column name in TableColumn constructor");
052:
053: this .tableName = tableName;
054: this .columnName = columnName;
055: }
056:
057: /**
058: * Returns the column name.
059: *
060: * @return the column name.
061: */
062: public String getColumnName() {
063: return columnName;
064: }
065:
066: /**
067: * Returns the table name.
068: *
069: * @return the table name.
070: */
071: public String getTableName() {
072: return tableName;
073: }
074:
075: /**
076: * Sets the column name.
077: *
078: * @param columnName the column to set
079: */
080: public void setColumnName(String columnName) {
081: this .columnName = columnName;
082: }
083:
084: /**
085: * Sets the table name.
086: *
087: * @param tableName the table to set
088: */
089: public void setTableName(String tableName) {
090: this .tableName = tableName;
091: }
092:
093: /**
094: * Two <code>TableColumn</code> objects are considered equal if they have
095: * the same name and belong to the same table.
096: *
097: * @param other the object to compare with
098: * @return true if the 2 objects are the same
099: */
100: public boolean equals(Object other) {
101: if ((other == null) || !(other instanceof TableColumn))
102: return false;
103:
104: TableColumn c = (TableColumn) other;
105: return columnName.equals(c.getColumnName())
106: && tableName.equals(c.getTableName());
107: }
108: }
|