Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
fd24826
Set theme jekyll-theme-slate
Jane-Ng Sep 28, 2020
5d4b09d
Modify name in about us
woozije Oct 2, 2020
a1bb768
Modify name
Jane-Ng Oct 2, 2020
b304d14
Updated Yan An's personal information in the doc/AboutUs.md
Oct 2, 2020
fdf0ac0
Edit AboutUs.md
gua-guargia Oct 2, 2020
2b18f2b
About Us
Zhu-Zeyu Oct 2, 2020
5533e78
Modify name in aboutus.md
woozije Oct 2, 2020
621908c
Merge pull request #1 from Darticune/AboutUs
Jane-Ng Oct 2, 2020
aba8f58
Merge pull request #3 from Jane-Ng/AboutUs
Jane-Ng Oct 2, 2020
4b83458
Merge branch 'master' into us
Jane-Ng Oct 2, 2020
4aba6b5
Merge pull request #4 from gua-guargia/us
Jane-Ng Oct 2, 2020
39d804b
Merge branch 'master' into AboutUs
Jane-Ng Oct 2, 2020
cb73400
Merge pull request #5 from Zhu-Ze-Yu/AboutUs
Jane-Ng Oct 2, 2020
afa3358
Merge branch 'master' into JiaErn-AboutUs
Jane-Ng Oct 2, 2020
a9cf046
Merge pull request #2 from neojiaern/JiaErn-AboutUs
Jane-Ng Oct 2, 2020
cd8ccca
Add tp trial structure
gua-guargia Oct 5, 2020
7c0361f
Add the ability to add and list cards
Jane-Ng Oct 6, 2020
f98f5fa
Minor change to output message
Jane-Ng Oct 6, 2020
83464ff
Merge pull request #18 from Jane-Ng/feature-AddListCards-Exit
Jane-Ng Oct 6, 2020
0c8dda3
Add revision feature
woozije Oct 6, 2020
4a3daa1
Fix checkstyle error
woozije Oct 6, 2020
49b3c2a
Change arg to commandArgs
woozije Oct 6, 2020
e7ee47d
Change initialization location for Chapter object
woozije Oct 6, 2020
7a3e44b
Merge pull request #19 from neojiaern/feature-Revise
woozije Oct 6, 2020
b9f1e40
Included JUnit tests for methods in Scheduler.java and added function…
Oct 6, 2020
07a5ed0
Updated JUnit tests for Scheduler.java with proper naming convention
Oct 6, 2020
2390222
Merge pull request #20 from Darticune/SchedulerDeck
Jane-Ng Oct 6, 2020
0cc640d
Move loop function of revision from Ui to RevisionCommand
woozije Oct 6, 2020
e703c90
Add help command and capability to store questions
Zhu-Zeyu Oct 6, 2020
9cd5013
Add rate feature for each card under revision
woozije Oct 7, 2020
6dfb5fa
Add print empty line after each output in run function
woozije Oct 7, 2020
9575e1b
Merge pull request #22 from Zhu-Ze-Yu/add-Help-and-File
Zhu-Ze-Yu Oct 7, 2020
68ecf35
Fix error
Zhu-Zeyu Oct 7, 2020
6fc44fc
Check coding standard
Zhu-Zeyu Oct 7, 2020
c084400
Revert "Add help command and capability to store questions"
Jane-Ng Oct 7, 2020
c408772
Merge pull request #23 from AY2021S1-CS2113T-F11-3/revert-22-add-Help…
Jane-Ng Oct 7, 2020
77c1be4
Merge pull request #21 from neojiaern/feature-Rate
woozije Oct 7, 2020
83de10a
resolve merge conflicts
Zhu-Zeyu Oct 7, 2020
ef89f8f
resolve merge conflicts
Zhu-Zeyu Oct 7, 2020
633a1e7
modify showHelpList
Zhu-Zeyu Oct 7, 2020
f6adf44
Check coding style
Zhu-Zeyu Oct 7, 2020
9b6a1d3
Merge pull request #24 from Zhu-Ze-Yu/add-Help-and-File
woozije Oct 7, 2020
eb5eb0b
Add JUnit Tests for invalid input for add, list and exit commands
Jane-Ng Oct 7, 2020
d565a70
Fix checkstyle error
Jane-Ng Oct 7, 2020
2b93ac3
Merge pull request #25 from Jane-Ng/junit-Parser-AddListCards-Exit
Jane-Ng Oct 7, 2020
50d87b0
Add structure of the KAJI: admin, module, chapter and cards
gua-guargia Oct 7, 2020
85499f6
Merge branch 'master' of https://github.com/AY2021S1-CS2113T-F11-3/tp…
gua-guargia Oct 8, 2020
9c8bf28
Implement access flashcard deck by deck
gua-guargia Oct 8, 2020
e9efc73
Fix checkStyleMain errors
gua-guargia Oct 8, 2020
b5ec480
Fix IOtest error
gua-guargia Oct 8, 2020
cc76a1b
Fix IOfile error
gua-guargia Oct 8, 2020
6b4536c
Add junit testing for rateCard method
woozije Oct 8, 2020
f3cf2b2
Fix help command exiting after call
woozije Oct 8, 2020
ef913ca
Merge pull request #28 from neojiaern/junit-ReviseCommand
woozije Oct 8, 2020
eef3374
Resolve peer review
gua-guargia Oct 8, 2020
1ed133d
Fix Build and check with Gradle
gua-guargia Oct 8, 2020
9e70184
Merge branch 'branch-Trial-ClassStructure'
gua-guargia Oct 8, 2020
6c0669c
Edit Access.java: wrong logic
gua-guargia Oct 8, 2020
0cfc5c4
Merge pull request #27 from gua-guargia/branch-Trial-ClassStructure
Jane-Ng Oct 8, 2020
c7b985d
Add remove feature for flahscards
woozije Oct 10, 2020
fa519bb
Remove unused imports
woozije Oct 10, 2020
3758019
Add junit testing to test remove feature in parser
woozije Oct 10, 2020
405b966
Fix checkstyle test issues
woozije Oct 10, 2020
4816253
Merge pull request #29 from neojiaern/feature-RemoveCards
woozije Oct 10, 2020
77cd9e3
Add moduleList and chapterList class
gua-guargia Oct 11, 2020
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
7 changes: 5 additions & 2 deletions docs/AboutUs.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

