Created
October 4, 2010 11:26
-
-
Save sbuys/609542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Run { | |
int id; | |
String startTime; | |
String distance; | |
String duration; | |
int heartAvg; | |
int heartMin; | |
int heartMax; | |
String date; | |
String time; | |
float distanceK; | |
float distanceM; | |
float durationFloat; | |
int durationMinutes, durationSeconds; | |
//unit conversion | |
float k_to_m_conversion=1/1.609344; | |
Run(int _id, String _startTime, String _distance, String _duration, int _heartAvg, int _heartMin, int _heartMax){ | |
id = _id; | |
startTime = _startTime; | |
distance = _distance; | |
duration = _duration; | |
heartAvg = _heartAvg; | |
heartMin = _heartMin; | |
heartMax = _heartMax; | |
//startTime --> date/time | |
String[] splitTime = split(startTime,"T"); | |
date = splitTime[0]; | |
time = splitTime[1]; | |
//Distance | |
distanceK = Float.parseFloat(distance); | |
distanceM = distanceK*k_to_m_conversion; | |
//Duration | |
durationFloat = Float.parseFloat(duration); | |
durationMinutes = floor(durationFloat/1000/60); | |
durationSeconds = round((durationFloat/1000/60-durationMinutes)*60); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment