org.hd.d.pg2k.webSvr.exhibit
Class SimpleSimilarExhibitFinder

java.lang.Object
  extended by org.hd.d.pg2k.webSvr.exhibit.SimpleSimilarExhibitFinder

public final class SimpleSimilarExhibitFinder
extends java.lang.Object

A simple fast mechanism to collect "similar" exhibits to a named one. Can be used in a catalogue page to find similar exhibits quickly (in a CPU-efficient way), possibly (when the site is busy) as an alternative to the more general default search.


Field Summary
private static Name.ExhibitFull[] NO_RESULTS
          Fixed empty result object.
 
Constructor Summary
SimpleSimilarExhibitFinder()
           
 
Method Summary
static Name.ExhibitFull[] getSimpleSimilarExhibitList(java.util.List<Name.ExhibitFull> exhibits, java.util.Comparator<? super Name.ExhibitFull> exhibitComparator, Name.ExhibitFull exhibitName, java.util.Set<java.lang.String> attrWords, int maxResults)
          Deprecated. slow and not very smart
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_RESULTS

private static final Name.ExhibitFull[] NO_RESULTS
Fixed empty result object.

Constructor Detail

SimpleSimilarExhibitFinder

public SimpleSimilarExhibitFinder()
Method Detail

getSimpleSimilarExhibitList

@Deprecated
public static Name.ExhibitFull[] getSimpleSimilarExhibitList(java.util.List<Name.ExhibitFull> exhibits,
                                                                        java.util.Comparator<? super Name.ExhibitFull> exhibitComparator,
                                                                        Name.ExhibitFull exhibitName,
                                                                        java.util.Set<java.lang.String> attrWords,
                                                                        int maxResults)
Deprecated. slow and not very smart

Quickly returns a set of exhibits (full names) similar to the named exhibit (passed by full name); never null. This should be constructed with a sorted List of exhibits (full names) and an exhibit that exists in that list.

The sort order should probably be SMART_ORDER or something similar, eg case-insensitively by the first "main" word in the name (ignoring the directory component).

This will then return a list of exhibits adjacent in the original named exhibit that has the first main word (matched case-insensitively) but not including any variant of the original exhibit and no more than one variant of any of the returned names.

A maximum number of results is specified, and a list no longer than this will be returned.

This is designed to be CPU efficient yet return a useful set of results.

Results in same order as original list.

This is designed to be efficient generating a small number of results (eg less than ten).

This attempts to be reasonably unbiased in terms of direction.

Parameters:
exhibits - list of full exhibit names sorted with the exhibitComparator; not modified by the routine
exhibitComparator - exhibits must be sorted with this
exhibitName - full name of main exhibit; must be in exhibits list and neither it nor any variant will appear in the output
attrWords - set of all valid attribute words
maxResults - maximum number if results to return

DHD Multimedia Gallery V1.60.69

Copyright (c) 1996-2012, Damon Hart-Davis. All rights reserved.