Class RangeSubmissionPathPlanner<S extends VilleSubmissionFields>

java.lang.Object
studentrepoloader.filesystem.RangeSubmissionPathPlanner<S>
Type Parameters:
S - a subtype of VilleSubmissionFields
All Implemented Interfaces:
SubmissionPathPlanner<S>

public class RangeSubmissionPathPlanner<S extends VilleSubmissionFields> extends Object implements SubmissionPathPlanner<S>
Strategy that groups submissions under a directory named by the submission file and ID range.

For each submission, the target path is constructed as:

 {rootDir}/
 └── {parentFolderName}/
     └── {firstId}_{lastId}/
         └── {folderName}/
 

The parentFolderName is derived from the source CSV file name (e.g., "Assignment_1" for "Assignment_1.txt"). The ID range is determined from the lexicographic first and last IDs in the provided list. Each submission folder is determined by getFolderName(), typically encoding email, last name, and first name.

Example: Given a root directory clones/, a source file Assignment_1.txt, and the following submissions:

  • ID: aaadoc, Folder: aaadoc_Doe_Anna
  • ID: mmemax, Folder: mmemax_Maxwell_Mark
The resulting structure will be:
 clones/
 └── Assignment_1/
     └── aaadoc_mmemax/
         ├── aaadoc_Doe_Anna/
         └── mmemax_Maxwell_Mark/
 

If any two submissions produce the same output path, an IllegalStateException is thrown.

  • Constructor Details

    • RangeSubmissionPathPlanner

      public RangeSubmissionPathPlanner()
  • Method Details

    • planPaths

      public Map<S,Path> planPaths(List<S> submissions, Path rootDir)
      Description copied from interface: SubmissionPathPlanner
      Plans directory paths for the given submissions under the specified root directory.
      Specified by:
      planPaths in interface SubmissionPathPlanner<S extends VilleSubmissionFields>
      Parameters:
      submissions - the list of submissions to organize (assumed sorted as needed)
      rootDir - the root directory under which all submission folders will be created (e.g., "clones/")
      Returns:
      a map of each submission to its target Path under the root directory