Package de.hirola.sportslibrary.model
Class Track
- java.lang.Object
-
- de.hirola.kintojava.model.KintoObject
-
- de.hirola.sportslibrary.PersistentObject
-
- de.hirola.sportslibrary.model.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)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTrack.IdThe temporary id for the track.
-
Constructor Summary
Constructors Constructor Description Track()Default constructor for reflection.Track(@NotNull String name, @Nullable String description, @Nullable java.time.LocalDate importDate, long startTime, long stopTime, double avg, double distance, @NotNull List<LocationData> locations)Create an imported track.Track(@NotNull String name, @Nullable String description, @Nullable java.time.LocalDate importDate, @NotNull List<LocationData> locations)Create an imported track.Track(String name, String description, long startTime)Create a track to start recording.Track(String name, String description, long startTime, long stopTime, @Nullable List<LocationData> locations)Create a recorded and completed track.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)doublegetAltitudeDifference()Get the altitudeDifference of the track in meter.doublegetAverageSpeed()Get the average speed of the track in km/h.StringgetDescription()Get the name the track.doublegetDistance()Get the distance of the track in meters.List<String>getIdentityAttributeNames()Get a list of all (persistent) attribute names of the objectjava.time.LocalDategetImportDate()Get the import date of the track.List<LocationData>getLocations()Get the locations of the track.StringgetName()Get the name the track.longgetStartTime()Get the start time the track in milliseconds to UTC Time or -1 if no time is set.longgetStopTime()Get the stop time the track in milliseconds to UTC Time or -1 if no time is set.Track.IdgetTrackId()Get the temporary id of the track.inthashCode()voidsetAltitudeDifference(double altitudeDifference)Set the altitudeDifference of the track in meter.voidsetAverageSpeed(double speed)Set the average speed of the track in km/h.voidsetDescription(String description)Set the description of the track.voidsetDistance(double distance)Set the distance of the track in meters.voidsetName(String name)Set the name of the track.voidsetStartTime(long startTime)Set the start time of the track in milliseconds to UTC Time.voidsetStopTime(long stopTime)Set the stop time of the track in milliseconds to UTC Time.voidsetTrackId(Track.Id trackId)Set the temporary track id for recording a track.
-
-
-
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 trackdescription- of trackstartTime- 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 trackdescription- of trackstartTime- of trackstopTime- of tracklocations- 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 trackdescription- of trackimportDate- of tracklocations- 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 trackdescription- of trackimportDate- of trackstopTime- of trackavg- of trackdistance- of tracklocations- 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:
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
-
-