Class EntityCodeBlockGroup

  • All Implemented Interfaces:
    java.io.Serializable, ICodeBlockGroup

    @Entity(name="CodeBlockGroup")
    public class EntityCodeBlockGroup
    extends java.lang.Object
    implements ICodeBlockGroup, java.io.Serializable
    ICodeBlockGroup object for base storage implementation
    See Also:
    Serialized Form
    • Constructor Detail

      • EntityCodeBlockGroup

        public EntityCodeBlockGroup()
    • Method Detail

      • addCodeBlock

        public void addCodeBlock​(ISourceFile file,
                                 float score,
                                 ITuple<java.lang.Integer,​java.lang.Integer> line)
        Description copied from interface: ICodeBlockGroup
        Adds a code block to the group
        Specified by:
        addCodeBlock in interface ICodeBlockGroup
        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

        public void addCodeBlock​(ISourceFile file,
                                 float score,
                                 java.util.List<ITuple<java.lang.Integer,​java.lang.Integer>> lines)
        Description copied from interface: ICodeBlockGroup
        Adds a code block to the group
        Specified by:
        addCodeBlock in interface ICodeBlockGroup
        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

        public boolean filePresent​(ISourceFile file)
        Description copied from interface: ICodeBlockGroup
        Tests whether a passed file is included in the group
        Specified by:
        filePresent in interface ICodeBlockGroup
        Parameters:
        file - file to test
        Returns:
        is the file present?
      • submissionIdPresent

        public boolean submissionIdPresent​(long submissionId)
        Description copied from interface: ICodeBlockGroup
        Tests whether any files in the group belong to the specified submission
        Specified by:
        submissionIdPresent in interface ICodeBlockGroup
        Parameters:
        submissionId - the ID of the submission to test
        Returns:
        true if there is such a file, false otherwise
      • getCodeBlocks

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

        public java.lang.String getComment()
        Specified by:
        getComment in interface ICodeBlockGroup
        Returns:
        extra string comment or detail regarding this code block
      • setComment

        public void setComment​(java.lang.String comment)
        Description copied from interface: ICodeBlockGroup
        Set the comment string for this block
        Specified by:
        setComment in interface ICodeBlockGroup
        Parameters:
        comment - string
      • isPopulated

        public boolean isPopulated()
        Description copied from interface: ICodeBlockGroup
        Check whether the group covers at least two files
        Specified by:
        isPopulated in interface ICodeBlockGroup
        Returns:
        isPopulated