Interface ICodeBlockGroup

  • All Known Implementing Classes:
    EntityCodeBlockGroup

    public interface ICodeBlockGroup
    An interface that connects multiple ICodeBlocks where plagiarism is detected between those files.
    • Method Detail

      • addCodeBlock

        void addCodeBlock​(ISourceFile file,
                          float score,
                          ITuple<java.lang.Integer,​java.lang.Integer> line)
        Adds a code block to the group
        Parameters:
        file - File containing the block
        score - score (0 to 1) of the block within the group, eg: 1 means block exactly matches the other blocks in the group
        line - Tuple containing the start and end line of the code block
      • addCodeBlock

        void addCodeBlock​(ISourceFile file,
                          float score,
                          java.util.List<ITuple<java.lang.Integer,​java.lang.Integer>> lines)
        Adds a code block to the group
        Parameters:
        file - File containing the block
        score - score (0 to 1) of the block within the group, eg: 1 means block exactly matches the other blocks in the group
        lines - list of tuples, each containing the start and end line of the code block, the block covers multiple groups of non-consecutive lines in this file
      • filePresent

        boolean filePresent​(ISourceFile file)
        Tests whether a passed file is included in the group
        Parameters:
        file - file to test
        Returns:
        is the file present?
      • submissionIdPresent

        boolean submissionIdPresent​(long submissionId)
        Tests whether any files in the group belong to the specified submission
        Parameters:
        submissionId - the ID of the submission to test
        Returns:
        true if there is such a file, false otherwise
      • getCodeBlock

        ICodeBlock getCodeBlock​(ISourceFile file)
        return the block of code for a specific file
        Parameters:
        file - file to search
        Returns:
        the files blocks
      • getCodeBlocks

        java.util.List<? extends ICodeBlock> getCodeBlocks()
        Returns:
        the blocks of code that were flagged as similar
      • getComment

        java.lang.String getComment()
        Returns:
        extra string comment or detail regarding this code block
      • setComment

        void setComment​(java.lang.String comment)
        Set the comment string for this block
        Parameters:
        comment - string
      • setDetectionType

        void setDetectionType​(java.lang.String detectionTypeIdentifier)
                       throws UnknownDetectionTypeException
        Set the detection type for this block
        Parameters:
        detectionTypeIdentifier - detection type
        Throws:
        UnknownDetectionTypeException - thrown if the passed identifier is not registered in the current session
      • isPopulated

        boolean isPopulated()
        Check whether the group covers at least two files
        Returns:
        isPopulated