Class DuplicateInfo


  • public class DuplicateInfo
    extends Object
    Concrete duplicate. Encapsulates duplicate metrics such as duplicate hash, duplicate cost (duplicate code complexity which is defined by the amount of statements, expressions, declarations and method calls) and duplicating code fragments
    Since:
    6.0
    • Constructor Detail

      • DuplicateInfo

        public DuplicateInfo​(int hash,
                             int cost,
                             DuplicateInfo.Fragment[] fragments)
        Creates a duplicate with specified hash, cost and fragments. Hash is used for quick statistics calculation. Cost defines the complexity of the source code which is actually the amount of statements, expressions, declarations and method calls. Summarized costs of all these elements of the source code fragment yield the total complexity.
        Parameters:
        hash - duplicate hash
        cost - defines the complexity of the source code
        fragments - specific fragment
    • Method Detail

      • getMetrics

        public DuplicateInfo.DuplicateMetrics getMetrics()
        Gets the current duplicates metrics which are hash, cost and density
        Returns:
        duplicate metrics
      • getFragments

        public DuplicateInfo.Fragment[] getFragments()
        Gets the current duplicates code fragments
        Returns:
        code fragments
      • getHash

        public int getHash()
        Gets the current duplicates hash
        Returns:
        hash
      • getCost

        public int getCost()
        Gets the current duplicates cost
        Returns:
        cost
      • getDensity

        public int getDensity()
        Gets the current duplicates density
        Returns:
        density
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object