Class ModelTaskProcessedResults
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.api.model.postprocessing.ModelTaskProcessedResults
-
public class ModelTaskProcessedResults extends java.lang.Object
Processed results for a task (for a single IDetector instance)Each file in this should be scored for its performance only in this task
-
-
Constructor Summary
Constructors Constructor Description ModelTaskProcessedResults()
default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ICodeBlockGroup
addGroup()
Creates a new ICodeBlockGroup instance, adds it to the results list and returns itboolean
cleanGroups()
Remove empty groups from the list, or ones with an unknown detection typeint
getFileTotal(ISourceFile file)
Returns the scoring total for the file passed, by default this is the total number of lines in the file.java.util.List<ICodeBlockGroup>
getGroups()
Gets theICodeBlockGroup
instances in this resultjava.util.List<ICodeBlockGroup>
getGroups(ISourceFile file)
Fetches a list of groups containing the passed filejava.util.List<ICodeBlockGroup>
getGroups(ISourceFile file1, ISourceFile file2)
Fetches a list of groups containing the passed filesvoid
removeGroup(ICodeBlockGroup group)
Remove a group from the list of groupsvoid
setFileTotals(java.util.Map<ISourceFile,java.lang.Integer> totalsMap)
Set the file to integer map for the scoring totals, which are used to calculate the percentage of a file taken by each block, for example this is set to the number of variables in a file for the variable detector to score against this.
-
-
-
Method Detail
-
addGroup
public ICodeBlockGroup addGroup()
Creates a new ICodeBlockGroup instance, adds it to the results list and returns it- Returns:
- the new instance
-
cleanGroups
public boolean cleanGroups() throws UnknownDetectionTypeException
Remove empty groups from the list, or ones with an unknown detection type- Returns:
- returns true if one of the groups does not have a detection type set
- Throws:
UnknownDetectionTypeException
- detection type is not registered
-
getFileTotal
public int getFileTotal(ISourceFile file)
Returns the scoring total for the file passed, by default this is the total number of lines in the file. Can be set to a custom value via the totals map if appropriate- Parameters:
file
- the file to get total for- Returns:
- the total used for scoring
-
getGroups
public java.util.List<ICodeBlockGroup> getGroups(ISourceFile file1, ISourceFile file2)
Fetches a list of groups containing the passed files- Parameters:
file1
- file present in all groupsfile2
- file present in all groups- Returns:
- list of groups
-
getGroups
public java.util.List<ICodeBlockGroup> getGroups()
Gets theICodeBlockGroup
instances in this result- Returns:
- the final list of
ICodeBlockGroup
produced by the task
-
getGroups
public java.util.List<ICodeBlockGroup> getGroups(ISourceFile file)
Fetches a list of groups containing the passed file- Parameters:
file
- file present in all groups- Returns:
- list of groups
-
removeGroup
public void removeGroup(ICodeBlockGroup group)
Remove a group from the list of groups- Parameters:
group
- group to remove
-
setFileTotals
public void setFileTotals(java.util.Map<ISourceFile,java.lang.Integer> totalsMap)
Set the file to integer map for the scoring totals, which are used to calculate the percentage of a file taken by each block, for example this is set to the number of variables in a file for the variable detector to score against this.By default the total is set to the line count for a file
- Parameters:
totalsMap
- the mapping to use instead of the default.
-
-