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 void
addCodeBlock(ISourceFile file, float score, java.util.List<ITuple<java.lang.Integer,java.lang.Integer>> lines)
Adds a code block to the groupvoid
addCodeBlock(ISourceFile file, float score, ITuple<java.lang.Integer,java.lang.Integer> line)
Adds a code block to the groupboolean
filePresent(ISourceFile file)
Tests whether a passed file is included in the groupICodeBlock
getCodeBlock(ISourceFile file)
return the block of code for a specific filejava.util.List<? extends ICodeBlock>
getCodeBlocks()
java.lang.String
getComment()
DetectionType
getDetectionType()
boolean
isPopulated()
Check whether the group covers at least two filesvoid
setComment(java.lang.String comment)
Set the comment string for this blockvoid
setDetectionType(java.lang.String detectionTypeIdentifier)
Set the detection type for this blockboolean
submissionIdPresent(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:ICodeBlockGroup
Adds a code block to the group- Specified by:
addCodeBlock
in 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:ICodeBlockGroup
Adds a code block to the group- Specified by:
addCodeBlock
in 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:ICodeBlockGroup
Tests whether a passed file is included in the group- Specified by:
filePresent
in interfaceICodeBlockGroup
- 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 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:ICodeBlockGroup
return the block of code for a specific file- Specified by:
getCodeBlock
in interfaceICodeBlockGroup
- Parameters:
file
- file to search- Returns:
- the files blocks
-
getCodeBlocks
public java.util.List<? extends ICodeBlock> getCodeBlocks()
- Specified by:
getCodeBlocks
in interfaceICodeBlockGroup
- Returns:
- the blocks of code that were flagged as similar
-
getComment
public java.lang.String getComment()
- Specified by:
getComment
in interfaceICodeBlockGroup
- 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 interfaceICodeBlockGroup
- Parameters:
comment
- string
-
getDetectionType
public DetectionType getDetectionType() throws UnknownDetectionTypeException
- Specified by:
getDetectionType
in 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 UnknownDetectionTypeException
Description copied from interface:ICodeBlockGroup
Set the detection type for this block- Specified by:
setDetectionType
in 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:ICodeBlockGroup
Check whether the group covers at least two files- Specified by:
isPopulated
in interfaceICodeBlockGroup
- Returns:
- isPopulated
-
-