Class DuplicationGroup

  • All Implemented Interfaces:
    Serializable

    public final class DuplicationGroup
    extends Object
    implements Serializable
    Links all affected files of a duplicated code fragment. A code duplication could be reported by a code duplication detector like CPD, DupFinder, or Simian.
    See Also:
    Serialized Form
    • Constructor Detail

      • DuplicationGroup

        public DuplicationGroup​(@CheckForNull
                                String codeFragment)
        Creates a new duplication group for the specified code fragment.
        Parameters:
        codeFragment - the copied code fragment
      • DuplicationGroup

        public DuplicationGroup()
        Creates a new duplication group. The code fragment is not set and should be set using add(Issue).
    • Method Detail

      • setCodeFragment

        public void setCodeFragment​(@CheckForNull
                                    String codeFragment)
        Sets the code fragment of the duplication group. Once this value has been set to a non-empty value it will not change again.
        Parameters:
        codeFragment - the copied code fragment
      • add

        public void add​(Issue issue)
        Adds the specified duplication (represented by an Issue instance) to this group of duplications.
        Parameters:
        issue - the issues that references the position of the duplicated code fragment
      • getCodeFragment

        public String getCodeFragment()
        Returns the code fragment that has been duplicated by all members of this group.
        Returns:
        the duplicated code fragment
      • getDuplications

        public List<Issue> getDuplications()
      • equals

        public boolean equals​(@CheckForNull
                              Object o)
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object