Class OptimiserCacheLine


  • public class OptimiserCacheLine
    extends java.lang.Object
    A class that provides an implementation of a cache line, encapsulating several pieces of data.
    Author:
    Matthew Wakeling
    • Constructor Summary

      Constructors 
      Constructor Description
      OptimiserCacheLine​(java.lang.String optimised, int limit, java.lang.String original)
      Constructor for this object.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getOptimised()
      Gets the optimised query (minus the LIMIT and OFFSET) from this cache line.
      java.lang.String getOriginal()
      Returns the original SQL string.
      double score​(int limit)
      Scores this cache line according to how far away the required limit is from the limit used to create the line.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OptimiserCacheLine

        public OptimiserCacheLine​(java.lang.String optimised,
                                  int limit,
                                  java.lang.String original)
        Constructor for this object.
        Parameters:
        optimised - the optimised SQL String, minus the LIMIT and OFFSET
        limit - the limit that was used to generate optimised
        original - the original sql query
    • Method Detail

      • score

        public double score​(int limit)
        Scores this cache line according to how far away the required limit is from the limit used to create the line.
        Parameters:
        limit - the required limit
        Returns:
        a double according to how close the match is. Less is better, with 1.0 as a reasonable cut-off point to ignore the line
      • getOptimised

        public java.lang.String getOptimised()
        Gets the optimised query (minus the LIMIT and OFFSET) from this cache line.
        Returns:
        the optimised query
      • getOriginal

        public java.lang.String getOriginal()
        Returns the original SQL string.
        Returns:
        the original SQL string