org.intermine.sql.query
Class Constant

java.lang.Object
  extended by org.intermine.sql.query.AbstractValue
      extended by org.intermine.sql.query.Constant
All Implemented Interfaces:
SQLStringable

public class Constant
extends AbstractValue

A representation of a constant value in an SQL query.


Field Summary
protected  java.lang.String value
           
 
Fields inherited from class org.intermine.sql.query.AbstractValue
EQUAL, GREATER, INCOMPARABLE, LESS, NOT_EQUAL
 
Constructor Summary
Constant(java.lang.String value)
          Constructor for this Constant object.
 
Method Summary
 int compare(AbstractValue obj, java.util.Map tableMap, java.util.Map reverseTableMap)
          Compare this Constant to another AbstractValue.
 boolean equals(java.lang.Object obj)
          Overrides Object.equals().
 java.lang.String getSQLString()
          Returns a String representation of this Constant object, suitable for forming part of an SQL query.
 int hashCode()
          Overrides Object.hashcode().
 boolean isAggregate()
          Returns true if this value is an aggregate function.
 java.lang.String toString()
          
 
Methods inherited from class org.intermine.sql.query.AbstractValue
greaterOrEqual, greaterThan, lessOrEqual, lessThan, notEqualTo, valueEquals
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

value

protected java.lang.String value
Constructor Detail

Constant

public Constant(java.lang.String value)
Constructor for this Constant object.

Parameters:
value - the constant, as referenced in the SQL query, including any ' characters surrounding it.
Method Detail

getSQLString

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

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

equals

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

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

hashCode

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

Specified by:
hashCode in class AbstractValue
Returns:
an arbitrary integer based on the value of the Constant

compare

public int compare(AbstractValue obj,
                   java.util.Map tableMap,
                   java.util.Map reverseTableMap)
Compare this Constant to another AbstractValue. This method is capable of spotting some situations when one Constant is strictly less or greater than another. Compare the value of this AbstractValue with another.

Specified by:
compare in class AbstractValue
Parameters:
obj - an AbstractValue to compare to
tableMap - a mapping between tablenames of the two elements
reverseTableMap - a reverse of tableMap
Returns:
EQUAL, LESS, GREATER, NOT_EQUAL, or INCOMPARABLE

isAggregate

public boolean isAggregate()
Returns true if this value is an aggregate function.

Specified by:
isAggregate in class AbstractValue
Returns:
a boolean

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object