Display | Name | Github Profile | Portfolio
--------|:----:|:--------------:|:---------:
![](https://via.placeholder.com/100.png?text=Photo) | John Doe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
![](https://via.placeholder.com/100.png?text=Photo) | Jia Ern | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
![](https://via.placeholder.com/100.png?text=Photo) | Zhu Zeyu | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
![](https://via.placeholder.com/100.png?text=Photo) | Jane Ng | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
![](https://via.placeholder.com/100.png?text=Photo) | Don Joe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
![](https://via.placeholder.com/100.png?text=Photo) | Ron John | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
![](https://via.placeholder.com/100.png?text=Photo) | John Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
![](https://via.placeholder.com/100.png?text=Photo) | Don Roe | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
![](https://via.placeholder.com/100.png?text=Photo) | Jiayi Zhang | [Github](https://github.com/) | [Portfolio](docs/team/johndoe.md)
![](https://via.placeholder.com/100.png?text=Photo) | Tan Yan An | [Github](https://github.com/Darticune) | [Portfolio](docs/team/yanAn.md)
1 change: 1 addition & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-slate
1 change: 1 addition & 0 deletions questions.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[Q] da | [A] da
58 changes: 58 additions & 0 deletions src/main/java/Kaji.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import access.Access;
import commands.Command;
import exception.InvalidInputException;
import manager.admin.Admin;
import manager.chapter.CardList;
import parser.Parser;
import storage.Storage;
import ui.Ui;

import java.io.FileNotFoundException;
import java.io.IOException;

public class Kaji {
private CardList cards;
private Ui ui;
private Access access;
private Storage storage;


public Kaji(String filePath) {
ui = new Ui();
cards = new CardList();
storage = new Storage(filePath);
try {
Admin admin = new Admin(storage.loadModule());
access = new Access(admin);
} catch (FileNotFoundException e) {
storage.createAdmin();
access = new Access();
}
}

public void run() {
ui.showWelcome();
ui.showHelpList();
boolean isExit = false;
Storage.getFileContents(cards);
while (!isExit) {
try {
ui.showLevel(access);
String fullCommand = ui.readCommand();
Command c = Parser.parse(fullCommand);
c.execute(cards, ui, access, storage);
ui.printEmptyLine();
Storage.writeToFile(cards);
isExit = c.isExit();
} catch (InvalidInputException e) {
System.out.println("Invalid input given.\n");
} catch (IOException e) {
System.out.println(" Something went wrong: " + e.getMessage());
}
}
}

public static void main(String[] args) {
new Kaji("data/admin").run();
}
}
161 changes: 161 additions & 0 deletions src/main/java/access/Access.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
package access;

import manager.admin.Admin;
import manager.chapter.Chapter;
import manager.module.Module;

public class Access {
protected String level;
protected String adminLevel;
protected String moduleLevel;
protected String chapterLevel;
protected Chapter chapter;
protected Module module;
protected Admin admin;
protected boolean isAdminLevel;
protected boolean isModuleLevel;
protected boolean isChapterLevel;

public Access(Admin admin) {
this.admin = admin;
this.module = null;
this.chapter = null;
this.level = "admin";
this.adminLevel = "admin";
this.moduleLevel = "";
this.chapterLevel = "";
this.isAdminLevel = true;
this.isModuleLevel = false;
this.isChapterLevel = false;
}

public Access() {
this.level = "admin";
this.adminLevel = "admin";
this.moduleLevel = "";
this.chapterLevel = "";
this.module = null;
this.chapter = null;
this.admin = new Admin();
this.isAdminLevel = true;
this.isModuleLevel = false;
this.isChapterLevel = false;
}

public String getModuleLevel() {
return moduleLevel;
}

public String getLevel() {
return level;
}

public String getChapterLevel() {
return chapterLevel;
}

public Module getModule() {
return module;
}

public Chapter getChapter() {
return chapter;
}

public Admin getAdmin() {
return admin;
}

public void setAdmin(Admin admin) {
this.admin = admin;
}

public void setModule(Module module) {
this.module = module;
}

public void setChapter(Chapter chapter) {
this.chapter = chapter;
}

public boolean isAdminLevel() {
return isAdminLevel;
}

public boolean isModuleLevel() {
return isModuleLevel;
}

public boolean isChapterLevel() {
return isChapterLevel;
}

public void setModuleLevel(String moduleLevel) {
if (isChapterLevel) {
System.out.println("Sorry, you currently are in the chapter level.");
return;
}

if (isModuleLevel) {
if (!(moduleLevel.equals(""))) {
System.out.println("Sorry, you are already in the module level, "
+ "please go back to admin level first.");
return;
}

String replacement = "/" + this.moduleLevel;
this.level = level.replace(replacement, "");
this.moduleLevel = moduleLevel;
this.module = null;
this.isModuleLevel = false;
this.isAdminLevel = true;
return;
}

if (isAdminLevel) {
if (moduleLevel.equals("")) {
System.out.println("Sorry, you are already in the admin level.");
return;
}
this.moduleLevel = moduleLevel;
this.level = level + "/" + moduleLevel;
this.module = new Module(moduleLevel);
this.isModuleLevel = true;
this.isAdminLevel = false;
}
}

public void setChapterLevel(String chapterLevel) {
if (isAdminLevel) { //wrong level
System.out.println("Sorry, you currently are in the admin level.");
return;
}

if (isChapterLevel) {
if (!(chapterLevel.equals(""))) {
System.out.println("Sorry, you are already in the chapter level, "
+ "please go back to module level first.");
return;
}
String replacement = "/" + this.chapterLevel;
this.level = level.replace(replacement, "");
this.chapterLevel = chapterLevel;
this.chapter = null;
this.isChapterLevel = false;
this.isModuleLevel = true;
return;
}

if (isModuleLevel) {
if (chapterLevel.equals("")) {
System.out.println("Sorry, you are already in the module level.");
return;
}
this.chapterLevel = chapterLevel;
this.level = level + "/" + chapterLevel;
this.chapter = new Chapter(chapterLevel);
this.isChapterLevel = true;
this.isModuleLevel = false;
}
}
}
41 changes: 41 additions & 0 deletions src/main/java/commands/AddChapterCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package commands;

import manager.chapter.CardList;
import manager.chapter.Chapter;
import manager.module.ChapterList;
import manager.module.Module;
import access.Access;
import storage.Storage;
import ui.Ui;

public class AddChapterCommand extends Command {
public static final String COMMAND_WORD = "addchapter";
private final Chapter chapter;

public AddChapterCommand(String chapterCode) {
this.chapter = new Chapter(chapterCode);
}

@Override
public void execute(CardList cards, Ui ui, Access access, Storage storage) {
if (access.isAdminLevel() || access.isChapterLevel()) {
System.out.println("Sorry, you currently are in the admin/chapter level, "
+ "please go to module level first.");
return;
}

Module newModule = access.getModule();
ChapterList chapters = newModule.getChapters();
chapters.addChapter(chapter);
int chapterCount = chapters.getChapterCount();
ui.showChapterAdded(chapter, chapterCount);
access.setModule(newModule);
storage.createChapter(chapter.getChapterName(), access.getModuleLevel());
}

@Override
public boolean isExit() {
return false;
}
}

41 changes: 41 additions & 0 deletions src/main/java/commands/AddCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package commands;

import access.Access;
import manager.card.Card;
import manager.chapter.CardList;
import storage.Storage;
import ui.Ui;

public class AddCommand extends Command {
public static final String COMMAND_WORD = "add";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a flashcard to the schedule manager. \n"
+ "Parameters: q:QUESTION | a:ANSWER\n"
+ "Example: " + COMMAND_WORD + " q:What is the result of one plus one | a:two\n";

public static final String QUESTION_ANSWER_PREFIX = " \\| ";
public static final String QUESTION_PREFIX = "q:";
public static final String ANSWER_PREFIX = "a:";

private final Card card;

public AddCommand(String question, String answer) {
this.card = new Card(question, answer);
}

@Override
public void execute(CardList cards, Ui ui, Access access, Storage storage) {
if (access.getChapterLevel().equals("")) {
System.out.println("Sorry, you currently are in the wrong level, please enter chapter level first.");
return;
}
cards.addCard(card);
int cardCount = cards.getCardCount();
ui.showCardAdded(cards.getCard(cardCount - 1), cardCount);
}

@Override
public boolean isExit() {
return false;
}
}
40 changes: 40 additions & 0 deletions src/main/java/commands/AddModuleCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package commands;

import access.Access;
import manager.admin.Admin;
import manager.admin.ModuleList;
import manager.chapter.CardList;
import manager.module.Module;
import storage.Storage;
import ui.Ui;

public class AddModuleCommand extends Command {
public static final String COMMAND_WORD = "addmodule";
private final Module module;

public AddModuleCommand(String moduleCode) {
this.module = new Module(moduleCode);
}

@Override
public void execute(CardList cards, Ui ui, Access access, Storage storage) {
if (access.isModuleLevel() || access.isChapterLevel()) {
System.out.println("Sorry, you currently are in the module/chapter level, "
+ "please go to admin level first.");
return;
}

Admin newAdmin = access.getAdmin();
ModuleList modules = newAdmin.getModules();
modules.addModule(module);
int moduleCount = modules.getModuleCount();
ui.showModuleAdded(module, moduleCount);
access.setAdmin(newAdmin);
storage.createModule(module.getModuleName());
}

@Override
public boolean isExit() {
return false;
}
}
20 changes: 20 additions & 0 deletions src/main/java/commands/BackChapterCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package commands;

import access.Access;
import manager.chapter.CardList;
import storage.Storage;
import ui.Ui;

public class BackChapterCommand extends Command {
public static final String COMMAND_WORD = "backchapter";

@Override
public void execute(CardList cards, Ui ui, Access access, Storage storage) {
access.setChapterLevel("");
}

@Override
public boolean isExit() {
return false;
}
}
Loading