Class SimilarityImpl

java.lang.Object
de.uni_trier.wi2.procake.similarity.impl.SimilarityImpl
All Implemented Interfaces:
Similarity, Comparable<Similarity>
Direct Known Subclasses:
DependencySimilarityImpl

public class SimilarityImpl extends Object implements Similarity
Author:
Rainer Maximini
  • 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

      public boolean hasSameValueAsIn(Object otherSimilarity)
    • hasSameValueAsIn

      public boolean hasSameValueAsIn(Similarity otherSimilarity)
      Specified by:
      hasSameValueAsIn in interface Similarity
      Returns:
    • getValue

      public double getValue()
      Specified by:
      getValue in interface Similarity
      Returns:
      a double value between 0 and 1
    • setValue

      public void setValue(double value)
    • hashCode

      public int hashCode()
      Returns a hash code for this Double object. The result is the exclusive OR of the two halves of the long integer bit representation, exactly as produced by the method Double.doubleToLongBits(double), of the primitive double value represented by this Double 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());
       
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object.
    • isLessThan

      public boolean isLessThan(Similarity otherSimilarity)
      Specified by:
      isLessThan in interface Similarity
      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 interface Similarity
      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

      public String toString()
      Overrides:
      toString in class Object
    • toDetailedString

      public String toDetailedString()
      Specified by:
      toDetailedString in interface Similarity
      Returns:
      detailed string representation
    • getQueryObject

      public DataObject getQueryObject()
      Specified by:
      getQueryObject in interface Similarity
      Returns:
      query element
    • setQueryObject

      public void setQueryObject(DataObject queryObject)
    • getCaseObject

      public DataObject getCaseObject()
      Specified by:
      getCaseObject in interface Similarity
      Returns:
      case element
    • setCaseObject

      public void setCaseObject(DataObject caseObject)
    • getLocalSimilarities

      public List<Similarity> 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 interface Similarity
      Returns:
      a <Similarity> of local similarities
    • setLocalSimilarities

      public void setLocalSimilarities(ArrayList<Similarity> localSimilarities)
    • filterLocalSimilarities

      public void filterLocalSimilarities(double value)
      Description copied from interface: Similarity
      Recursively filters all local similarities of the given value.
      Specified by:
      filterLocalSimilarities in interface Similarity
    • 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 interface Similarity
    • sortLocalSimilarities

      public void sortLocalSimilarities()
      Description copied from interface: Similarity
      Recursively sorts all local similarities in descending order.
      Specified by:
      sortLocalSimilarities in interface Similarity
    • getLocalSimilarity

      public Similarity getLocalSimilarity(DataObject queryObject, DataObject caseObject)
      Description copied from interface: Similarity
      Recursively searches for the local similarity of the given query and case object
      Specified by:
      getLocalSimilarity in interface Similarity
      Parameters:
      queryObject - query
      caseObject - 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 interface Similarity
    • getSimilarityMeasure

      public String getSimilarityMeasure()
      Specified by:
      getSimilarityMeasure in interface Similarity
      Returns:
      similarity measure
    • setSimilarityMeasure

      public void setSimilarityMeasure(SimilarityMeasure similarityMeasure)
    • getInfo

      public Object getInfo()
      Specified by:
      getInfo in interface Similarity
      Returns:
      further infos
    • setInfo

      public void setInfo(Object info)
    • compareTo

      public int compareTo(Similarity o)
      Specified by:
      compareTo in interface Comparable<Similarity>
    • getComputationTimeNanos

      public long getComputationTimeNanos()
      Specified by:
      getComputationTimeNanos in interface Similarity
      Returns:
      computation time of this similarity in nanoseconds
    • setComputationTimeNanos

      public void setComputationTimeNanos(long computationTimeNanos)