Package org.intermine.sql.query
Class AbstractValue
- java.lang.Object
-
- org.intermine.sql.query.AbstractValue
-
- All Implemented Interfaces:
SQLStringable
- Direct Known Subclasses:
Constant
,Field
,Function
,OrderDescending
public abstract class AbstractValue extends java.lang.Object implements SQLStringable
An abstract representation of an item that can be present in the SELECT, GROUP BY, or ORDER BY sections of an SQL query, as well as in a constraint.- Author:
- Matthew Wakeling, Andrew Varley
-
-
Field Summary
Fields Modifier and Type Field Description static int
EQUAL
Describes two AbstractValues as being equal.static int
GREATER
Describes one AbstractValue as being greater than another AbstractValue.static int
INCOMPARABLE
Describes one AbstractValue as being incomparable to another AbstractValue.static int
LESS
Describes one AbstractValue as being less than another AbstractValue.static int
NOT_EQUAL
Describes one AbstractValue as being definitely not equal to another AbstractValue.
-
Constructor Summary
Constructors Constructor Description AbstractValue()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract int
compare(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare the value of this AbstractValue with another.abstract boolean
equals(java.lang.Object obj)
Overrides Object.equals().abstract java.lang.String
getSQLString()
Returns a String representation of this AbstractValue object, suitable for forming part of an SQL query.boolean
greaterOrEqual(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare this value of this AbstractValue with another to see if it is more or equal.boolean
greaterThan(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare this value of this AbstractValue with another to see if it is more.abstract int
hashCode()
Overrides Object.hashcode().abstract boolean
isAggregate()
Returns true if this value is an aggregate function.boolean
lessOrEqual(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare the value of this AbstractValue with another to see if it is less or equal.boolean
lessThan(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare the value of this AbstractValue with another to see if it is less.boolean
notEqualTo(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare this value of this AbstractValue with another to see if it is not equal.boolean
valueEquals(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare the value of this AbstractValue with another to see if it is equal.
-
-
-
Field Detail
-
EQUAL
public static final int EQUAL
Describes two AbstractValues as being equal.- See Also:
- Constant Field Values
-
LESS
public static final int LESS
Describes one AbstractValue as being less than another AbstractValue.- See Also:
- Constant Field Values
-
GREATER
public static final int GREATER
Describes one AbstractValue as being greater than another AbstractValue.- See Also:
- Constant Field Values
-
NOT_EQUAL
public static final int NOT_EQUAL
Describes one AbstractValue as being definitely not equal to another AbstractValue.- See Also:
- Constant Field Values
-
INCOMPARABLE
public static final int INCOMPARABLE
Describes one AbstractValue as being incomparable to another AbstractValue. In other words, we can't tell if they are equal or not.- See Also:
- Constant Field Values
-
-
Method Detail
-
getSQLString
public abstract java.lang.String getSQLString()
Returns a String representation of this AbstractValue object, suitable for forming part of an SQL query.- Specified by:
getSQLString
in interfaceSQLStringable
- Returns:
- the String representation
-
equals
public abstract boolean equals(java.lang.Object obj)
Overrides Object.equals().- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- an Object to compare to- Returns:
- true if obj is equal
-
hashCode
public abstract int hashCode()
Overrides Object.hashcode().- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- an arbitrary integer based on the contents of the object
-
compare
public abstract int compare(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare the value of this AbstractValue with another.- Parameters:
obj
- an AbstractValue to compare totableMap
- a mapping between tablenames of the two elementsreverseTableMap
- a reverse of tableMap- Returns:
- EQUAL, LESS, GREATER, NOT_EQUAL, or INCOMPARABLE
-
lessThan
public boolean lessThan(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare the value of this AbstractValue with another to see if it is less. This only really makes sense with Constants. It uses the compare method of AbstractValue. Note that the result being false does not imply greater than or equal - it may be incomparable.- Parameters:
obj
- an AbstractValue to compare totableMap
- a mapping between tablenames of the two elementsreverseTableMap
- a reverse of tableMap- Returns:
- true if this is less than obj
-
greaterThan
public boolean greaterThan(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare this value of this AbstractValue with another to see if it is more. This only really makes sense with Constants. It uses the compare method of AbstractValue. Note that the result being false does not imply less than or equal - it may be incomparable.- Parameters:
obj
- an AbstractValue to compare totableMap
- a mapping between tablenames of the two elementsreverseTableMap
- a reverse of tableMap- Returns:
- true if this is more than obj
-
notEqualTo
public boolean notEqualTo(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare this value of this AbstractValue with another to see if it is not equal. It uses the compare method of AbstractValue. Note that the result being false does not imply EQUAL - it may be incomparable.- Parameters:
obj
- an AbstractValue to compare totableMap
- a mapping between tablenames of the two elementsreverseTableMap
- a reverse of tableMap- Returns:
- true if this is definitely not equal to obj
-
greaterOrEqual
public boolean greaterOrEqual(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare this value of this AbstractValue with another to see if it is more or equal. This only really makes sense with Constants. It uses the compare method of AbstractValue. Note that the result being false does not imply less than - it may be incomparable.- Parameters:
obj
- an AbstractValue to compare totableMap
- a mapping between tablenames of the two elementsreverseTableMap
- a reverse of tableMap- Returns:
- true if this is more than obj
-
lessOrEqual
public boolean lessOrEqual(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare the value of this AbstractValue with another to see if it is less or equal. This only really makes sense with Constants. It uses the compare method of AbstractValue. Note that the result being false does not imply greater than - it may be incomparable.- Parameters:
obj
- an AbstractValue to compare totableMap
- a mapping between tablenames of the two elementsreverseTableMap
- a reverse of tableMap- Returns:
- true if this is less than obj
-
valueEquals
public boolean valueEquals(AbstractValue obj, java.util.Map<AbstractTable,AbstractTable> tableMap, java.util.Map<AbstractTable,AbstractTable> reverseTableMap)
Compare the value of this AbstractValue with another to see if it is equal. It uses the compare method of AbstractValue.- Parameters:
obj
- an AbstractValue to compare totableMap
- a mapping between tablenames of the two elementsreverseTableMap
- a reverse of tableMap- Returns:
- true if this is equal to obj
-
isAggregate
public abstract boolean isAggregate()
Returns true if this value is an aggregate function.- Returns:
- a boolean
-
-