Package edu.hm.hafner.analysis
Class DuplicationGroup
- java.lang.Object
-
- edu.hm.hafner.analysis.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 Summary
Constructors Constructor Description DuplicationGroup()Creates a new duplication group.DuplicationGroup(String codeFragment)Creates a new duplication group for the specified code fragment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Issue issue)Adds the specified duplication (represented by anIssueinstance) to this group of duplications.booleanequals(Object o)StringgetCodeFragment()Returns the code fragment that has been duplicated by all members of this group.List<Issue>getDuplications()inthashCode()voidsetCodeFragment(String codeFragment)Sets the code fragment of the duplication group.
-
-
-
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 usingadd(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 anIssueinstance) 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
-
-