Skip to content

Commit

Permalink
Merge pull request nusCS2113-AY1819S2#47 from yingrong1996/ForPrject
Browse files Browse the repository at this point in the history
Code edited to fit code style (Done)
  • Loading branch information
yingrong1996 authored Mar 20, 2019
2 parents 3a2bba6 + 17a82ec commit 8ff7c96
Show file tree
Hide file tree
Showing 76 changed files with 843 additions and 638 deletions.
2 changes: 1 addition & 1 deletion docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ Use Case: Edit Player
Use case ends.

[appendix]
==Glossary
== Glossary

League: a group of football teams which play each other over a period for a championship.

Expand Down
6 changes: 3 additions & 3 deletions src/seedu/addressbook/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

import javafx.application.Application;
import javafx.application.Platform;

import javafx.stage.Stage;

import seedu.addressbook.logic.Logic;
import seedu.addressbook.ui.Gui;
import seedu.addressbook.ui.Stoppable;

/**
* Main entry point to the application.
*/
public class Main extends Application implements Stoppable{
public class Main extends Application implements Stoppable {

/** Version info of the program. */
public static final String VERSION = "League Tracker - Version 1.2";

private Gui gui;

@Override
public void start(Stage primaryStage) throws Exception{
public void start(Stage primaryStage) throws Exception {
gui = new Gui(new Logic(), VERSION);
gui.start(primaryStage, this);
}
Expand Down
26 changes: 17 additions & 9 deletions src/seedu/addressbook/commands/AddCommand.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
package seedu.addressbook.commands;

import seedu.addressbook.data.exception.IllegalValueException;
import seedu.addressbook.data.person.*;
import seedu.addressbook.data.tag.Tag;

import java.util.HashSet;
import java.util.Set;

import seedu.addressbook.data.exception.IllegalValueException;
import seedu.addressbook.data.player.Address;
import seedu.addressbook.data.player.Email;
import seedu.addressbook.data.player.Name;
import seedu.addressbook.data.player.Person;
import seedu.addressbook.data.player.Phone;
import seedu.addressbook.data.player.ReadOnlyPerson;
import seedu.addressbook.data.player.UniquePersonList;
import seedu.addressbook.data.tag.Tag;

/**
* Adds a person to the address book.
* Adds a player to the address book.
*/
public class AddCommand extends Command {

public static final String COMMAND_WORD = "add";

public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Adds a person to the address book. "
public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Adds a player to the address book. "
+ "Contact details can be marked private by prepending 'p' to the prefix.\n\t"
+ "Parameters: NAME [p]p/PHONE [p]e/EMAIL [p]a/ADDRESS [t/TAG]...\n\t"
+ "Example: " + COMMAND_WORD
+ " John Doe p/98765432 e/[email protected] a/311, Clementi Ave 2, #02-25 t/friends t/owesMoney";

public static final String MESSAGE_SUCCESS = "New person added: %1$s";
public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book";
public static final String MESSAGE_SUCCESS = "New player added: %1$s";
public static final String MESSAGE_DUPLICATE_PERSON = "This player already exists in the address book";

private final Person toAdd;

Expand All @@ -48,7 +54,9 @@ public AddCommand(String name,
);
}

public AddCommand(Person toAdd) { this.toAdd = toAdd; }
public AddCommand(Person toAdd) {
this.toAdd = toAdd;
}

public ReadOnlyPerson getPerson() {
return toAdd;
Expand Down
2 changes: 1 addition & 1 deletion src/seedu/addressbook/commands/ClearCommand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package seedu.addressbook.commands;

/**
* Clears the person list in address book.
* Clears the player list in address book.
*/
public class ClearCommand extends Command {

Expand Down
18 changes: 9 additions & 9 deletions src/seedu/addressbook/commands/Command.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package seedu.addressbook.commands;

import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;

import java.util.List;

import seedu.addressbook.common.Messages;
import seedu.addressbook.data.AddressBook;
import seedu.addressbook.data.person.ReadOnlyPerson;
import seedu.addressbook.data.match.ReadOnlyMatch;
import seedu.addressbook.data.player.ReadOnlyPerson;
import seedu.addressbook.data.team.ReadOnlyTeam;

import java.util.List;

import static seedu.addressbook.ui.Gui.DISPLAYED_INDEX_OFFSET;

/**
* Represents an executable command.
*/
Expand All @@ -22,7 +22,7 @@ public abstract class Command {
private int targetIndex = -1;

/**
* @param targetIndex last visible listing index of the target person
* @param targetIndex last visible listing index of the target player
*/
public Command(int targetIndex) {
this.setTargetIndex(targetIndex);
Expand All @@ -47,7 +47,7 @@ public static String getMessageForPersonListShownSummary(List<? extends ReadOnly
public static String getMessageForMatchListShownSummary(List<? extends ReadOnlyMatch> matchesDisplayed) {
return String.format(Messages.MESSAGE_MATCHES_LISTED_OVERVIEW, matchesDisplayed.size());
}

/**
* Constructs a feedback message to summarise an operation that displayed a listing of Teams.
*/
Expand All @@ -58,7 +58,7 @@ public static String getMessageForTeamListShownSummary(List<? extends ReadOnlyTe
/**
* Executes the command and returns the result.
*/
public CommandResult execute(){
public CommandResult execute() {
throw new UnsupportedOperationException("This method should be implement in child classes");
}

Expand All @@ -80,7 +80,7 @@ public void setData(AddressBook addressBook,
}

/**
* Extracts the the target person in the last shown list from the given arguments.
* Extracts the the target player in the last shown list from the given arguments.
*
* @throws IndexOutOfBoundsException if the target index is out of bounds of the last viewed listing
*/
Expand Down
11 changes: 6 additions & 5 deletions src/seedu/addressbook/commands/CommandResult.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package seedu.addressbook.commands;

import seedu.addressbook.data.match.ReadOnlyMatch;
import seedu.addressbook.data.person.ReadOnlyPerson;
import seedu.addressbook.data.team.ReadOnlyTeam;

import java.util.List;
import java.util.Optional;

import seedu.addressbook.data.match.ReadOnlyMatch;
import seedu.addressbook.data.player.ReadOnlyPerson;
import seedu.addressbook.data.team.ReadOnlyTeam;

/**
* Represents the result of a command execution.
*/
Expand All @@ -17,6 +17,7 @@ public class CommandResult {

/** The list of persons that was produced by the command */
private final List<? extends ReadOnlyPerson> relevantPersons;

/** The list of teams that was produced by the command */
private final List<? extends ReadOnlyTeam> relevantTeams;

Expand Down Expand Up @@ -55,7 +56,7 @@ public Optional<List<? extends ReadOnlyPerson>> getRelevantPersons() {
public Optional<List<? extends ReadOnlyMatch>> getRelevantMatches() {
return Optional.ofNullable(relevantMatches);
}

/**
* Returns list of teams relevant to the command command result, if any.
*/
Expand Down
10 changes: 5 additions & 5 deletions src/seedu/addressbook/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package seedu.addressbook.commands;

import seedu.addressbook.common.Messages;
import seedu.addressbook.data.person.ReadOnlyPerson;
import seedu.addressbook.data.person.UniquePersonList.PersonNotFoundException;
import seedu.addressbook.data.player.ReadOnlyPerson;
import seedu.addressbook.data.player.UniquePersonList.PersonNotFoundException;


/**
* Deletes a person identified using it's last displayed index from the address book.
* Deletes a player identified using it's last displayed index from the address book.
*/
public class DeleteCommand extends Command {

public static final String COMMAND_WORD = "delete";

public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n"
+ "Deletes the person identified by the index number used in the last person listing.\n\t"
public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n"
+ "Deletes the player identified by the index number used in the last player listing.\n\t"
+ "Parameters: INDEX\n\t"
+ "Example: " + COMMAND_WORD + " 1";

Expand Down
8 changes: 2 additions & 6 deletions src/seedu/addressbook/commands/FinanceCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
import seedu.addressbook.common.Messages;
import seedu.addressbook.data.finance.Finance;
import seedu.addressbook.data.team.ReadOnlyTeam;
import seedu.addressbook.data.team.UniqueTeamList;
import seedu.addressbook.common.Messages;
import seedu.addressbook.commands.CommandResult;

/**
* check the financial profit in USD of a team identified using it's last displayed index from the League.
*/

public class FinanceCommand extends Command{
public class FinanceCommand extends Command {

public static final String COMMAND_WORD = "finance" ;
public static final String COMMAND_WORD = "finance";

public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n"
+ "Checks the financial condition of a team identified using it's last displayed index from the League.\n\t"
Expand Down Expand Up @@ -41,4 +38,3 @@ public CommandResult execute() {
}

}

8 changes: 6 additions & 2 deletions src/seedu/addressbook/commands/FindCommand.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
package seedu.addressbook.commands;

import seedu.addressbook.data.person.ReadOnlyPerson;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import java.util.*;
import seedu.addressbook.data.player.ReadOnlyPerson;

/**
* Finds and lists all persons in address book whose name contains any of the argument keywords.
Expand Down
15 changes: 12 additions & 3 deletions src/seedu/addressbook/commands/HelpCommand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package seedu.addressbook.commands;


import seedu.addressbook.commands.Team.*;
import seedu.addressbook.commands.match.AddMatchCommand;
import seedu.addressbook.commands.match.ClearMatchCommand;
import seedu.addressbook.commands.match.DeleteMatchCommand;
import seedu.addressbook.commands.match.FindMatchCommand;
import seedu.addressbook.commands.match.ListMatchCommand;
import seedu.addressbook.commands.team.AddTeam;
import seedu.addressbook.commands.team.ClearTeam;
import seedu.addressbook.commands.team.DeleteTeam;
import seedu.addressbook.commands.team.EditTeam;
import seedu.addressbook.commands.team.FindTeam;
import seedu.addressbook.commands.team.ListTeam;

/**
* Shows help instructions.
Expand All @@ -10,7 +19,7 @@ public class HelpCommand extends Command {

public static final String COMMAND_WORD = "help";

public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" +"Shows program usage instructions.\n\t"
public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Shows program usage instructions.\n\t"
+ "Example: " + COMMAND_WORD;

public static final String MESSAGE_ALL_USAGES = AddCommand.MESSAGE_USAGE
Expand Down
4 changes: 2 additions & 2 deletions src/seedu/addressbook/commands/IncorrectCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
/**
* Represents an incorrect command. Upon execution, produces some feedback to the user.
*/
public class IncorrectCommand extends Command{
public class IncorrectCommand extends Command {

public final String feedbackToUser;

public IncorrectCommand(String feedbackToUser){
public IncorrectCommand(String feedbackToUser) {
this.feedbackToUser = feedbackToUser;
}

Expand Down
6 changes: 3 additions & 3 deletions src/seedu/addressbook/commands/ListCommand.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package seedu.addressbook.commands;

import seedu.addressbook.data.person.ReadOnlyPerson;

import java.util.List;

import seedu.addressbook.data.player.ReadOnlyPerson;

/**
* Lists all persons in the address book to the user.
*/
public class ListCommand extends Command {

public static final String COMMAND_WORD = "list";

public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n"
public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n"
+ "Displays all persons in the address book as a list with index numbers.\n\t"
+ "Example: " + COMMAND_WORD;

Expand Down
10 changes: 5 additions & 5 deletions src/seedu/addressbook/commands/ViewAllCommand.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package seedu.addressbook.commands;

import seedu.addressbook.common.Messages;
import seedu.addressbook.data.person.ReadOnlyPerson;
import seedu.addressbook.data.player.ReadOnlyPerson;


/**
* Shows all details of the person identified using the last displayed index.
* Shows all details of the player identified using the last displayed index.
* Private contact details are shown.
*/
public class ViewAllCommand extends Command {

public static final String COMMAND_WORD = "viewall";

public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Shows all details of the person "
+ "identified by the index number in the last shown person listing.\n\t"
public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Shows all details of the player "
+ "identified by the index number in the last shown player listing.\n\t"
+ "Parameters: INDEX\n\t"
+ "Example: " + COMMAND_WORD + " 1";

public static final String MESSAGE_VIEW_PERSON_DETAILS = "Viewing person: %1$s";
public static final String MESSAGE_VIEW_PERSON_DETAILS = "Viewing player: %1$s";


public ViewAllCommand(int targetVisibleIndex) {
Expand Down
10 changes: 5 additions & 5 deletions src/seedu/addressbook/commands/ViewCommand.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package seedu.addressbook.commands;

import seedu.addressbook.common.Messages;
import seedu.addressbook.data.person.ReadOnlyPerson;
import seedu.addressbook.data.player.ReadOnlyPerson;


/**
* Shows details of the person identified using the last displayed index.
* Shows details of the player identified using the last displayed index.
* Private contact details are not shown.
*/
public class ViewCommand extends Command {

public static final String COMMAND_WORD = "view";

public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Shows the non-private details of the person "
+ "identified by the index number in the last shown person listing.\n\t"
public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n" + "Shows the non-private details of the player "
+ "identified by the index number in the last shown player listing.\n\t"
+ "Parameters: INDEX\n\t"
+ "Example: " + COMMAND_WORD + " 1";

public static final String MESSAGE_VIEW_PERSON_DETAILS = "Viewing person: %1$s";
public static final String MESSAGE_VIEW_PERSON_DETAILS = "Viewing player: %1$s";


public ViewCommand(int targetVisibleIndex) {
Expand Down
Loading

0 comments on commit 8ff7c96

Please sign in to comment.