uk.ac.bbk.dcs.automed.qproc.optimise.optimisers
Class ConstantInPatternOptimiser

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.qproc.optimise.Optimiser
      extended by uk.ac.bbk.dcs.automed.qproc.optimise.optimisers.ConstantInPatternOptimiser

public class ConstantInPatternOptimiser
extends Optimiser

Detects equality filters between a var and a constant, deletes the filter and replaces the var in generators with the constant

Author:
Lucas Zamboulis

Field Summary
 
Fields inherited from class uk.ac.bbk.dcs.automed.qproc.optimise.Optimiser
logger, targets
 
Constructor Summary
ConstantInPatternOptimiser(QueryOptimisationProvider qop)
           
 
Method Summary
protected  Cell generateNewEquiFun(Cell op, Cell con, Cell op1, Cell op2)
           
protected  Cell generateNewEquiFunHelp(Cell op, Cell con, Cell opEqualOp, Cell otherOp)
           
static void main(java.lang.String[] args)
           
protected  boolean noVar(Cell c)
           
 boolean optimise(Cell c, QueryProcessorConfiguration qpc)
           
protected  int replaceVar(Cell pat, java.util.Map m)
          Go through pattern and replace var/tuple with constant if needed
 
Methods inherited from class uk.ac.bbk.dcs.automed.qproc.optimise.Optimiser
getValueBasedOptimisation, optimise, optimise, setValueBasedOptimisation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantInPatternOptimiser

public ConstantInPatternOptimiser(QueryOptimisationProvider qop)
Method Detail

optimise

public boolean optimise(Cell c,
                        QueryProcessorConfiguration qpc)
                 throws QueryOptimisationException
Specified by:
optimise in class Optimiser
Throws:
QueryOptimisationException

generateNewEquiFun

protected Cell generateNewEquiFun(Cell op,
                                  Cell con,
                                  Cell op1,
                                  Cell op2)

generateNewEquiFunHelp

protected Cell generateNewEquiFunHelp(Cell op,
                                      Cell con,
                                      Cell opEqualOp,
                                      Cell otherOp)

replaceVar

protected int replaceVar(Cell pat,
                         java.util.Map m)
Go through pattern and replace var/tuple with constant if needed

Parameters:
pat - input pattern
m - contains mappings between variables/tuples and constants

noVar

protected boolean noVar(Cell c)

main

public static void main(java.lang.String[] args)