Skip to content

Commit

Permalink
Merge pull request nus-cs2103-AY1819S1#48 from Bellaaarh/Bella
Browse files Browse the repository at this point in the history
Add parser for WildcardSearchCommand and ToDoListAddCommand
  • Loading branch information
Aadit Kamat authored Oct 16, 2018
2 parents 75d1f58 + acbbb05 commit 80fadd6
Show file tree
Hide file tree
Showing 16 changed files with 88 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ src/main/resources/docs/
out/
allTest.sh
tokens/
!_reposense/config.json
!_reposense/config.json
2 changes: 1 addition & 1 deletion _reposense/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
"authorNames": ["Bellaaarh","DESKTOP-2HNCDPM\\Ysabella"]
}
]
}
}
2 changes: 1 addition & 1 deletion allTest.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

#./config/travis/run-checks.sh
./gradlew clean checkstyleMain checkstyleTest headless allTests coverage coveralls asciidoctor copyDummySearchPage
./gradlew clean checkstyleMain checkstyleTest headless allTests coverage coveralls asciidoctor copyDummySearchPage
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ dependencies {
testRuntimeOnly group: 'org.testfx', name: 'openjfx-monocle', version: 'jdk-9+181'
testRuntimeOnly group:'org.junit.vintage', name:'junit-vintage-engine', version: jUnitVersion
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: jUnitVersion

compile 'com.google.api-client:google-api-client:1.23.0'
compile 'com.google.oauth-client:google-oauth-client-jetty:1.23.0'
compile 'com.google.apis:google-api-services-calendar:v3-rev305-1.23.0'
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface Logic {
* @throws ParseException If an error occurs during parsing.
*/
CommandResult execute(String commandText) throws CommandException, ParseException;

/** Returns an unmodifiable view of the filtered list of transactions */
ObservableList<seedu.address.model.transaction.Transaction> getFilteredTransactionList();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/
public class ToDoListAddCommand extends Command {
public static final String COMMAND_WORD = "todo";
public static final String COMMAND_ALIAS = "td";
public static final String COMMAND_ALIAS = "toDo";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds an action to the user's to-do list. "
+ "Parameters: "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class WildcardSearchCommand extends Command {
public static final String COMMAND_ALIAS = "wcs";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Performs a wildcard search on the address book's "
+ "contacts based on user's input."
+ "contacts based on user's input. "
+ "Parameters: KEYWORD [MORE_KEYWORDS]...\n"
+ "Example: " + COMMAND_WORD + " oh";

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/parser/CliSyntax.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ public class CliSyntax {
public static final Prefix PREFIX_PERSONID = new Prefix("id/");
public static final Prefix PREFIX_TRANSACTION_AMOUNT = new Prefix("ta/");
public static final Prefix PREFIX_TRANSACTION_TYPE = new Prefix("tt/");
public static final Prefix PREFIX_TO_DO_LIST = new Prefix("toDo/");
public static final Prefix PREFIX_TRANSACTION_DEADLINE = new Prefix("d/");
public static final Prefix PREFIX_TO_DO_LIST = new Prefix("td/");
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import seedu.address.MainApp;
import seedu.address.Mode;

import seedu.address.logic.commands.AddCommand;
import seedu.address.logic.commands.AddTransactionCommand;
import seedu.address.logic.commands.AnalyticsCommand;
Expand All @@ -27,6 +28,9 @@
import seedu.address.logic.commands.UndoCommand;
import seedu.address.logic.commands.FilterCommand;
import seedu.address.logic.commands.CalendarCommand;
import seedu.address.logic.commands.WildcardSearchCommand;
import seedu.address.logic.commands.ToDoListAddCommand;

import seedu.address.logic.parser.exceptions.ParseException;

/**
Expand Down Expand Up @@ -125,6 +129,14 @@ public Command parseCommand(String userInput) throws ParseException {
case CalendarCommand.COMMAND_ALIAS:
return new CalendarCommandParser().parse(arguments);

case WildcardSearchCommand.COMMAND_WORD:
case WildcardSearchCommand.COMMAND_ALIAS:
return new WildcardSearchCommandParser().parse(arguments);

case ToDoListAddCommand.COMMAND_WORD:
case ToDoListAddCommand.COMMAND_ALIAS:
return new ToDoListAddCommandParser().parse(arguments);

default:
throw new ParseException(MESSAGE_UNKNOWN_COMMAND);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package seedu.address.logic.parser;

import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.address.logic.commands.ToDoListAddCommand;
import seedu.address.logic.parser.exceptions.ParseException;
/**
*
*/

public class ToDoListAddCommandParser implements Parser<ToDoListAddCommand> {

/**
* Parses the given {@code String} of arguments in the context of the ToDoListAddCommand
* and returns an ToDoListAddCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/

public ToDoListAddCommand parse(String args) throws ParseException {
if (args.isEmpty()) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, ToDoListAddCommand.MESSAGE_USAGE));
}

return new ToDoListAddCommand(args);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package seedu.address.logic.parser;

import static seedu.address.commons.core.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import java.util.Arrays;
import seedu.address.logic.commands.WildcardSearchCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.transaction.NameContainsLettersPredicate;

/**
*
*/

public class WildcardSearchCommandParser implements Parser<WildcardSearchCommand>{

/**
* Parses the given {@code String} of arguments in the context of the WildcardSearchCommand
* and returns an WildcardSearchCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
*/

public WildcardSearchCommand parse(String args) throws ParseException {
String trimmedArgs = args.trim();
if (trimmedArgs.isEmpty()) {
throw new ParseException(
String.format(MESSAGE_INVALID_COMMAND_FORMAT, WildcardSearchCommand.MESSAGE_USAGE));
}

String[] nameKeywords = trimmedArgs.split("\\s+");

return new WildcardSearchCommand(new NameContainsLettersPredicate(Arrays.asList(nameKeywords)));
}
}
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/model/person/Photo.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public Photo(String filePath, String newPhoto) throws IllegalValueException {
}
//link to the path
this.photoPath = FOLDER + "//" + newPhoto;
makePhoto( filePath, newPhoto);

makePhoto( filePath, newPhoto);
}

private void makePhoto(String filePath, String newPhoto) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/creds/creds.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"installed":{"client_id":"701191040047-p35krni7rngbafn4q00836sckhhmfj11.apps.googleusercontent.com","project_id":"debt-tracker-1539007158978","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://www.googleapis.com/oauth2/v3/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"FrEvGQ94puiSdScIxwi0D3zQ","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
{"installed":{"client_id":"701191040047-p35krni7rngbafn4q00836sckhhmfj11.apps.googleusercontent.com","project_id":"debt-tracker-1539007158978","auth_uri":"https://accounts.google.com/o/oauth2/auth","token_uri":"https://www.googleapis.com/oauth2/v3/token","auth_provider_x509_cert_url":"https://www.googleapis.com/oauth2/v1/certs","client_secret":"FrEvGQ94puiSdScIxwi0D3zQ","redirect_uris":["urn:ietf:wg:oauth:2.0:oob","http://localhost"]}}
3 changes: 2 additions & 1 deletion src/main/resources/view/ToDoList.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollBar?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>


<AnchorPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1" fx:controller="view.ToDoList">
<children>
<Label text="To-Do List" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="5.0" />
<TextArea prefHeight="200.0" prefWidth="200.0" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="30.0" />
<TextField AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="30.0" AnchorPane.topAnchor="30.0" />
<ScrollBar layoutX="568.0" layoutY="33.0" orientation="VERTICAL" prefHeight="353.0" prefWidth="18.0" AnchorPane.bottomAnchor="12.0" AnchorPane.rightAnchor="12.0" AnchorPane.topAnchor="32.0" />
</children>
</AnchorPane>
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class CommandTestUtil {
DESC_AMY = new EditTransactionDescriptorBuilder().withAmount(VALID_AMOUNT_AMY).withDeadline(VALID_DEADLINE_AMY)
.withType(VALID_TYPE_AMY).withName(VALID_NAME_AMY).withPhone(VALID_PHONE_AMY)
.withEmail(VALID_EMAIL_AMY).withAddress(VALID_ADDRESS_AMY).withTags(VALID_TAG_FRIEND).build();

DESC_BOB = new EditTransactionDescriptorBuilder().withAmount(VALID_AMOUNT_BOB).withDeadline(VALID_DEADLINE_BOB)
.withType(VALID_TYPE_BOB).withName(VALID_NAME_BOB).withPhone(VALID_PHONE_BOB)
.withEmail(VALID_EMAIL_BOB).withAddress(VALID_ADDRESS_BOB)
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/seedu/address/testutil/PersonBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ public Person build() {
return new Person(name, phone, email, address, tags);
}

}
}

0 comments on commit 80fadd6

Please sign in to comment.