viper.comparison.distances
Class Distances.HelperAttrDistance

java.lang.Object
  extended byviper.comparison.distances.Distances.HelperDistance
      extended byviper.comparison.distances.Distances.HelperAttrDistance
All Implemented Interfaces:
AttrDistance, Distance
Enclosing class:
Distances

public static class Distances.HelperAttrDistance
extends viper.comparison.distances.Distances.HelperDistance
implements AttrDistance

Converts one of the value distance function objects into a AttrDistance.


Field Summary
protected  Distances.QuickValueDistance dist
           
 
Fields inherited from interface viper.comparison.distances.Distance
BALANCED, CAND_V_TARGS, OVERALL_MEAN, OVERALL_SUM, TARG_V_CANDS
 
Constructor Summary
Distances.HelperAttrDistance(Distances.QuickValueDistance d, java.lang.String name, int type, java.lang.String explanation, boolean isDistance)
          Constructs a new measure distance from the given function object and parameters.
Distances.HelperAttrDistance(Distances.SmartValueDistance d, java.lang.String name, int type, java.lang.String explanation, boolean isDistance)
          Constructs a new measure distance from the given function object and parameters.
Distances.HelperAttrDistance(Distances.ValueDistance d, java.lang.String name, int type, java.lang.String explanation, boolean isDistance)
          Constructs a new measure distance from the given function object and parameters.
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.Number getDistance(Attribute alpha, FrameSpan alphaSpan, Attribute beta, FrameSpan betaSpan, Attribute blackout, FrameSpan blackoutSpan, Attribute ignore, FrameSpan ignoreSpan, int frame, CanonicalFileDescriptor cfd)
          Compute the distance, with blackout and ignore.
 java.lang.Number getDistance(Attribute alpha, FrameSpan alphaSpan, Attribute beta, FrameSpan betaSpan, int frame, CanonicalFileDescriptor cfd)
          Compute the distance.
 java.lang.Number getDistance(Measurable.Difference D)
          Gets the distance using cached distance data.
 java.lang.String getExplanation()
          An explanatory message, like "Pixels matched", or "Localized Object Count Recall".
 int getType()
          Get what type of metric this is, per the list of static int types.
 int hashCode()
           
 boolean isDistance()
          Determines if this is a distance or a similarity quotient.
 java.lang.String toString()
          Get the EPF name of the metric.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface viper.comparison.distances.Distance
getDistance, getExplanation, getType, isDistance, toString
 

Field Detail

dist

protected Distances.QuickValueDistance dist
Constructor Detail

Distances.HelperAttrDistance

public Distances.HelperAttrDistance(Distances.ValueDistance d,
                                    java.lang.String name,
                                    int type,
                                    java.lang.String explanation,
                                    boolean isDistance)
Constructs a new measure distance from the given function object and parameters.

Parameters:
d - the distance functor
name - the name of the distance metric
type - the category of distance, e.g. Distance.BALANCED
explanation - a long explanation of the distance, for helper documentation and verbose output
isDistance - determines if the distance is really a distance or if it is a score (bigger is better)

Distances.HelperAttrDistance

public Distances.HelperAttrDistance(Distances.SmartValueDistance d,
                                    java.lang.String name,
                                    int type,
                                    java.lang.String explanation,
                                    boolean isDistance)
Constructs a new measure distance from the given function object and parameters.

Parameters:
d - the distance functor
name - the name of the distance metric
type - the category of distance, e.g. Distance.BALANCED
explanation - a long explanation of the distance, for helper documentation and verbose output
isDistance - determines if the distance is really a distance or if it is a score (bigger is better)

Distances.HelperAttrDistance

public Distances.HelperAttrDistance(Distances.QuickValueDistance d,
                                    java.lang.String name,
                                    int type,
                                    java.lang.String explanation,
                                    boolean isDistance)
Constructs a new measure distance from the given function object and parameters.

Parameters:
d - the distance functor
name - the name of the distance metric
type - the category of distance, e.g. Distance.BALANCED
explanation - a long explanation of the distance, for helper documentation and verbose output
isDistance - determines if the distance is really a distance or if it is a score (bigger is better)
Method Detail

getDistance

public java.lang.Number getDistance(Attribute alpha,
                                    FrameSpan alphaSpan,
                                    Attribute beta,
                                    FrameSpan betaSpan,
                                    int frame,
                                    CanonicalFileDescriptor cfd)
Description copied from interface: AttrDistance
Compute the distance.

Specified by:
getDistance in interface AttrDistance
Parameters:
alpha - the alpha attribute
alphaSpan - the alpha attribute's span
beta - the beta attribute
betaSpan - the beta attribute's span
frame - the frame to get the distance in
cfd - the source media
Returns:
the distance

getDistance

public java.lang.Number getDistance(Attribute alpha,
                                    FrameSpan alphaSpan,
                                    Attribute beta,
                                    FrameSpan betaSpan,
                                    Attribute blackout,
                                    FrameSpan blackoutSpan,
                                    Attribute ignore,
                                    FrameSpan ignoreSpan,
                                    int frame,
                                    CanonicalFileDescriptor cfd)
                             throws IgnoredValueException
Description copied from interface: AttrDistance
Compute the distance, with blackout and ignore. Note that blackout and ignore may be set to null if there is nothing to black out or ignore.

Specified by:
getDistance in interface AttrDistance
Parameters:
alpha - the alpha attribute
alphaSpan - the alpha attribute's span
beta - the beta attribute
betaSpan - the beta attribute's span
blackout - the blackout region
blackoutSpan - the blackout region's span
ignore - the region to ignore
ignoreSpan - the ignored region's span
frame - the frame to get the distance in
cfd - the source media
Returns:
the distance, given the constraints
Throws:
IgnoredValueException - when the ignored region is such that it prevents evaluation of the distance.

getType

public int getType()
Description copied from interface: Distance
Get what type of metric this is, per the list of static int types.

Specified by:
getType in interface Distance
Returns:
one of BALANCED, CAND_V_TARGS, etc.

getExplanation

public java.lang.String getExplanation()
Description copied from interface: Distance
An explanatory message, like "Pixels matched", or "Localized Object Count Recall".

Specified by:
getExplanation in interface Distance
Returns:
this distance's explanatory message

toString

public java.lang.String toString()
Description copied from interface: Distance
Get the EPF name of the metric.

Specified by:
toString in interface Distance

getDistance

public java.lang.Number getDistance(Measurable.Difference D)
Description copied from interface: Distance
Gets the distance using cached distance data. Has two major benefits: possible consolidation of IgnoredValueExceptions and savings on recomputing, for example, the area of polygons. Calling getDistance (alpha, beta, blackout, ignore) should have the same effect as getDistance (alpha.getDifference (beta, blackout, ignore))

Specified by:
getDistance in interface Distance
Parameters:
D - the distance of the difference
Returns:
the distance

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object o)

isDistance

public boolean isDistance()
Description copied from interface: Distance
Determines if this is a distance or a similarity quotient. Similarity quotients are better the larger they are, but distances should be minimized.

Specified by:
isDistance in interface Distance
Returns:
true when 0 indicates a perfect match, and distance varies proportionally to difference