T
- the class of the encapsulated objectspublic class DistanceFunctionMetaSubobject<T> extends java.lang.Object implements DistanceFunction<MetaObject>, java.io.Serializable
DistanceFunction
that computes the distances on
encapsulated objects of the MetaObject
.Constructor and Description |
---|
DistanceFunctionMetaSubobject(java.lang.String subobjectName,
java.lang.Class<? extends T> subobjectClass,
DistanceFunction<? super T> subobjectDistanceFunction)
Creates a new instance of DistanceFunctionMetaSubobject.
|
DistanceFunctionMetaSubobject(java.lang.String subobjectName,
DistanceFunction<T> subobjectDistanceFunction)
Creates a new instance of DistanceFunctionMetaSubobject.
|
Modifier and Type | Method and Description |
---|---|
float |
getDistance(MetaObject o1,
MetaObject o2)
Returns the distance between object
o1 and object o2 . |
java.lang.Class<? extends MetaObject> |
getDistanceObjectClass()
Returns the type of objects that this distance function accepts as arguments.
|
protected T |
getSubobject(MetaObject metaObject)
Returns the encapsulated object for the distance function.
|
public DistanceFunctionMetaSubobject(java.lang.String subobjectName, java.lang.Class<? extends T> subobjectClass, DistanceFunction<? super T> subobjectDistanceFunction)
subobjectName
- the name of the encapsulated objects on which the wrapped distance is computedsubobjectClass
- the class of the encapsulated objects on which the wrapped distance is computedsubobjectDistanceFunction
- the wrapped distance function that computes the actual distancepublic DistanceFunctionMetaSubobject(java.lang.String subobjectName, DistanceFunction<T> subobjectDistanceFunction)
subobjectName
- the name of the encapsulated object on which the wrapped distance is computedsubobjectDistanceFunction
- the wrapped distance function that computes the actual distanceprotected T getSubobject(MetaObject metaObject) throws java.lang.ClassCastException
metaObject
- the meta object from which to get the encapsulated objectjava.lang.ClassCastException
- if the encapsulated object is not compatible with the subobjectDistanceFunction
public float getDistance(MetaObject o1, MetaObject o2) throws java.lang.ClassCastException
o1
and object o2
.getDistance
in interface DistanceFunction<MetaObject>
o1
- the object for which to measure the distanceo2
- the object for which to measure the distanceo1
and object o2
java.lang.ClassCastException
- if the encapsulated object is not compatible with the subobjectDistanceFunction
public java.lang.Class<? extends MetaObject> getDistanceObjectClass()
DistanceFunction
getDistanceObjectClass
in interface DistanceFunction<MetaObject>