de.fuberlin.wiwiss.d2rq.algebra
Class RelationName

java.lang.Object
  extended by de.fuberlin.wiwiss.d2rq.algebra.RelationName
All Implemented Interfaces:
Comparable<RelationName>

public class RelationName
extends Object
implements Comparable<RelationName>

A relation name, including an optional schema name. TODO: Should know about its database and not be equal if the databases are not equal. (?)

Author:
Richard Cyganiak (richard@cyganiak.de)

Constructor Summary
RelationName(String schemaName, String tableName)
          Constructs a new relation name with specified case.
RelationName(String schemaName, String tableName, boolean caseUnspecified)
          Constructs a new relation name.
 
Method Summary
 boolean caseUnspecified()
           
 int compareTo(RelationName other)
          Relations without schema are less than relations with schema.
 boolean equals(Object otherObject)
          Two relation names are identical if and only if they share the same name and schema, or they share the same name and both have no schema.
 int hashCode()
           
 String qualifiedName()
          Returns the full name, including the schema if present, in schema.table or table notation.
 String schemaName()
           
 String tableName()
           
 String toString()
           
 RelationName withPrefix(int index)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RelationName

public RelationName(String schemaName,
                    String tableName,
                    boolean caseUnspecified)
Constructs a new relation name.

Parameters:
schemaName - The schema name, or null if none
tableName - The table name
caseUnspecified - Whether the case is unspecified, i.e. comparisons on this relation name need to be case-insensitive

RelationName

public RelationName(String schemaName,
                    String tableName)
Constructs a new relation name with specified case.

Parameters:
schemaName - The schema name, or null if none
tableName - The table name
Method Detail

tableName

public String tableName()
Returns:
The table name

schemaName

public String schemaName()
Returns:
The schema name, or null if none

qualifiedName

public String qualifiedName()
Returns the full name, including the schema if present, in schema.table or table notation.

Returns:
The qualified name

caseUnspecified

public boolean caseUnspecified()

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object otherObject)
Two relation names are identical if and only if they share the same name and schema, or they share the same name and both have no schema.

Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(RelationName other)
Relations without schema are less than relations with schema. Relations without schema are ordered by table name, those with schema are ordered by schema name.

Specified by:
compareTo in interface Comparable<RelationName>

withPrefix

public RelationName withPrefix(int index)