net.sourceforge.nite.search.rewriter
Interface DeclarationOrderingScheme

All Known Implementing Classes:
DefaultDeclarationOrderingScheme

public interface DeclarationOrderingScheme

An interface for classes that take a list of variable declarations and provide a preferred ordering for them based on properties of the variables and/or their types.

NOTE: We could make a similar class which provides an ordering for a list of conditions/SimpleQueries, taking into account properties of the relations involved.

NOTE: As we are just providing an ordering, we could alternatively provide a Comparator rather than this class...

NOTE: The ordering for subqueries declaring variables with equivalent scores may be overridden to make the distribution of conditions easier, but how do we represent this?

Author:
nmayo

Method Summary
 int calculateVariableScore(java.util.List types)
          Calculate a score for the given list of variable types.
 java.util.List getOrdering(java.util.List declarableVariables)
          Calculates scores for each variable and orders variable names according to these scores.
 

Method Detail

getOrdering

java.util.List getOrdering(java.util.List declarableVariables)
Calculates scores for each variable and orders variable names according to these scores.

Parameters:
declarableVariables - a List of DeclarableVariable objects to order
Returns:
a list of variable names in a preferred order of declaration

calculateVariableScore

int calculateVariableScore(java.util.List types)
Calculate a score for the given list of variable types. This could be a rank, a frequency count or any other number. The score will be used to order variable declarations.

Parameters:
types - a List of types to which a variable is bound
Returns:
the score for the query