Class FileMapper


  • public class FileMapper
    extends java.lang.Object
    Maps a set of files to the "line mapper" object which links each plagiarised line to a match
    • Constructor Summary

      Constructors 
      Constructor Description
      FileMapper​(java.util.Map<java.lang.String,​java.util.List<FileMatch>> matches)
      Initialise the file mapper
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getHighlightedLines​(long fileId)
      Get the list of plagiarised line numbers converted to a comma separated list for a specific file in the map e.g.
      org.json.JSONObject toJSON()
      Convert this object to a JSON object, used by the JavaScript in the UI
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileMapper

        public FileMapper​(java.util.Map<java.lang.String,​java.util.List<FileMatch>> matches)
                   throws MapperException
        Initialise the file mapper
        Parameters:
        matches - the list of matches to initialise with
        Throws:
        MapperException - if add match was called after fill
    • Method Detail

      • toJSON

        public org.json.JSONObject toJSON()
        Convert this object to a JSON object, used by the JavaScript in the UI
        Returns:
        the JSON equivalent of this object
      • getHighlightedLines

        public java.lang.String getHighlightedLines​(long fileId)
        Get the list of plagiarised line numbers converted to a comma separated list for a specific file in the map e.g. if lines 2-10 are mapped to a match, this would return "2,3,4,5,6,7,8,9,10"
        Parameters:
        fileId - the id of the file to get the highlighted lines for
        Returns:
        the comma separated list, or an empty list if the file isn't found