Class Track

  • All Implemented Interfaces:
    de.hirola.kintojava.model.KintoModel

    public class Track
    extends PersistentObject
    Copyright 2021 by Michael Schmidt, Hirola Consulting This software us licensed unter the AGPL-3.0 or later. A track for trainings. Tracks can be imported or recorded.
    Since:
    1.1.1
    Author:
    Michael Schmidt (Hirola)
    • Constructor Detail

      • Track

        public Track()
        Default constructor for reflection.
      • Track

        public Track​(String name,
                     String description,
                     long startTime)
        Create a track to start recording.
        Parameters:
        name - of track
        description - of track
        startTime - of track
      • Track

        public Track​(String name,
                     String description,
                     long startTime,
                     long stopTime,
                     @Nullable
                     @Nullable List<LocationData> locations)
        Create a recorded and completed track. The location of the tack can be empty.
        Parameters:
        name - of track
        description - of track
        startTime - of track
        stopTime - of track
        locations - of track, can be null
      • Track

        public Track​(@NotNull
                     @NotNull String name,
                     @Nullable
                     @Nullable String description,
                     @Nullable
                     @Nullable java.time.LocalDate importDate,
                     @NotNull
                     @NotNull List<LocationData> locations)
        Create an imported track. The start and end time is determined from the locations. If no import date given, the current date will be set.
        Parameters:
        name - of track
        description - of track
        importDate - of track
        locations - of track
      • Track

        public Track​(@NotNull
                     @NotNull String name,
                     @Nullable
                     @Nullable String description,
                     @Nullable
                     @Nullable java.time.LocalDate importDate,
                     long startTime,
                     long stopTime,
                     double avg,
                     double distance,
                     @NotNull
                     @NotNull List<LocationData> locations)
        Create an imported track. If no import date given, the current date will be set.
        Parameters:
        name - of track
        description - of track
        importDate - of track
        stopTime - of track
        avg - of track
        distance - of track
        locations - of track
    • Method Detail

      • getTrackId

        @Nullable
        public Track.Id getTrackId()
        Get the temporary id of the track. This id is using while recording and temporary saving in local datastore.
        Returns:
        The id for the track while recording and temporary saving.
      • setTrackId

        public void setTrackId​(Track.Id trackId)
        Set the temporary track id for recording a track. The id will not be saved permanently.
        Parameters:
        trackId - The temporary id
      • getName

        public String getName()
        Get the name the track.
        Returns:
        The name of the track
      • setName

        public void setName​(String name)
        Set the name of the track.
        Parameters:
        name - of the track.
      • getDescription

        public String getDescription()
        Get the name the track.
        Returns:
        The name of the track
      • setDescription

        public void setDescription​(String description)
        Set the description of the track.
        Parameters:
        description - of the track.
      • getStartTime

        public long getStartTime()
        Get the start time the track in milliseconds to UTC Time or -1 if no time is set.
        Returns:
        The start time of the track in milliseconds to UTC Time
      • setStartTime

        public void setStartTime​(long startTime)
        Set the start time of the track in milliseconds to UTC Time.
        Parameters:
        startTime - of the track
      • getStopTime

        public long getStopTime()
        Get the stop time the track in milliseconds to UTC Time or -1 if no time is set.
        Returns:
        The stop time of the track
      • setStopTime

        public void setStopTime​(long stopTime)
        Set the stop time of the track in milliseconds to UTC Time.
        Parameters:
        stopTime - of the track.
      • getDistance

        public double getDistance()
        Get the distance of the track in meters. If not set (-1), the duration will calculate from the locations.
        Returns:
        The distance of the track in meters
      • setDistance

        public void setDistance​(double distance)
        Set the distance of the track in meters.
        Parameters:
        distance - of the track in meters
      • getAverageSpeed

        public double getAverageSpeed()
        Get the average speed of the track in km/h. If not set (-1), the speed will calculate from the individual speeds of the locations.
        Returns:
        The average speed of the track in km/h
      • setAverageSpeed

        public void setAverageSpeed​(double speed)
        Set the average speed of the track in km/h.
        Parameters:
        speed - of the track in km/h
      • getAltitudeDifference

        public double getAltitudeDifference()
        Get the altitudeDifference of the track in meter. If not set (-1), the altitude difference will calculate from the individual altitude difference of the locations.
        Returns:
        The average speed of the track in km/h
      • setAltitudeDifference

        public void setAltitudeDifference​(double altitudeDifference)
        Set the altitudeDifference of the track in meter.
        Parameters:
        altitudeDifference - of the track in meter
      • getImportDate

        public java.time.LocalDate getImportDate()
        Get the import date of the track.
        Returns:
        The import date of the track
      • getLocations

        public List<LocationData> getLocations()
        Get the locations of the track.
        Returns:
        The locations of the track
      • 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