Class 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

    • 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 it
      boolean cleanGroups()
      Remove empty groups from the list, or ones with an unknown detection type
      int 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 the ICodeBlockGroup instances in this result
      java.util.List<ICodeBlockGroup> getGroups​(ISourceFile file)
      Fetches a list of groups containing the passed file
      java.util.List<ICodeBlockGroup> getGroups​(ISourceFile file1, ISourceFile file2)
      Fetches a list of groups containing the passed files
      void removeGroup​(ICodeBlockGroup group)
      Remove a group from the list of groups
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ModelTaskProcessedResults

        public ModelTaskProcessedResults()
        default constructor
    • 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 groups
        file2 - file present in all groups
        Returns:
        list of groups
      • 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.