uk.ac.ic.doc.rodex.qproc
Class QueryFunction

java.lang.Object
  extended by uk.ac.ic.doc.rodex.qproc.QueryFunction

public class QueryFunction
extends java.lang.Object


Constructor Summary
QueryFunction(AutoMedQueryToken operator, QueryVariable var, AutoMedType expression)
          Creates a new instance of QueryFunction
Accepts an AutoMedType expression
 
Method Summary
static int compareExpressions(AutoMedType t1, AutoMedType t2)
          Compare two AutoMedType expressions
static int compareNumericExpressions(double f1, double f2)
           
static int compareStringExpressions(java.lang.String s1, java.lang.String s2)
           
 AutoMedType getExpression()
           
 AutoMedQueryToken getOperator()
           
static AutoMedType[] getValueRange(java.util.List funcs)
          Get a value range for a set of query functions
This method supports two types of query expressions: numeric and literal
 QueryVariable getVariable()
           
 boolean isComparableTo(QueryFunction qf)
          Check if two functions are comparable, i.e.:
the associated variables of the functions are mappable
 boolean isConsistentWith(QueryFunction qf)
          Check if this functions is consistent with another function.
 boolean isLiteral()
           
 boolean isMutuallyConsistentWith(QueryFunction qf)
          Check if two QueryFunction objects are mutually consistent
Basically, this checks that this function is consistent with another function
(see isConsistentWith(QueryFunction qf)) and the reverse.
 boolean isNumeric()
           
 java.lang.String toIQLString()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryFunction

public QueryFunction(AutoMedQueryToken operator,
                     QueryVariable var,
                     AutoMedType expression)
Creates a new instance of QueryFunction
Accepts an AutoMedType expression

Method Detail

getOperator

public AutoMedQueryToken getOperator()

getVariable

public QueryVariable getVariable()

getExpression

public AutoMedType getExpression()

isNumeric

public boolean isNumeric()

isLiteral

public boolean isLiteral()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toIQLString

public java.lang.String toIQLString()

isComparableTo

public boolean isComparableTo(QueryFunction qf)
Check if two functions are comparable, i.e.:


isMutuallyConsistentWith

public boolean isMutuallyConsistentWith(QueryFunction qf)
Check if two QueryFunction objects are mutually consistent
Basically, this checks that this function is consistent with another function
(see isConsistentWith(QueryFunction qf)) and the reverse.

Parameters:
qf - the other QueryFunction object

isConsistentWith

public boolean isConsistentWith(QueryFunction qf)
Check if this functions is consistent with another function. Two functions are consistent
iff all of the following conditions are true:

To check mutual consistency, we must execute this function twice
one for each direction (see isMutuallyConsistentWith(QueryFunction qf))

This function should only be called after two functions have been
identified to be comparable, see isComparableTo(QueryFunction qf)


compareExpressions

public static int compareExpressions(AutoMedType t1,
                                     AutoMedType t2)
Compare two AutoMedType expressions


compareNumericExpressions

public static int compareNumericExpressions(double f1,
                                            double f2)

compareStringExpressions

public static int compareStringExpressions(java.lang.String s1,
                                           java.lang.String s2)

getValueRange

public static AutoMedType[] getValueRange(java.util.List funcs)
Get a value range for a set of query functions
This method supports two types of query expressions: numeric and literal

Parameters:
funcs - a List of QueryFunction objects
Returns:
AutoMedType[] an array of two AutoMedType objects, one for the lower bound and the other for the upper bound