Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix author problem #230

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/main/java/seedu/duke/controllers/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ public void start() throws IOException {
saveStudentData(storage,student);
displayGoodbye();
}

//@@author SebasFok
/**
* Initializes the user by attempting to load data from save files. If successful, sets the user details,
* schedule, and timetable. If loading fails or save files are missing, creates new save files, prompts for
* user details, and resets the schedule and timetable.
*
* @author SebasFok
* @throws IOException If an IO error occurs during file operations.
*/
public void initialiseUser() throws IOException {
Expand Down Expand Up @@ -175,10 +174,10 @@ public void resetStorageData() throws IOException {
saveTimetable(student);
}

//@@author SebasFok
/**
* Sets the student details based on the provided list of information, such as name, major, and year.
*
* @author SebasFok
* @param studentDetails The list of student information containing name, major, and year in this order.
* @throws CorruptedFileException If the provided student information is null, has an incorrect number of elements,
* or if any of the information is invalid.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,15 +100,14 @@ public static void showModulesLeft(ArrayList<String> moduleCodesLeft) {
printModuleStringArray(moduleCodesLeft);
}


//@@author SebasFok
/**
* Executes the command to add a module to the target semester of the student's schedule and saves the updated
* schedule. This method adds the specified module to the target semester of the student's schedule and prints
* the updated schedule. Additionally, it attempts to save the updated schedule to storage.
* Exceptions related to module deletion, missing modules, mandatory prerequisites, and
* storage I/O errors are caught and appropriate error messages are displayed.
*
* @author SebasFok
* @param module The module code of the module to be added.
* @param targetSem The target semester for adding the module.
* @param student The student object to which the module will be added.
Expand Down Expand Up @@ -189,14 +188,14 @@ public static void executeDeleteModuleCommand(String module, Student student) {
}
}

//@@author SebasFok
/**
* Executes the command to shift a module within a student's schedule to a different semester.
* This method shifts the specified module to the target semester of the student's schedule and prints
* the updated schedule. Additionally, it attempts to save the updated schedule to storage.
* Exceptions related to module deletion, missing modules, mandatory prerequisites, and
* storage I/O errors are caught and appropriate error messages are displayed.
*
* @author SebasFok
* @param module The module code of the module to be shifted.
* @param targetSem The target semester for shifting the module.
* @param student The student object whose schedule will be updated.
Expand Down Expand Up @@ -224,14 +223,14 @@ public static void executeShiftModuleCommand(String module, int targetSem, Stude
}
}

//@@author SebasFok
/**
* Executes the command to clear the student's schedule. This method clears the entire schedule of the student as
* well as the completion status of all modules. Additionally, it attempts to save the updated schedule to storage.
* Before clearing, the user will be prompted again to check if they truly want to clear their schedule.
* Exceptions related to module deletion, missing modules, mandatory prerequisites, and
* storage I/O errors are caught and appropriate error messages are displayed.
*
* @author SebasFok
* @param student The student object whose schedule will be cleared.
*/
public static void executeClearScheduleCommand(Student student){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ public static void getRequiredModules(String major) throws NullPointerException
printRequiredModules(major);
}

//@@author SebasFok
/**
* Asks the user for confirmation to clear their schedule and returns the user's choice.
* Displays a message warning that clearing your schedule cannot be undone.
*
* @author SebasFok
* @return true if the user confirms by entering 'Y', false if 'N'.
*/
public static boolean isConfirmedToClearSchedule() {
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/seedu/duke/models/logic/Prerequisite.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
import static seedu.duke.models.schema.Storage.getRequirements;

public class Prerequisite {

//@@author SebasFok
/**
* Recursively checks if each branch of the prereq tree is satisfied by the student.
*
* @author SebasFok
* @param modulePrereqArray The array of prerequisite modules or conditions to be checked.
* @param currRequisite The type of prerequisite condition ("or" or "and").
* @param completedModules The list of completed modules by the student.
Expand All @@ -42,11 +43,11 @@ private static boolean isPrereqSatisfied(

}

//@@author SebasFok
/**
* Checks if the AND branch of a module's prerequisites is satisfied based on completed modules.
* Recursively checks the branch if there are nested prerequisite structures in the AND branch
*
* @author SebasFok
* @param modulePrereqArray The array representing the AND branch of prerequisites.
* @param completedModules The list of modules that have been completed.
* @return true if the AND branch is satisfied, false otherwise.
Expand Down Expand Up @@ -91,11 +92,11 @@ private static boolean isAndBranchSatisfied(ArrayList<Objects> modulePrereqArray
return true;
}

//@@author SebasFok
/**
* Checks if the OR branch of a module's prerequisites is satisfied based on completed modules.
* Recursively checks the branch if there are nested prerequisite structures in the OR branch
*
* @author SebasFok
* @param modulePrereqArray The array representing the OR branch of prerequisites.
* @param completedModules The list of modules that have been completed.
* @return true if the OR branch is satisfied, false otherwise.
Expand Down Expand Up @@ -331,10 +332,10 @@ static ArrayList<String> getExemptedPrerequisite(String moduleCode) {
return map.get(moduleCode);
}

//@@author SebasFok
/**
* Checks if a student satisfies all prerequisites for a given module.
*
* @author SebasFok
* @param moduleCode The code of the module for which prerequisites need to be checked.
* @param completedModules The list of completed modules by the student.
* @return `true` if the student satisfies all prerequisites for the module, `false` otherwise.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/duke/models/schema/Major.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package seedu.duke.models.schema;

//@@author SebasFok
/**
* The `Major` enum represents different majors that can be selected by our application.
*
* @author SebasFok
*/
public enum Major {
CEG, CS
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/seedu/duke/models/schema/Schedule.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ public void addReccToSchedule(ArrayList<String> scheduleToAdd) {
}
}

//@@author SebasFok
/**
* Adds a module to the schedule for a specified semester.
*
* @author SebasFok
* @param moduleCode The module code to be added.
* @param targetSem The target semester (an integer from 1 to 8) in which to add the module.
* @throws IllegalArgumentException If the provided semester is out of the valid range (1 to 8),
Expand Down Expand Up @@ -253,10 +253,10 @@ public void deleteModule(String module) throws MandatoryPrereqException, Missing

}

//@@author SebasFok
/**
* Shifts a module within the student's planned schedule to a different semester.
*
* @author SebasFok
* @param module The module code to be shifted.
* @param targetSem The target semester to which the module will be shifted.
* @throws IllegalArgumentException If the target semester is not within the valid range (1 to 8).
Expand Down Expand Up @@ -310,10 +310,10 @@ public void shiftModule(String module, int targetSem) throws IllegalArgumentExce
shiftModuleLater(module, targetSem, indexToAdd, originalSem);
}

//@@author SebasFok
/**
* Shifts a module later within the student's planned schedule to a different semester.
*
* @author SebasFok
* @param module The module code to be shifted later.
* @param targetSem The target semester to which the module will be shifted.
* @param indexToAdd The index at which the module will be added in the schedule.
Expand Down Expand Up @@ -364,10 +364,10 @@ private void shiftModuleLater(String module, int targetSem, int indexToAdd, int
modulesPerSem[targetSem - 1] += 1;
}

//@@author SebasFok
/**
* Shifts a module earlier within the student's planned schedule to a different semester.
*
* @author SebasFok
* @param module The module code to be shifted earlier.
* @param targetSem The target semester to which the module will be shifted.
* @param indexToAdd The index at which the module will be added in the schedule.
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/seedu/duke/models/schema/Storage.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ private static String[] determineRequirements(String major) {
return courseArray;
}

//@@author SebasFok
/**
* Creates a "schedule.txt" file in the data directory.
*
* @author SebasFok
*/
public void createUserStorageFile() {
String dataDirectory = userDirectory + "/data";
Expand Down Expand Up @@ -167,10 +167,10 @@ public Schedule loadSchedule() throws MissingFileException, CorruptedFileExcepti

}

//@@author SebasFok
/**
* Loads the student's details (name, major, and year) from the "studentDetails.txt" file.
*
* @author SebasFok
* @return An ArrayList containing the loaded student details in the order [Name, Major, Year].
* @throws MissingFileException If the "studentDetails.txt" file is missing.
* @throws CorruptedFileException If the file is corrupted or has unexpected content.
Expand Down Expand Up @@ -355,10 +355,10 @@ public void saveStudentDetails (Student student) throws IOException {
}
}

//@@author SebasFok
/**
* Saves the student's details (name, major, and year) to the "studentDetails.txt" file.
*
* @author SebasFok
* @param student The Student object containing the details to be saved.
* @throws IOException If an I/O error occurs while writing to the file.
*/
Expand Down Expand Up @@ -420,10 +420,10 @@ public static void saveTimetable(Student student) throws IOException {

// Below this comment are standard file methods

//@@author SebasFok
/**
* Takes in the location of the file in question and returns whether the file exist
*
* @author SebasFok
* @param filePath
* @return return true if the file exist,return false otherwise
*/
Expand All @@ -432,11 +432,11 @@ public static boolean isFileExist(String filePath) {
return Files.exists(path);
}

//@@author SebasFok
/**
* This method takes in a path and creates a directory at that location. Should the
* directory already exist, no new directory will be created.
*
* @author SebasFok
* @param folderPath the location of where the directory should be created
*/
public static void createDirectory(String folderPath) {
Expand All @@ -449,11 +449,11 @@ public static void createDirectory(String folderPath) {
}
}

//@@author SebasFok
/**
* This method takes in the path of a directory and creates a file 'fileName' in
* the directory. Should the file already exist, no new file will be created.
*
* @author SebasFok
* @param directoryPath the location of the directory where the file should be created
* @param fileName the name of the file to be created
*/
Expand All @@ -476,11 +476,11 @@ public static void createFileInDirectory(String directoryPath, String fileName)
}
}

//@@author SebasFok
/**
* This method takes in the path of a txt file and adds 'textToAdd' to the last line
* of the file
*
* @author SebasFok
* @param filePath location of the file to be edited
* @param textToAdd String to be added to the end of the txt file
*/
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/seedu/duke/models/schema/Student.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ public void setFirstMajor(String userInput) {
}
}

//@@author SebasFok
/**
* Adds a module to the student's schedule for a specified semester.
*
* @author SebasFok
* @param moduleCode The code of the module to be added.
* @param targetSem The semester in which the module will be added.
* @throws IllegalArgumentException If the target semester is not valid.
Expand Down Expand Up @@ -214,10 +214,10 @@ public void deleteModuleFromSchedule(String moduleCode) throws
}
}

//@@author SebasFok
/**
* Shifts a module within the student's schedule to a different semester.
*
* @author SebasFok
* @param moduleCode The code of the module to be shifted.
* @param targetSem The target semester to which the module will be shifted.
* @throws IllegalArgumentException If the target semester is not valid.
Expand All @@ -231,11 +231,11 @@ public void shiftModuleInSchedule(String moduleCode, int targetSem) throws Illeg
this.schedule.shiftModule(moduleCode, targetSem);
}

//@@author SebasFok
/**
* Clears all modules from the student's schedule, resetting it to an empty schedule.
* Also resets the completed module credits to zero.
*
* @author SebasFok
*/
public void clearAllModulesFromSchedule() {
//Replaces current schedule with new schedule
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package seedu.duke.utils.exceptions;

//@@author SebasFok
/**
* Custom exception to indicate that a file is corrupted or has unexpected content.
* This exception should be thrown when an attempt to read or process a file reveals
* that the file's structure or content is not as expected.
*
* @author SebasFok
*/
public class CorruptedFileException extends Exception{
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package seedu.duke.utils.exceptions;

//@@author SebasFok
/**
* Custom exception to indicate that a prerequisite for a certain module is not satisfied.
* This exception should be thrown when a required prerequisite for a module is not met,
* preventing the successful completion of an operation.
*
* @author SebasFok
*/
public class FailPrereqException extends Exception{
public FailPrereqException(String message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package seedu.duke.utils.exceptions;

//@@author SebasFok
/**
* Custom exception to indicate that a module, X, is a mandatory prerequisite for another module, Y.
* This exception should be thrown when attempting an action that causes the module X to move to the same
* semester or after module Y.
*
* @author SebasFok
*/
public class MandatoryPrereqException extends Exception{
public MandatoryPrereqException(String message) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package seedu.duke.utils.exceptions;

//@@author SebasFok
/**
* Custom exception to indicate that a required file is missing.
* This exception should be thrown when an operation expects a certain file to be present,
* but the file cannot be found or is missing.
*
* @author SebasFok
*/
public class MissingFileException extends Exception{

Expand Down
Loading