Class EntityCodeBlockGroup
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.engine.storage.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 Summary
Constructors Constructor Description EntityCodeBlockGroup()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCodeBlock(ISourceFile file, float score, java.util.List<ITuple<java.lang.Integer,java.lang.Integer>> lines)Adds a code block to the groupvoidaddCodeBlock(ISourceFile file, float score, ITuple<java.lang.Integer,java.lang.Integer> line)Adds a code block to the groupbooleanfilePresent(ISourceFile file)Tests whether a passed file is included in the groupICodeBlockgetCodeBlock(ISourceFile file)return the block of code for a specific filejava.util.List<? extends ICodeBlock>getCodeBlocks()java.lang.StringgetComment()DetectionTypegetDetectionType()booleanisPopulated()Check whether the group covers at least two filesvoidsetComment(java.lang.String comment)Set the comment string for this blockvoidsetDetectionType(java.lang.String detectionTypeIdentifier)Set the detection type for this blockbooleansubmissionIdPresent(long submissionId)Tests whether any files in the group belong to the specified submission
-
-
-
Method Detail
-
addCodeBlock
public void addCodeBlock(ISourceFile file, float score, ITuple<java.lang.Integer,java.lang.Integer> line)
Description copied from interface:ICodeBlockGroupAdds a code block to the group- Specified by:
addCodeBlockin interfaceICodeBlockGroup- Parameters:
file- File containing the blockscore- score (0 to 1) of the block within the group, eg: 1 means block exactly matches the other blocks in the groupline- 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:ICodeBlockGroupAdds a code block to the group- Specified by:
addCodeBlockin interfaceICodeBlockGroup- Parameters:
file- File containing the blockscore- score (0 to 1) of the block within the group, eg: 1 means block exactly matches the other blocks in the grouplines- 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:ICodeBlockGroupTests whether a passed file is included in the group- Specified by:
filePresentin interfaceICodeBlockGroup- Parameters:
file- file to test- Returns:
- is the file present?
-
submissionIdPresent
public boolean submissionIdPresent(long submissionId)
Description copied from interface:ICodeBlockGroupTests whether any files in the group belong to the specified submission- Specified by:
submissionIdPresentin interfaceICodeBlockGroup- Parameters:
submissionId- the ID of the submission to test- Returns:
- true if there is such a file, false otherwise
-
getCodeBlock
public ICodeBlock getCodeBlock(ISourceFile file)
Description copied from interface:ICodeBlockGroupreturn the block of code for a specific file- Specified by:
getCodeBlockin interfaceICodeBlockGroup- Parameters:
file- file to search- Returns:
- the files blocks
-
getCodeBlocks
public java.util.List<? extends ICodeBlock> getCodeBlocks()
- Specified by:
getCodeBlocksin interfaceICodeBlockGroup- Returns:
- the blocks of code that were flagged as similar
-
getComment
public java.lang.String getComment()
- Specified by:
getCommentin interfaceICodeBlockGroup- Returns:
- extra string comment or detail regarding this code block
-
setComment
public void setComment(java.lang.String comment)
Description copied from interface:ICodeBlockGroupSet the comment string for this block- Specified by:
setCommentin interfaceICodeBlockGroup- Parameters:
comment- string
-
getDetectionType
public DetectionType getDetectionType() throws UnknownDetectionTypeException
- Specified by:
getDetectionTypein interfaceICodeBlockGroup- Returns:
- the type of plagiarism that was detected for these blocks of code
- Throws:
UnknownDetectionTypeException- thrown if the stored identifier is not registered in the current session
-
setDetectionType
public void setDetectionType(java.lang.String detectionTypeIdentifier) throws UnknownDetectionTypeExceptionDescription copied from interface:ICodeBlockGroupSet the detection type for this block- Specified by:
setDetectionTypein interfaceICodeBlockGroup- Parameters:
detectionTypeIdentifier- detection type- Throws:
UnknownDetectionTypeException- thrown if the passed identifier is not registered in the current session
-
isPopulated
public boolean isPopulated()
Description copied from interface:ICodeBlockGroupCheck whether the group covers at least two files- Specified by:
isPopulatedin interfaceICodeBlockGroup- Returns:
- isPopulated
-
-