Class SimilarityImpl
java.lang.Object
de.uni_trier.wi2.procake.similarity.impl.SimilarityImpl
- All Implemented Interfaces:
Similarity
,Comparable<Similarity>
- Direct Known Subclasses:
DependencySimilarityImpl
- Author:
- Rainer Maximini
-
Field Summary
Fields inherited from interface de.uni_trier.wi2.procake.similarity.Similarity
VALUE_INVALID
-
Constructor Summary
ConstructorDescriptionSimilarityImpl
(SimilarityMeasure similarityMeasure, DataObject queryObject, DataObject caseObject) Creates a similarity object with an invalid similarity value.SimilarityImpl
(SimilarityMeasure similarityMeasure, DataObject queryObject, DataObject caseObject, double value) Creates a similarity object with based on a given similarity value.SimilarityImpl
(SimilarityMeasure similarityMeasure, DataObject queryObject, DataObject caseObject, double value, ArrayList<Similarity> localSimilarities) Creates a similarity object with based on a given similarity value.SimilarityImpl
(SimilarityMeasure similarityMeasure, DataObject queryObject, DataObject caseObject, double value, ArrayList<Similarity> localSimilarities, Object info) Creates a similarity object with based on a given similarity value. -
Method Summary
Modifier and TypeMethodDescriptionint
void
filterLocalSimilarities
(double value) Recursively filters all local similarities of the given value.long
getInfo()
This method returns a list of all the local similarities that contribute to the overall similarity value.getLocalSimilarity
(DataObject queryObject, DataObject caseObject) Recursively searches for the local similarity of the given query and case objectdouble
getValue()
int
hashCode()
Returns a hash code for thisDouble
object.boolean
hasSameValueAsIn
(Similarity otherSimilarity) boolean
hasSameValueAsIn
(Object otherSimilarity) boolean
isLessThan
(Similarity otherSimilarity) boolean
void
pruneLocalSimilarities
(int depth) Prunes the tree of local similarities to the given depth.void
Removes all local similarities with a null mapping, i.e., where a query object could not be mapped to a case object and thus is mapped to null.void
setCaseObject
(DataObject caseObject) void
setComputationTimeNanos
(long computationTimeNanos) void
void
void
setLocalSimilarities
(ArrayList<Similarity> localSimilarities) void
setQueryObject
(DataObject queryObject) void
setSimilarityMeasure
(SimilarityMeasure similarityMeasure) void
setValue
(double value) void
Recursively sorts all local similarities in descending order.toString()
-
Constructor Details
-
SimilarityImpl
public SimilarityImpl(SimilarityMeasure similarityMeasure, DataObject queryObject, DataObject caseObject) Creates a similarity object with an invalid similarity value.- Parameters:
similarityMeasure
-queryObject
-caseObject
-
-
SimilarityImpl
public SimilarityImpl(SimilarityMeasure similarityMeasure, DataObject queryObject, DataObject caseObject, double value) Creates a similarity object with based on a given similarity value.- Parameters:
similarityMeasure
-queryObject
-caseObject
-value
-
-
SimilarityImpl
public SimilarityImpl(SimilarityMeasure similarityMeasure, DataObject queryObject, DataObject caseObject, double value, ArrayList<Similarity> localSimilarities) Creates a similarity object with based on a given similarity value.- Parameters:
similarityMeasure
-queryObject
-caseObject
-value
-localSimilarities
-
-
SimilarityImpl
public SimilarityImpl(SimilarityMeasure similarityMeasure, DataObject queryObject, DataObject caseObject, double value, ArrayList<Similarity> localSimilarities, Object info) Creates a similarity object with based on a given similarity value.- Parameters:
similarityMeasure
-queryObject
-caseObject
-value
-localSimilarities
-info
-
-
-
Method Details
-
hasSameValueAsIn
-
hasSameValueAsIn
- Specified by:
hasSameValueAsIn
in interfaceSimilarity
- Returns:
-
getValue
public double getValue()- Specified by:
getValue
in interfaceSimilarity
- Returns:
- a double value between 0 and 1
-
setValue
public void setValue(double value) -
hashCode
public int hashCode()Returns a hash code for thisDouble
object. The result is the exclusive OR of the two halves of thelong
integer bit representation, exactly as produced by the methodDouble.doubleToLongBits(double)
, of the primitivedouble
value represented by thisDouble
object. That is, the hash code is the value of the expression:(int) (v ˆ (v >>> 32))
where
v
is defined by:long v = Double.doubleToLongBits(this.doubleValue());
-
isLessThan
- Specified by:
isLessThan
in interfaceSimilarity
- Returns:
- true if this similarity is valid, the other similarity is valid, and this similarity value is less than the other similarity value.
-
isValidValue
public boolean isValidValue()- Specified by:
isValidValue
in interfaceSimilarity
- Returns:
- true if the computation was successful and a correct value between 0 and 1 will be returned by getValue()
-
setInvalidValue
public void setInvalidValue() -
toString
-
toDetailedString
- Specified by:
toDetailedString
in interfaceSimilarity
- Returns:
- detailed string representation
-
getQueryObject
- Specified by:
getQueryObject
in interfaceSimilarity
- Returns:
- query element
-
setQueryObject
-
getCaseObject
- Specified by:
getCaseObject
in interfaceSimilarity
- Returns:
- case element
-
setCaseObject
-
getLocalSimilarities
Description copied from interface:Similarity
This method returns a list of all the local similarities that contribute to the overall similarity value.- Specified by:
getLocalSimilarities
in interfaceSimilarity
- Returns:
- a
<Similarity>
of local similarities
-
setLocalSimilarities
-
filterLocalSimilarities
public void filterLocalSimilarities(double value) Description copied from interface:Similarity
Recursively filters all local similarities of the given value.- Specified by:
filterLocalSimilarities
in interfaceSimilarity
-
removeLocalSimilaritiesWithNullMapping
public void removeLocalSimilaritiesWithNullMapping()Description copied from interface:Similarity
Removes all local similarities with a null mapping, i.e., where a query object could not be mapped to a case object and thus is mapped to null. Usually, the local similarity is 0.0 in this case.- Specified by:
removeLocalSimilaritiesWithNullMapping
in interfaceSimilarity
-
sortLocalSimilarities
public void sortLocalSimilarities()Description copied from interface:Similarity
Recursively sorts all local similarities in descending order.- Specified by:
sortLocalSimilarities
in interfaceSimilarity
-
getLocalSimilarity
Description copied from interface:Similarity
Recursively searches for the local similarity of the given query and case object- Specified by:
getLocalSimilarity
in interfaceSimilarity
- Parameters:
queryObject
- querycaseObject
- case- Returns:
- local similarity of the given objects
-
pruneLocalSimilarities
public void pruneLocalSimilarities(int depth) Description copied from interface:Similarity
Prunes the tree of local similarities to the given depth.- Specified by:
pruneLocalSimilarities
in interfaceSimilarity
-
getSimilarityMeasure
- Specified by:
getSimilarityMeasure
in interfaceSimilarity
- Returns:
- similarity measure
-
setSimilarityMeasure
-
getInfo
- Specified by:
getInfo
in interfaceSimilarity
- Returns:
- further infos
-
setInfo
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Similarity>
-
getComputationTimeNanos
public long getComputationTimeNanos()- Specified by:
getComputationTimeNanos
in interfaceSimilarity
- Returns:
- computation time of this similarity in nanoseconds
-
setComputationTimeNanos
public void setComputationTimeNanos(long computationTimeNanos)
-