Package de.hirola.sportslibrary.model
Class RunningPlan
- java.lang.Object
-
- de.hirola.kintojava.model.KintoObject
-
- de.hirola.sportslibrary.PersistentObject
-
- de.hirola.sportslibrary.model.RunningPlan
-
- All Implemented Interfaces:
de.hirola.kintojava.model.KintoModel
public class RunningPlan extends PersistentObject
Copyright 2021 by Michael Schmidt, Hirola Consulting This software us licensed under the AGPL-3.0 or later. Represents a running plan. Plans are included as templates, which I kindly took from his with the permission of Mr. Christian Zangl ([lauftipps.ch](https://lauftipps.ch/trainingsplaene/alle-trainingsplaene-auf-einen-blick)). Users can create their own plans.- Since:
- 1.1.1
- Author:
- Michael Schmidt (Hirola)
-
-
Constructor Summary
Constructors Constructor Description RunningPlan()Default constructor for reflection.RunningPlan(String name, String remarks, int orderNumber, ArrayList<RunningPlanEntry> entries, boolean isTemplate)Creates a running plan.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddEntry(RunningPlanEntry runningPlanEntry)Add a training entry to the plan.booleanequals(Object o)longgetDuration()Total duration for all training segments in minutes.List<RunningPlanEntry>getEntries()Get the entries (days) of the plan.List<String>getIdentityAttributeNames()Get a list of all (persistent) attribute names of the objectStringgetName()Get the name of the plan.intgetOrderNumber()Get the training order number of the plan.StringgetRemarks()Get the remarks of the plan.java.time.LocalDategetStartDate()Get the start date of the plan.inthashCode()booleanisActive()Indicates whether the schedule is selected and used.booleanisCompleted()Indicates whether the run plan has already been completed, i.e. has been carried out.booleanisTemplate()Get a flag, if the plan is a template.intpercentCompleted()Get the (rounded) percentage of completed training sessions.List<RunningPlanEntry>runningPlanEntriesForWeek(int forWeek)Returns all training units (all days) of the given week.voidsetName(String name)Set the name of the plan.voidsetOrderNumber(int orderNumber)Set the orderNumber of the plan.voidsetRemarks(String remarks)Set the remarks of the plan.voidsetStartDate(java.time.LocalDate startDate)Set the start date of the plan.
-
-
-
Constructor Detail
-
RunningPlan
public RunningPlan()
Default constructor for reflection.
-
RunningPlan
public RunningPlan(String name, String remarks, int orderNumber, ArrayList<RunningPlanEntry> entries, boolean isTemplate)
Creates a running plan.- Parameters:
name- of planremarks- of planorderNumber- of planentries- of planisTemplate- can the plan be changed or deleted
-
-
Method Detail
-
getName
public String getName()
Get the name of the plan.- Returns:
- Name of the plan.
-
setName
public void setName(String name)
Set the name of the plan.- Parameters:
name- of the plan
-
getRemarks
public String getRemarks()
Get the remarks of the plan.- Returns:
- Remarks of the plan.
-
setRemarks
public void setRemarks(String remarks)
Set the remarks of the plan.- Parameters:
remarks- of the plan
-
getOrderNumber
public int getOrderNumber()
Get the training order number of the plan.- Returns:
- Order number of the plan.
-
setOrderNumber
public void setOrderNumber(int orderNumber)
Set the orderNumber of the plan. Determines the order of training.- Parameters:
orderNumber- of the plan
-
getStartDate
public java.time.LocalDate getStartDate()
Get the start date of the plan.- Returns:
- start date of the plan.
-
setStartDate
public void setStartDate(java.time.LocalDate startDate)
Set the start date of the plan.- Parameters:
startDate- of the plan
-
getEntries
public List<RunningPlanEntry> getEntries()
Get the entries (days) of the plan.- Returns:
- Entries (days) of the plan.
- See Also:
RunningPlanEntry
-
addEntry
public void addEntry(RunningPlanEntry runningPlanEntry)
Add a training entry to the plan.- Parameters:
runningPlanEntry- to be added- See Also:
RunningPlanEntry
-
isTemplate
public boolean isTemplate()
Get a flag, if the plan is a template. Templates must be not changed or deleted.- Returns:
- A flag to determine if plan a template
-
percentCompleted
public int percentCompleted()
Get the (rounded) percentage of completed training sessions.- Returns:
- The (rounded) percentage of completed training sessions
-
getDuration
public long getDuration()
Total duration for all training segments in minutes.- Returns:
- Duration for all training units in minutes
-
isActive
public boolean isActive()
Indicates whether the schedule is selected and used. The value is true if the start date has been set and at least one session has been completed. An active plan is assigned to the user.- Returns:
- A flag to determine if plan is active in training.
- See Also:
User
-
isCompleted
public boolean isCompleted()
Indicates whether the run plan has already been completed, i.e. has been carried out. Automaticallytrueif all sessions have been completed.- Returns:
- A flag to determine if the plan is completed
-
runningPlanEntriesForWeek
public List<RunningPlanEntry> runningPlanEntriesForWeek(int forWeek)
Returns all training units (all days) of the given week.- Parameters:
forWeek- week for which the units are to be determined- Returns:
- List of all training sessions for the given week
- See Also:
RunningPlanEntry
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classde.hirola.kintojava.model.KintoObject
-
hashCode
public int hashCode()
- Overrides:
hashCodein classde.hirola.kintojava.model.KintoObject
-
getIdentityAttributeNames
public List<String> getIdentityAttributeNames()
Description copied from class:PersistentObjectGet a list of all (persistent) attribute names of the object- Specified by:
getIdentityAttributeNamesin classPersistentObject- Returns:
- A list of all (persistent) attribute names of the object
-
-