org.gcube.indexmanagement.geo.ranking
Class RankEvaluator

java.lang.Object
  extended by org.gcube.indexmanagement.geo.ranking.RankEvaluator
All Implemented Interfaces:
Comparator<DataWrapper>

public abstract class RankEvaluator
extends Object
implements Comparator<DataWrapper>

The base class for all RankEvaluators


Field Summary
protected  InclusionType containmentMethod
          The containment method used in the query
protected  GeoIndexType indexType
          The index type of the Index using this RankEvaluator
protected  Polygon polygon
          The query polygon
protected  com.vividsolutions.jts.geom.Envelope query
          The query Minimal Bounding Rectangle
protected  boolean reverseSort
          An indicator of whether the sorting should be reversed
 
Constructor Summary
RankEvaluator()
           
 
Method Summary
 int compare(DataWrapper data1, DataWrapper data2)
          
 void init(Polygon polygon, InclusionType containmentMethod, Boolean reverseSort, GeoIndexType indexType, String[] args)
          A method called by the GeoIndexResource after creating an instance of a RankEvaluator
protected abstract  void initialize(String[] args)
          The plugin specific initialization method.
abstract  boolean isIndexTypeCompatible(GeoIndexType indexType)
          A method used to check if this RankEvaluator plugin is compatible with indices/entries with a specific GeoIndexType
abstract  double rank(DataWrapper data)
          A method used to rank a GeoIndex entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

polygon

protected Polygon polygon
The query polygon


query

protected com.vividsolutions.jts.geom.Envelope query
The query Minimal Bounding Rectangle


indexType

protected GeoIndexType indexType
The index type of the Index using this RankEvaluator


containmentMethod

protected InclusionType containmentMethod
The containment method used in the query


reverseSort

protected boolean reverseSort
An indicator of whether the sorting should be reversed

Constructor Detail

RankEvaluator

public RankEvaluator()
Method Detail

compare

public final int compare(DataWrapper data1,
                         DataWrapper data2)

Specified by:
compare in interface Comparator<DataWrapper>

init

public final void init(Polygon polygon,
                       InclusionType containmentMethod,
                       Boolean reverseSort,
                       GeoIndexType indexType,
                       String[] args)
                throws RankEvaluatorInitializationException
A method called by the GeoIndexResource after creating an instance of a RankEvaluator

Parameters:
polygon - - A polygon representation of the original query of which this RankEvaluator will rank the results
containmentMethod - - The containment method used in the original query
reverseSort - - An indicator of whether the rank evaluator should sort the results in reverse
indexType - - The geo index type of the GeoIndex using this RankEvaluator
args - - Any additional plugin specific initialization arguments.
Throws:
RankEvaluatorInitializationException - - An error occurex while initializing the RankEvaluator

initialize

protected abstract void initialize(String[] args)
                            throws RankEvaluatorInitializationException
The plugin specific initialization method. Initializes an instance of a RankEvaluator plugin using an array of Strings. All other initialization methods have been completed when this method is called, so it can make use of any of the standard RankEvaluator instance variables.

Parameters:
args - - A plugin specific array of Strings used to initialize a RankEvaluator plugin.
Throws:
RankEvaluatorInitializationException - - An error occurex while initializing the RankEvaluator

isIndexTypeCompatible

public abstract boolean isIndexTypeCompatible(GeoIndexType indexType)
A method used to check if this RankEvaluator plugin is compatible with indices/entries with a specific GeoIndexType

Parameters:
indexType - - The GeoIndexType of which to check the compatability with this plugin
Returns:
TRUE if this RankEvaluator plugin is compatible with indices/entries with the specified GeoIndexType

rank

public abstract double rank(DataWrapper data)
A method used to rank a GeoIndex entry. A value between 0 and 1 is encouraged, but not obligatory.

Parameters:
data - - The GeoIndex entry to rank.
Returns:
the rank of the specified GeoIndex entry.


Copyright © 2012. All Rights Reserved.