Class 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 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 plan
        remarks - of plan
        orderNumber - of plan
        entries - of plan
        isTemplate - 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
      • 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. Automatically true if 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:
        equals in class de.hirola.kintojava.model.KintoObject
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class de.hirola.kintojava.model.KintoObject