Skip to content

Commit

Permalink
Fix style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ZShunRen committed Nov 4, 2024
1 parent 09c226d commit eb8a1fa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
30 changes: 18 additions & 12 deletions src/main/java/seedu/address/logic/parser/FilterCommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TIER;

import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.function.Predicate;
import java.util.function.Supplier;

Expand Down Expand Up @@ -96,18 +101,18 @@ private List<Predicate<Client>> collectPredicates(ArgumentMultimap argMultimap)
Set<String> errors = new LinkedHashSet<>();

if (argMultimap.getValue(PREFIX_NAME).isPresent()) {
String substring = parseFieldForFilterCommand(() -> parseField(() -> ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get()).fullName
, errors));
String substring = parseFieldForFilterCommand(() -> parseField(() -> ParserUtil.parseName(
argMultimap.getValue(PREFIX_NAME).get()).fullName, errors));
predicates.add(new NameContainsSubstringPredicate(substring));
}
if (argMultimap.getValue(PREFIX_PHONE).isPresent()) {
String substring = parseFieldForFilterCommand(() -> parseField(() -> ParserUtil.parsePhone(argMultimap.getValue(PREFIX_PHONE).get()).value
, errors));
String substring = parseFieldForFilterCommand(() -> parseField(() -> ParserUtil.parsePhone(
argMultimap.getValue(PREFIX_PHONE).get()).value, errors));
predicates.add(new PhoneContainsSubstringPredicate(substring));
}
if (argMultimap.getValue(PREFIX_EMAIL).isPresent()) {
String substring = parseFieldForFilterCommand(() -> parseField(() -> ParserUtil.parseEmail(argMultimap.getValue(PREFIX_EMAIL).get()).value
, errors));
String substring = parseFieldForFilterCommand(() -> parseField(() -> ParserUtil.parseEmail(
argMultimap.getValue(PREFIX_EMAIL).get()).value, errors));
predicates.add(new EmailContainsSubstringPredicate(substring));
}
if (argMultimap.getValue(PREFIX_ADDRESS).isPresent()) {
Expand All @@ -123,7 +128,8 @@ private List<Predicate<Client>> collectPredicates(ArgumentMultimap argMultimap)
if (argMultimap.getValue(PREFIX_INCOME).isPresent()) {
String operatorAndIncome = argMultimap.getValue(PREFIX_INCOME).get();
try {
IncomeComparisonOperator operator = ParserUtil.parseIncomeComparisonOperator(operatorAndIncome.substring(0, 1));
IncomeComparisonOperator operator =
ParserUtil.parseIncomeComparisonOperator(operatorAndIncome.substring(0, 1));
int income = ParserUtil.parseIncome(operatorAndIncome.substring(1)).value;
predicates.add(new IncomeComparisonPredicate(operator, income));
} catch (StringIndexOutOfBoundsException e) {
Expand All @@ -139,13 +145,13 @@ private List<Predicate<Client>> collectPredicates(ArgumentMultimap argMultimap)
predicates.add(new RemarkContainsSubstringPredicate(substring));
}
if (argMultimap.getValue(PREFIX_TIER).isPresent()) {
String substring = parseFieldForFilterCommand(
() -> parseField(() -> argMultimap.getValue(PREFIX_TIER).get(), errors));
String substring = parseFieldForFilterCommand(() -> parseField(() -> argMultimap.getValue(
PREFIX_TIER).get(), errors));
predicates.add(new TierStartsWithSubstringPredicate(substring));
}
if (argMultimap.getValue(PREFIX_STATUS).isPresent()) {
String substring = parseFieldForFilterCommand(
() -> parseField(() -> argMultimap.getValue(PREFIX_STATUS).get(), errors));
String substring = parseFieldForFilterCommand(() -> parseField(() -> argMultimap.getValue(
PREFIX_STATUS).get(), errors));
predicates.add(new StatusStartsWithSubstringPredicate(substring));
}
if (!errors.isEmpty()) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/seedu/address/logic/parser/ParserUtil.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package seedu.address.logic.parser;

import static java.util.Objects.requireNonNull;
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;

import seedu.address.commons.core.index.Index;
import seedu.address.commons.util.StringUtil;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/model/client/Name.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
public class Name {

public static final String MESSAGE_CONSTRAINTS =
"Names should only contain letters, numbers, spaces, hyphens, apostrophes, and it should not be blank";
"Names should only contain letters, numbers, spaces, hyphens, apostrophes (no symbols), "
+ "and it should not be blank";

/*
* The first character of the address must not be a whitespace,
Expand Down

0 comments on commit eb8a1fa

Please sign in to comment.