Skip to content

Commit

Permalink
Updated pom with plugins, javadoc completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Errelian committed Apr 13, 2021
1 parent e2bc9d2 commit 2bb634a
Show file tree
Hide file tree
Showing 22 changed files with 358 additions and 145 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ target/
sessionSaveTest.json

test.json

.gradle/
17 changes: 17 additions & 0 deletions checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="SuppressWithPlainTextCommentFilter" />
<module name="JavadocPackage" />
<module name="TreeWalker">
<module name="JavadocVariable">
<property name="scope" value="public" />
</module>
<module name="MissingJavadocType" />
<module name="MissingJavadocMethod" />
<module name="MissingJavadocPackage" />
<module name="JavadocType" />
<module name="JavadocMethod" />
<module name="JavadocStyle" />
</module>
</module>
77 changes: 75 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<groupId>fitnessTracker2</groupId>
<artifactId>fitnessTracker2</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
<packaging>jar</packaging>

<name>fitnessTracker2</name>
Expand Down Expand Up @@ -84,7 +84,10 @@

</dependencies>


<build>


<plugins>
<!-- adds file to let you run program outside of IDE -->
<plugin>
Expand Down Expand Up @@ -128,7 +131,7 @@
<configuration>
<archive>
<manifest>
<mainClass>${mainClass}</mainClass>
<mainClass>fitnessTracker2.MainApp</mainClass>
</manifest>
</archive>
<outputDirectory>${project.build.directory}/modules</outputDirectory>
Expand Down Expand Up @@ -191,6 +194,76 @@
<version>0.8.6</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>3.0.0</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.22.2</version>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
</configuration>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<goals>
<goal>
check
</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>fitnessTracker2.MainApp</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>

</plugins>
</build>


</project>
41 changes: 40 additions & 1 deletion src/main/java/fitnessTracker2/AddFxmlController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,35 @@
import java.util.Map;
import java.util.ResourceBundle;

/**
* Controller class for add.fxml.
*/
public class AddFxmlController implements Initializable {

/**
*ChoiceBox to select the exercise type.
*/
@FXML
public ChoiceBox<String> exerciseTypeChoiceBox;
/**
*ChoiceBox to select the exercise intensity.
*/
@FXML
public ChoiceBox<String> intensityChoiceBox;

/**
* TexField to get the session name.
*/
@FXML
public TextField exerciseSessionNameField;
/**
* TexField to get the session duration.
*/
@FXML
public TextField exerciseDurationNameField;

/**
*JavaFX DataPicker to easily select a date.
*/
@FXML
public DatePicker datePicker;

Expand All @@ -53,6 +70,11 @@ private void initializeMap(){
}


/**
*
* @param Durations jsr310 duration read from the TextField
* @return whatever the duration was a valid one or not
*/
public boolean validDuration(String Durations){

if(Durations != null && !(Durations.equals("")) && InputChecker.onlyFloat(Durations))
Expand Down Expand Up @@ -83,6 +105,10 @@ public boolean validDuration(String Durations){
}
}

/**
* @param localDate jsr310 LocalDate read from DatePicker
* @return whatever the date reading was valid or not
*/
public boolean validDate(LocalDate localDate){

if (localDate != null)
Expand Down Expand Up @@ -154,6 +180,12 @@ private boolean readIntensityChoiceBox(){
return false;
}

/**
* @param weight The weight of the person in Kilograms
* @param cost The KCaloric base cost of the exercise for a 70kg person.
* @param intensity The Intensity read from the UI, can be either 0.75, 1.00 or 1.25
* @return The calculated KCaloric cost.
*/
public static double calcCalorie(double weight, double cost, double intensity){
return Math.round((weight / 70.0) * cost * intensity *10.0) / 10.0;
}
Expand All @@ -173,6 +205,10 @@ private boolean setCalories(){
}
}

/**
* The action that executes when the button is clicked.
* @param event The event that happens when the button is used.
*/
@FXML
public void saveButtonAction(ActionEvent event) {

Expand Down Expand Up @@ -213,6 +249,9 @@ && readIntensityChoiceBox() && setCalories())
}
}

/**
* Simple clearing of the TextFields for clarity.
*/
@FXML
public void onClickReset(){
exerciseSessionNameField.setPromptText("Session Name");
Expand Down
22 changes: 21 additions & 1 deletion src/main/java/fitnessTracker2/EditFxmlController.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,24 @@
import java.util.ArrayList;
import java.util.ResourceBundle;

/**
* Controller class for edit.fxml.
*/
public class EditFxmlController implements Initializable {

/**
* Temporary variable.
*/
public String tempExercise = "";

/**
* Temporary variable.
*/
public Integer tempCalorie = -1;

/**
* Simple clearing action for clarity.
*/
@FXML
public void onClickTextField(){

Expand All @@ -36,12 +48,20 @@ public void onClickTextField(){
Logger.info("edit Textfields reset!");
}

/**
* TextField for reading the exercise type name.
*/
@FXML
public TextField exerciseNameField;

/**
* TextField for reading the exercise type KCaloric cost.
*/
@FXML
public TextField exerciseCalorieField;

/**
* The Save button.
*/
@FXML
public javafx.scene.control.Button saveButton;

Expand Down
15 changes: 12 additions & 3 deletions src/main/java/fitnessTracker2/Exercise.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
package fitnessTracker2;

@lombok.Data
@lombok.AllArgsConstructor
@lombok.NoArgsConstructor

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
* Simple class to hold all needed information about an exercise type.
* Getters/Setters and Constructors generated with Lombok.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Exercise {

private String name;
Expand Down
14 changes: 11 additions & 3 deletions src/main/java/fitnessTracker2/ExerciseSession.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
package fitnessTracker2;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.Duration;
import java.time.LocalDate;

@lombok.Data
@lombok.AllArgsConstructor
@lombok.NoArgsConstructor
/**
* Simple class to hold all needed information about an Exercise Session.
* Getters/Setters and Constructors generated with Lombok.
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ExerciseSession {

private Integer code;
Expand Down
23 changes: 22 additions & 1 deletion src/main/java/fitnessTracker2/ExerciseSessionWrapper.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
package fitnessTracker2;

import lombok.Data;

import java.util.ArrayList;

@lombok.Data
/**
* A Wrapper for Exercise Sessions, so it can be static.
* Lombok generated Data.
*/
@Data
public class ExerciseSessionWrapper {
/**
* The static Array that holds all the Exercise Sessions.
*/
public static ArrayList<ExerciseSession> exerciseSessionArrayList;

/**
* Simple parameterized constructor.
* @param exerciseSession The Session to be added.
*/

public ExerciseSessionWrapper(ExerciseSession exerciseSession){

exerciseSessionArrayList = new ArrayList<ExerciseSession>(){
Expand All @@ -16,9 +30,16 @@ public ExerciseSessionWrapper(ExerciseSession exerciseSession){

}

/**
* No Args constructor.
*/
public ExerciseSessionWrapper() {
}

/**
* Simple add method, deprecated.
* @param exerciseSession the Exercise Session to be added.
*/
public static void append(ExerciseSession exerciseSession){

exerciseSessionArrayList.add(exerciseSession);
Expand Down
Loading

0 comments on commit 2bb634a

Please sign in to comment.