org.hd.d.pg2k.svrCore
Interface ExhibitPropsComputableMutableVoteCacheIF

All Known Implementing Classes:
ExhibitPropsComputableMutableVoteCache

public interface ExhibitPropsComputableMutableVoteCacheIF

Interface for retrieving/calculating votes and correlations.


Field Summary
static ExhibitPropsComputableMutableVoteCacheIF TRIVIAL
          Trivial cache that doesn't actually cache anything, nor compute anything except the basic vote factor.
 
Method Summary
 ExhibitPropsComputableMutable.Factor calcVoteFactor(java.lang.String exhibitName, AllExhibitProperties aep, BasicVarMgrInterface vars)
          Compute exactly one Factor that depends on explicit user votes for the specified exhibit; never null.
 ExhibitPropsComputableMutable.Factor[] getCorrelates(ExhibitStaticAttr esa, AllExhibitProperties aep, BasicVarMgrInterface vars, boolean force)
          Get correlates for specified exhibit; never null but result may be empty.
 java.lang.Boolean isCategoryGood(java.lang.String categoryDir, AllExhibitProperties aep, BasicVarMgrInterface vars, boolean force)
          Find out if a category is rated "good"/popular or not.
 void update(AllExhibitProperties aep, BasicVarMgrInterface vars, boolean noTimeLimit)
          Bring correlations data up to date.
 

Field Detail

TRIVIAL

static final ExhibitPropsComputableMutableVoteCacheIF TRIVIAL
Trivial cache that doesn't actually cache anything, nor compute anything except the basic vote factor.

Method Detail

calcVoteFactor

ExhibitPropsComputableMutable.Factor calcVoteFactor(java.lang.String exhibitName,
                                                    AllExhibitProperties aep,
                                                    BasicVarMgrInterface vars)
                                                    throws java.io.IOException
Compute exactly one Factor that depends on explicit user votes for the specified exhibit; never null. Because we expect voting to be sparse, we total up votes across all sample intervals to reduce noise, rather than taking each sample separately, and do various other calculations a little differently to dense measures.

If this cannot fetch some of the data it requires due to an IOException (not the same as fetching data successfully that has no entries) then the exception is propagated to the caller. (Normally this results in the EPCM item for which this is called being marked stale so that we can try again when the data is available.)

This may cache values once computed for efficiency.

The returned factor's goodness can range from -1 to +1, and confidence from 0 to +1; any scaling required will have to be applied elsewhere.

Throws:
java.io.IOException - if this was unable to fetch some data required

getCorrelates

ExhibitPropsComputableMutable.Factor[] getCorrelates(ExhibitStaticAttr esa,
                                                     AllExhibitProperties aep,
                                                     BasicVarMgrInterface vars,
                                                     boolean force)
                                                     throws java.io.IOException
Get correlates for specified exhibit; never null but result may be empty. This is based on votes of other "related" exhibits and exhibit metadata.

The goodness of each Factor is either -1 or +1, with the correlation/confidence ranging between 0 and 1.

This will return values computed up to one period ago if need be, to help avoid a sudden splurge of CPU effort as we tick from one period to the next.

No particular ordering of the results is guaranteed, but there will be no duplicates and no nulls.

Parameters:
force - if true, force complete computation if need be, else we will just return what we have in cache; complete recomputation may be expensive but should last a long time and we will abort with an IOException if we cannot complete the recomputation in a reasonable time
Throws:
java.io.IOException - cannot extract required correlates

isCategoryGood

java.lang.Boolean isCategoryGood(java.lang.String categoryDir,
                                 AllExhibitProperties aep,
                                 BasicVarMgrInterface vars,
                                 boolean force)
                                 throws java.io.IOException
Find out if a category is rated "good"/popular or not. Returns TRUE if rated good, FALSE if bad, null if not significantly either or if not known.

Parameters:
categoryDir - the initial directory component of an extant exhibit
force - if true may force (expensive) computation to give a more accurate answer, else may return a more approximate or stale answer, or none at all (null)
Throws:
java.io.IOException

update

void update(AllExhibitProperties aep,
            BasicVarMgrInterface vars,
            boolean noTimeLimit)
            throws java.io.IOException
Bring correlations data up to date. This may also perform housekeeping such as clearing stale state.

This may be a relatively expensive call.

This is thread-safe, though calling from more than one thread at once may result in redundant work being performed.

Parameters:
aep - current exhibit properties; never null
vars - handle on system variables; never null
noTimeLimit - if true, this runs until complete if possible
Throws:
java.io.IOException

DHD Multimedia Gallery V1.50.55

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