Skip to content

Commit

Permalink
Merge pull request #181 from zzybluebell/java-doc
Browse files Browse the repository at this point in the history
Java doc update
  • Loading branch information
zzybluebell authored Nov 4, 2021
2 parents 39d1bd1 + 6307c31 commit 6dc6607
Show file tree
Hide file tree
Showing 112 changed files with 2,213 additions and 107 deletions.
2 changes: 1 addition & 1 deletion docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ If your changes to the data file makes its format invalid, ezFoodie will discard
## FAQ

**Q**: How do I transfer my data to another Computer?<br>
**A**: Install the application in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous AddressBook home folder.
**A**: Install the application in the other computer and overwrite the empty data file it creates with the file that contains the data of your previous ezFoodie home folder.

--------------------------------------------------------------------------------------------------------------------

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/seedu/address/AppParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public static AppParameters parse(Application.Parameters parameters) {
return appParameters;
}

/**
* Overrides equals method.
*/
@Override
public boolean equals(Object other) {
if (other == this) {
Expand All @@ -74,6 +77,9 @@ public boolean equals(Object other) {
&& Objects.equals(getAccountPath(), otherAppParameters.getAccountPath());
}

/**
* Overrides hashCode.
*/
@Override
public int hashCode() {
return Objects.hash(configPath, accountPath);
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/seedu/address/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
* to be the entry point of the application, we avoid this issue.
*/
public class Main {
/**
* Starts main application.
*/
public static void main(String[] args) {
Application.launch(MainApp.class, args);
}
Expand Down
33 changes: 31 additions & 2 deletions src/main/java/seedu/address/commons/core/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,51 @@
import java.util.logging.Level;

/**
* Config values used by the app
* Config values used by the application
*/
public class Config {

/**
* Gets the default config json file.
*/
public static final Path DEFAULT_CONFIG_FILE = Paths.get("config.json");

// Config values customizable through config file
private Level logLevel = Level.INFO;
private Path userPrefsFilePath = Paths.get("preferences.json");

/**
* Gets Log Level from {@code logLevel}.
*/
public Level getLogLevel() {
return logLevel;
}

/**
* Sets Log Level from {@code logLevel}.
*/
public void setLogLevel(Level logLevel) {
this.logLevel = logLevel;
}

/**
* Gets User Prefs File Path from {@code userPrefsFilePath}.
*
* @return Path of tge user prefs file path
*/
public Path getUserPrefsFilePath() {
return userPrefsFilePath;
}

/**
* Sets User Prefs File Path from {@code userPrefsFilePath}.
*/
public void setUserPrefsFilePath(Path userPrefsFilePath) {
this.userPrefsFilePath = userPrefsFilePath;
}

/**
* Overrides the equal method for Config class.
*/
@Override
public boolean equals(Object other) {
if (other == this) {
Expand All @@ -47,11 +66,21 @@ public boolean equals(Object other) {
&& Objects.equals(userPrefsFilePath, o.userPrefsFilePath);
}

/**
* Overrides hashcode method for Config class.
*
* @return int objects after hashed with logLevel and userPrefsFilePath
*/
@Override
public int hashCode() {
return Objects.hash(logLevel, userPrefsFilePath);
}

/**
* Overrides toString method for Config class.
*
* @return String the log level and Config file location
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/seedu/address/commons/core/GuiSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,36 @@ public GuiSettings(double windowWidth, double windowHeight, int xPosition, int y
windowCoordinates = new Point(xPosition, yPosition);
}

/**
* Gets GUI window width.
*
* @return double the width of window
*/
public double getWindowWidth() {
return windowWidth;
}

/**
* Gets GUI window height.
*
* @return double the height of window
*/
public double getWindowHeight() {
return windowHeight;
}

/**
* Gets GUI window coordinates.
*
* @return Point
*/
public Point getWindowCoordinates() {
return windowCoordinates != null ? new Point(windowCoordinates) : null;
}

/**
* Overrides the equal method for GuiSettings.
*/
@Override
public boolean equals(Object other) {
if (other == this) {
Expand All @@ -63,11 +81,21 @@ public boolean equals(Object other) {
&& Objects.equals(windowCoordinates, o.windowCoordinates);
}

/**
* Overrides the hashCode method
*
* @return int objects after hashed with windowWidth, windowHeight and windowCoordinates.
*/
@Override
public int hashCode() {
return Objects.hash(windowWidth, windowHeight, windowCoordinates);
}

/**
* Overrides the toString Method for GuiSettings.
*
* @return String including all width, height and Position
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/commons/core/LogsCenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static void addConsoleHandler(Logger logger) {
}

/**
* Remove all the handlers from {@code logger}.
* Removes all the handlers from {@code logger}.
*/
private static void removeHandlers(Logger logger) {
Arrays.stream(logger.getHandlers())
Expand All @@ -95,6 +95,7 @@ private static void addFileHandler(Logger logger) {

/**
* Creates a {@code FileHandler} for the log file.
*
* @throws IOException if there are problems opening the file.
*/
private static FileHandler createFileHandler() throws IOException {
Expand Down
32 changes: 31 additions & 1 deletion src/main/java/seedu/address/commons/core/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,44 @@
* Container for user visible messages.
*/
public class Messages {

/**
* Represents the MESSAGE_UNKNOWN_COMMAND.
*/
public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";

/**
* Represents the MESSAGE_INVALID_COMMAND_FORMAT.
*/
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";

/**
* Represents the MESSAGE_INVALID_MEMBER_DISPLAYED_INDEX.
*/
public static final String MESSAGE_INVALID_MEMBER_DISPLAYED_INDEX = "The member index provided is invalid";

/**
* Represents the MESSAGE_INVALID_MEMBER_DISPLAYED_ID.
*/
public static final String MESSAGE_INVALID_MEMBER_DISPLAYED_ID = "The member ID provided is invalid";

/**
* Represents the MESSAGE_INVALID_TRANSACTION_DISPLAYED_ID.
*/
public static final String MESSAGE_INVALID_TRANSACTION_DISPLAYED_ID = "The transaction ID provided is invalid";

/**
* Represents the MESSAGE_INVALID_RESERVATION_DISPLAYED_ID.
*/
public static final String MESSAGE_INVALID_RESERVATION_DISPLAYED_ID = "The reservation ID provided is invalid";

/**
* Represents the MESSAGE_MEMBERS_LISTED_OVERVIEW.
*/
public static final String MESSAGE_MEMBERS_LISTED_OVERVIEW = "%1$d members listed!";

/**
* Represents the MESSAGE_PERMISSION_DENIED.
*/
public static final String MESSAGE_PERMISSION_DENIED = "Permission denied! Please login as " + LoginStatus.MANAGER;

}
40 changes: 39 additions & 1 deletion src/main/java/seedu/address/commons/core/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
import com.fasterxml.jackson.annotation.JsonValue;

/**
* Represents a version with major, minor and patch number
* Represents a version with major, minor and patch number.
*/
public class Version implements Comparable<Version> {

/**
* Sets the version regex.
*/
public static final String VERSION_REGEX = "V(\\d+)\\.(\\d+)\\.(\\d+)(ea)?";

private static final String EXCEPTION_STRING_NOT_VERSION = "String is not a valid Version. %s";
Expand All @@ -32,24 +35,45 @@ public Version(int major, int minor, int patch, boolean isEarlyAccess) {
this.isEarlyAccess = isEarlyAccess;
}

/**
* Gets the major from {@code major}.
*
* @return int of the major
*/
public int getMajor() {
return major;
}

/**
* Gets the minor from {@code minor}.
*
* @return int of the minor.
*/
public int getMinor() {
return minor;
}

/**
* Gets the patch from {@code patch}.
*
* @return int of the patch
*/
public int getPatch() {
return patch;
}

/**
* Returns whether is early access.
*
* @return boolean ture is early access.
*/
public boolean isEarlyAccess() {
return isEarlyAccess;
}

/**
* Parses a version number string in the format V1.2.3.
*
* @param versionString version number string
* @return a Version object
*/
Expand All @@ -67,11 +91,19 @@ public static Version fromString(String versionString) throws IllegalArgumentExc
versionMatcher.group(4) == null ? false : true);
}

/**
* Overrides the toString for Version class.
*
* @return String for Version
*/
@JsonValue
public String toString() {
return String.format("V%d.%d.%d%s", major, minor, patch, isEarlyAccess ? "ea" : "");
}

/**
* Overrides the compareTo method for Version class.
*/
@Override
public int compareTo(Version other) {
if (major != other.major) {
Expand All @@ -92,6 +124,9 @@ public int compareTo(Version other) {
return 1;
}

/**
* Overrides the equal method for Version class.
*/
@Override
public boolean equals(Object obj) {
if (obj == null) {
Expand All @@ -105,6 +140,9 @@ public boolean equals(Object obj) {
return compareTo(other) == 0;
}

/**
* Overrides the hashCode for Version class.
*/
@Override
public int hashCode() {
String hash = String.format("%03d%03d%03d", major, minor, patch);
Expand Down
Loading

0 comments on commit 6dc6607

Please sign in to comment.