public abstract class AggregationFunction extends java.lang.Object implements DistanceFunction<MetaObject>, java.io.Serializable
Constructor and Description |
---|
AggregationFunction() |
Modifier and Type | Method and Description |
---|---|
abstract float |
compute(float... distances)
Computes the value of the aggregate distance from the provided sub-distances.
|
float |
getDistance(MetaObject object1,
MetaObject object2)
Computes distance of two meta objects using this combination function.
|
float |
getDistance(MetaObject object1,
MetaObject object2,
float[] descriptorDistances)
Computes distance of two meta objects using this combination function.
|
java.lang.Class<? extends MetaObject> |
getDistanceObjectClass()
Returns the type of objects that this distance function accepts as arguments.
|
static java.lang.Class<? extends AggregationFunction> |
getFactoryClass()
Returns the class currently set for the factory method
valueOf(java.lang.String) . |
abstract int |
getParameterCount()
Returns the number of distance parameters (i.e. the descriptor names) for the
compute(float...) function. |
float |
getParameterMaximalDistance(int parameterIndex)
Returns the maximal distance for the specified parameter of the
compute(float...) function. |
abstract java.lang.String |
getParameterName(int index)
Returns the name of the
index th distance parameter (i.e. the descriptor name) for the compute(float...) function. |
static void |
setFactoryClass(java.lang.Class<? extends AggregationFunction> factoryClass)
Sets the class created by factory method
valueOf(java.lang.String) . |
static AggregationFunction |
valueOf(java.lang.String string)
Factory method for creating threshold functions from strings.
|
public abstract int getParameterCount()
compute(float...)
function.compute(float...)
functionpublic abstract java.lang.String getParameterName(int index) throws java.lang.IndexOutOfBoundsException
index
th distance parameter (i.e. the descriptor name) for the compute(float...)
function.index
- the index of the parameter for which to get the nameindex
th distance parameter (i.e. the descriptor name) for the compute(float...)
functionjava.lang.IndexOutOfBoundsException
- if the index is smaller than zero or greater than or equal to getParameterCount()
public float getParameterMaximalDistance(int parameterIndex) throws java.lang.IndexOutOfBoundsException
compute(float...)
function.
This method returns the LocalAbstractObject.MAX_DISTANCE
by default.parameterIndex
- the index of a parameter (corresponds to the index of the
parameter name as given by getParameterName(int)
)compute(float...)
functionjava.lang.IndexOutOfBoundsException
- if the specified parameter index is not validpublic abstract float compute(float... distances)
distances
array items must correspond with the parameter
names as returned by getParameterName(int)
.distances
- the distances in respective descriptorspublic float getDistance(MetaObject object1, MetaObject object2, float[] descriptorDistances)
descriptorDistances
- array that will be filled with distances of the respective sub-distances;
i.e. the distance between object1.getObject(parameterName[0]) and object2.getObject(parameterName[0])
will be stored in the first array component, etc.object1
- the one meta object to compute distance forobject2
- the other meta object to compute distance forpublic float getDistance(MetaObject object1, MetaObject object2)
getDistance
in interface DistanceFunction<MetaObject>
object1
- the one meta object to compute distance forobject2
- the other meta object to compute distance forpublic java.lang.Class<? extends MetaObject> getDistanceObjectClass()
DistanceFunction
getDistanceObjectClass
in interface DistanceFunction<MetaObject>
public static AggregationFunction valueOf(java.lang.String string) throws java.lang.NoSuchMethodException, java.lang.reflect.InvocationTargetException
string
- the threshold function (using standard expression syntax)AggregationFunction
java.lang.NoSuchMethodException
- if there is no threshold function class set by setFactoryClass(java.lang.Class<? extends messif.objects.util.AggregationFunction>)
yetjava.lang.reflect.InvocationTargetException
- if the parsing of the threshold function has thrown an exceptionpublic static void setFactoryClass(java.lang.Class<? extends AggregationFunction> factoryClass) throws java.lang.NoSuchMethodException
valueOf(java.lang.String)
.factoryClass
- the new class for factory methodjava.lang.NoSuchMethodException
- if the specified class is abstract or lacks a public constructor with one String
argumentpublic static java.lang.Class<? extends AggregationFunction> getFactoryClass()
valueOf(java.lang.String)
.valueOf(java.lang.String)