Class NGramRawResult<T extends java.io.Serializable>
- java.lang.Object
-
- uk.ac.warwick.dcs.sherlock.api.model.postprocessing.AbstractModelTaskRawResult
-
- uk.ac.warwick.dcs.sherlock.module.model.base.postprocessing.NGramRawResult<T>
-
- Type Parameters:
T
- N-Gram match object comparing similarity data between 2 code blocks
- All Implemented Interfaces:
java.io.Serializable
public class NGramRawResult<T extends java.io.Serializable> extends AbstractModelTaskRawResult
Stores the set of match objects for a pair of inputted files.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NGramRawResult(ISourceFile file1, ISourceFile file2)
Object constructor, saves the compared file ids, initialises interior lists as ArrayLists, and sets size to zero.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ISourceFile
getFile1()
Getter for ID of first file in comparison pair.ISourceFile
getFile2()
Getter for ID of second file in comparison pair.java.util.List<PairedTuple<java.lang.Integer,java.lang.Integer,java.lang.Integer,java.lang.Integer>>
getLocations()
Getter for the block location indexes in the order: File1 start, File1 end, File2 start, File2 end.java.util.List<T>
getObjects()
Get the list of match objects within the container.int
getSize()
Getter for the number of matches stored in the object.boolean
isEmpty()
Returns true if no matches in object, false otherwise.void
put(T object, int file1Loc, int file2Loc)
Method to store a matched block where both file blocks are a single line.void
put(T object, int file1BlockStart, int file1BlockEnd, int file2BlockStart, int file2BlockEnd)
Method to store a matched block.boolean
testType(AbstractModelTaskRawResult baseline)
Verifies that the inputted RawResult type is the same type as the current object.java.lang.String
toString()
Returns the string form of the list of stored objects along with their locations in their respective files.
-
-
-
Constructor Detail
-
NGramRawResult
public NGramRawResult(ISourceFile file1, ISourceFile file2)
Object constructor, saves the compared file ids, initialises interior lists as ArrayLists, and sets size to zero.- Parameters:
file1
- File ID of the first file in the compared pair.file2
- File ID of the second file in the compared pair.
-
-
Method Detail
-
getFile1
public ISourceFile getFile1()
Getter for ID of first file in comparison pair.- Returns:
- First ID.
-
getFile2
public ISourceFile getFile2()
Getter for ID of second file in comparison pair.- Returns:
- Second ID.
-
getLocations
public java.util.List<PairedTuple<java.lang.Integer,java.lang.Integer,java.lang.Integer,java.lang.Integer>> getLocations()
Getter for the block location indexes in the order: File1 start, File1 end, File2 start, File2 end.- Returns:
- Block location indexes.
-
getSize
public int getSize()
Getter for the number of matches stored in the object.- Returns:
- The number of matches stored in the object.
-
isEmpty
public boolean isEmpty()
Returns true if no matches in object, false otherwise.- Specified by:
isEmpty
in classAbstractModelTaskRawResult
- Returns:
- True if no matches in object, false otherwise.
-
put
public void put(T object, int file1Loc, int file2Loc)
Method to store a matched block where both file blocks are a single line.- Parameters:
object
- The mach object for the matched pair.file1Loc
- The line number of the File1 block.file2Loc
- The line number of the File2 block.
-
put
public void put(T object, int file1BlockStart, int file1BlockEnd, int file2BlockStart, int file2BlockEnd)
Method to store a matched block.- Parameters:
object
- The match object for the matched pair.file1BlockStart
- The start line of the block in File1.file1BlockEnd
- The end line of the block in File1.file2BlockStart
- The start line of the block in File2.file2BlockEnd
- The end line of the block in File2.
-
testType
public boolean testType(AbstractModelTaskRawResult baseline)
Verifies that the inputted RawResult type is the same type as the current object.- Specified by:
testType
in classAbstractModelTaskRawResult
- Parameters:
baseline
- the baseline object, in the set, current instance must be of the same exact type as this.- Returns:
- True if input is same object type as current object, false otherwise.
-
getObjects
public java.util.List<T> getObjects()
Get the list of match objects within the container.- Returns:
- The list of match objects within the container.
-
toString
public java.lang.String toString()
Returns the string form of the list of stored objects along with their locations in their respective files.- Overrides:
toString
in classjava.lang.Object
- Returns:
- The string form of the list of stored objects along with their locations in their respective files.
-
-