org.intermine.sql.query
Class SubQuery

java.lang.Object
  extended by org.intermine.sql.query.AbstractTable
      extended by org.intermine.sql.query.SubQuery
All Implemented Interfaces:
SQLStringable

public class SubQuery
extends AbstractTable

A representation of a subquery that can be present in the FROM section of an SQL query.


Field Summary
protected  Query query
           
 
Fields inherited from class org.intermine.sql.query.AbstractTable
alias
 
Constructor Summary
SubQuery(Query query, java.lang.String alias)
          Constructor for this SubQuery object.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Overrides Object.equals().
 boolean equalsIgnoreAlias(AbstractTable obj)
          Compare this SubQuery to another AbstractTable, ignoring alias.
 Query getQuery()
          Returns the query contained in the subquery.
 java.lang.String getSQLString()
          Returns a String representation of this SubQuery object, auitable for forming part of an SQL query.
 int hashCode()
          Overrides Object.hashCode().
 
Methods inherited from class org.intermine.sql.query.AbstractTable
equalsOnlyAlias, getAlias, setAlias
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

query

protected Query query
Constructor Detail

SubQuery

public SubQuery(Query query,
                java.lang.String alias)
Constructor for this SubQuery object.

Parameters:
query - a Query to be included as a subquery
alias - an arbitrary name that the subquery has been renamed to for the rest of the query
Method Detail

getQuery

public Query getQuery()
Returns the query contained in the subquery.

Returns:
the subquery

getSQLString

public java.lang.String getSQLString()
Returns a String representation of this SubQuery object, auitable for forming part of an SQL query.

Specified by:
getSQLString in interface SQLStringable
Specified by:
getSQLString in class AbstractTable
Returns:
the String representation

equals

public boolean equals(java.lang.Object obj)
Overrides Object.equals().

Specified by:
equals in class AbstractTable
Parameters:
obj - an Object to compare to
Returns:
true if the object is of the same class, and with an equal query and alias

hashCode

public int hashCode()
Overrides Object.hashCode().

Specified by:
hashCode in class AbstractTable
Returns:
an arbitrary integer created from the contents of the SubQuery

equalsIgnoreAlias

public boolean equalsIgnoreAlias(AbstractTable obj)
Compare this SubQuery to another AbstractTable, ignoring alias.

Specified by:
equalsIgnoreAlias in class AbstractTable
Parameters:
obj - an AbstractTable to compare to
Returns:
true if the object is of the same class, and with an equal query