forked from AY2324S1-CS2103T-T13-0/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request AY2324S1-CS2103T-T13-0#94 from ji-just-ji/Add-Command
Add command
- Loading branch information
Showing
9 changed files
with
197 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
package seedu.address.testutil; | ||
|
||
|
||
import seedu.address.model.module.Grade; | ||
import seedu.address.model.module.Module; | ||
import seedu.address.model.module.ModuleCode; | ||
import seedu.address.model.module.Semester; | ||
import seedu.address.model.module.Year; | ||
import seedu.address.model.person.Name; | ||
|
||
/** | ||
* A utility class to help with building Person objects. | ||
*/ | ||
public class ModuleBuilder { | ||
public static final String DEFAULT_CODE = "CS2100"; | ||
public static final String DEFAULT_YEAR = "2"; | ||
public static final String DEFAULT_SEM = "1"; | ||
public static final String DEFAULT_GRADE = "A"; | ||
|
||
private ModuleCode code; | ||
private Year year; | ||
private Semester semester; | ||
private Grade grade; | ||
|
||
/** | ||
* Creates a {@code ModuleBuilder} with the default details | ||
*/ | ||
public ModuleBuilder() { | ||
code = new ModuleCode(DEFAULT_CODE); | ||
year = new Year(DEFAULT_YEAR); | ||
semester = new Semester(DEFAULT_SEM); | ||
grade = new Grade(DEFAULT_GRADE); | ||
} | ||
|
||
/** | ||
* Initializes the ModuleBuilder with the data of {@code moduleToCopy}. | ||
*/ | ||
public ModuleBuilder(Module moduleToCopy) { | ||
code = moduleToCopy.getModuleCode(); | ||
year = moduleToCopy.getYearTaken(); | ||
semester = moduleToCopy.getSemesterTaken(); | ||
grade = moduleToCopy.getGrade(); | ||
} | ||
/** | ||
* Sets the {@code moduleCode} of the {@code Module} that we are building. | ||
*/ | ||
public ModuleBuilder withCode(String code) { | ||
this.code = new ModuleCode(code); | ||
return this; | ||
} | ||
|
||
/** | ||
* Sets the {@code Year} of the {@code Module} that we are building. | ||
*/ | ||
public ModuleBuilder withYear(String year) { | ||
this.year = new Year(year); | ||
return this; | ||
} | ||
/** | ||
* Sets the {@code sem} of the {@code Module} that we are building. | ||
*/ | ||
public ModuleBuilder withSem(String sem) { | ||
this.semester = new Semester(sem); | ||
return this; | ||
} | ||
/** | ||
* Sets the {@code grade} of the {@code Module} that we are building. | ||
*/ | ||
public ModuleBuilder withGrade(String grade) { | ||
this.grade = new Grade(grade); | ||
return this; | ||
} | ||
|
||
public Module build() { | ||
return new Module(code, year, semester, grade); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.