[CS2113-T10-2] ClassCraft#13
Conversation
…remove-redundant Refactor: prepare codebase for TP v1.0
There was a problem hiding this comment.
Code is generally neat.
However, documentation is lacking.
Please see my comments inline for other minor issues.
@seantankj @ashpasa @darshhs @Yeoh-Soo-Leong @Amanda-HUANG88
|
|
||
| public class ClassCraft { | ||
| /** | ||
| * Main entry-point for the java.duke.ClassCraft application. |
There was a problem hiding this comment.
Header comment should be written in simple present tense. Something like "Represents the entry point"
| System.out.println("Input your command! Type 'help' if you need assistance."); | ||
|
|
||
| Ui ui = new Ui(); | ||
| StudyPlan currentStudyPlan = new StudyPlan(8); |
| } | ||
|
|
||
| @Override | ||
| public void executeCommand(seedu.classcraft.studyplan.StudyPlan studyPlan, seedu.classcraft.ui.Ui ui) { |
There was a problem hiding this comment.
better to import rather than use fully qualified names here.
|
|
||
| public abstract class Command { | ||
|
|
||
| public abstract void executeCommand(StudyPlan studyPlan, Ui ui) throws Exception; |
There was a problem hiding this comment.
all non-trivial methods in the codebase should have header comments
| public enum CommandList { | ||
| help, add, delete, view, mc, spec, exit, confirm; | ||
|
|
||
| public static boolean isFound(String test) { |
There was a problem hiding this comment.
is found what?
no documentation for this method
| /** | ||
| * Stores and provides access to the CEG Default Graduation Requirements | ||
| */ | ||
| public class Grad { |
There was a problem hiding this comment.
you can try to find a better name for this class
| extractModuleCodes(prerequisiteNode, prerequisites); | ||
| } | ||
|
|
||
| } catch (Exception e) { |
There was a problem hiding this comment.
may be too generic. suggestion: create custom exception for this
| if (node.isTextual()) { | ||
| String text = node.asText().trim(); | ||
| if (text.contains(":") && !text.split(":")[0].trim().isEmpty()) { | ||
| String moduleCode = text.split(":")[0].trim(); | ||
| result.add(moduleCode); | ||
| } else if (!text.isEmpty()) { | ||
| result.add(text); | ||
| } | ||
| return; | ||
| } |
| addModule(newModule, semester); | ||
|
|
||
| LOGGER.info("Added " + moduleCode + " to semester " + semester); | ||
| // Removed old System.out.println that used fetcher.getModulePrerequisites(moduleCode) |
| /* | ||
| private Parser parser; | ||
| private String userInput = "null"; | ||
|
|
||
| @BeforeEach | ||
| void setUp() { | ||
| parser = new Parser( userInput); | ||
| } | ||
|
|
||
| //Test for valid parsing of user input string into commandType and userInstructions | ||
| @Test | ||
| void parseInstructions_validInput() { | ||
| parser.userInputString = "help"; | ||
| parser.parseInstructions(); | ||
| assertEquals("help", parser.commandType); | ||
| assertNull(parser.userInstructions, | ||
| "userInstructions should be " + | ||
| "null for input 'help'."); | ||
|
|
||
| parser.userInputString = "exit"; | ||
| parser.parseInstructions(); | ||
| assertEquals("exit", parser.commandType); | ||
| assertNull(parser.userInstructions, | ||
| "userInstructions should be " + | ||
| "null for input 'exit'."); | ||
|
|
||
| parser.userInputString = "delete CS2113"; | ||
| parser.parseInstructions(); | ||
| assertEquals("delete", parser.commandType); | ||
| assertEquals("CS2113", parser.userInstructions); | ||
|
|
||
| parser.userInputString = "unknown arg"; | ||
| parser.parseInstructions(); | ||
| assertEquals("invalid", parser.commandType); | ||
|
|
||
| parser.userInputString = "delete "; | ||
| parser.parseInstructions(); | ||
| assertEquals("invalid", parser.commandType, | ||
| "The commandType " + | ||
| "should be 'invalid' for input 'delete' without a corresponding module code."); | ||
|
|
||
| parser.userInputString = ""; | ||
| parser.parseInstructions(); | ||
| assertEquals("invalid", parser.commandType, | ||
| "The commandType " + | ||
| "should be 'invalid' for empty input."); | ||
| } | ||
|
|
||
| //Test for valid parsing of user instructions for view command | ||
| @Test | ||
| void parseView_validInstructions() { | ||
| parser.userInstructions = "plan"; | ||
| assertEquals("plan", parser.parseView()); | ||
|
|
||
| parser.userInstructions = "grad"; | ||
| assertEquals("grad", parser.parseView()); | ||
|
|
||
| parser.userInstructions = "sample extra arguments"; | ||
| assertEquals("sample", parser.parseView()); | ||
|
|
||
| parser.userInstructions = "invalidCommand"; | ||
| assertEquals("", parser.parseView(), | ||
| "The view command should " + | ||
| "return an empty string for invalid input."); | ||
| } | ||
|
|
||
| //Test for valid parsing of user instructions for delete command | ||
| @Test | ||
| void parseDelete_validModuleCode() { | ||
| parser.userInstructions = "CG2111A extra arguments"; | ||
| assertEquals("CG2111A", parser.parseDelete()); | ||
|
|
||
| parser.userInstructions = null; | ||
| assertEquals("", parser.parseDelete(), | ||
| "The delete command should " + | ||
| "return an empty string for null input."); | ||
|
|
||
| parser.userInstructions = ""; | ||
| assertEquals("", parser.parseDelete(), | ||
| "The delete command " + | ||
| "should return an empty string for empty input."); | ||
| } | ||
|
|
||
|
|
||
| //Test for valid parsing of user instructions for add command | ||
| @Test | ||
| void parseAdd_validInput() { | ||
| parser.userInstructions = "n/CG2111A s/2"; | ||
| String[] result = parser.parseAdd(); | ||
| assertEquals(2, result.length); | ||
| assertEquals("CG2111A", result[0]); | ||
| assertEquals("2", result[1]); | ||
|
|
||
| parser.userInstructions = "n/CG2111A"; | ||
| assertEquals(0, parser.parseAdd().length, | ||
| "The result array " + | ||
| "should have length 0 for missing semester."); | ||
|
|
||
| parser.userInstructions = "s/2"; | ||
| assertEquals(0, parser.parseAdd().length, | ||
| "The result array " + | ||
| "should have length 0 for missing module code."); | ||
|
|
||
| parser.userInstructions = null; | ||
| assertEquals(0, parser.parseAdd().length, | ||
| "The result array " + | ||
| "should have length 0 for null input."); | ||
|
|
||
| } | ||
| */ |
There was a problem hiding this comment.
Don't retain commented code. you can retrieve it from git later if you need it
Add balancer command
add Junit test for spec command
V2 features:Add progress view and add-completed/exempted commands
Update UG
Update PPP
Update Sean PPP
fix about us links
Fix restoration when exemptions include prereq
Add checks for prereq when adding to exemptions
Update java doc
Update DG
Code cleaning
Add class diagrams
Remove empty header in DG
Add class diagram
ClassCraft is a desktop app for generating sample study plans for Computer Engineers in NUS via a Command Line Interface (CLI). It helps streamline high level module planning and completion of various specialisations and technical electives.