com.drismo.model
Class Trip

java.lang.Object
  extended by com.drismo.model.Trip

public class Trip
extends java.lang.Object

Model of a trip, containing all elements for viewing a trip. This class also handles reading a trip from a file.


Field Summary
private  int[] colorArray
           
private  android.content.Context context
           
private  java.lang.String fileName
           
private  boolean gpsCordsAvailable
           
private  float[] latitudeArray
           
private  float[] longitudeArray
           
private  java.util.ArrayList<MapPoint> pointList
           
private  int refreshRate
           
private  int[] scoreArray
           
private  int[] shortColorArray
           
private  float[] speedArray
           
private  float tripLength
           
 
Constructor Summary
Trip(java.lang.String filename, android.content.Context c)
          Load a trip by reading the specified file.
 
Method Summary
 java.lang.String buildFacebookShare(int score, java.lang.String duration, java.lang.String tripLength, int avgSpeed, int maxSpeed, java.lang.String speedUnit, java.lang.String fromCity, java.lang.String fromStreet, java.lang.String toCity, java.lang.String toStreet)
          Build a trip summary string to share on Facebook.
 int[] getColorArray()
           
 java.lang.String getDestinationCity()
           
 java.lang.String getDestinationStreet()
           
 float[] getLatitudeArray()
           
 float[] getLongitudeArray()
           
 int getRefreshRate()
           
 int[] getScoreArray()
           
 int[] getShortColorArray()
           
 float[] getSpeedArray()
           
 java.lang.String getStartCity()
           
 java.lang.String getStartStreet()
           
 float getTripLengthInKM()
           
 float getTripLengthInMeters()
           
 java.lang.String getTripSummary()
           
 boolean isGpsCordsAvailable()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pointList

private final java.util.ArrayList<MapPoint> pointList

refreshRate

private final int refreshRate

scoreArray

private final int[] scoreArray

colorArray

private final int[] colorArray

speedArray

private final float[] speedArray

gpsCordsAvailable

private boolean gpsCordsAvailable

shortColorArray

private final int[] shortColorArray

latitudeArray

private final float[] latitudeArray

longitudeArray

private final float[] longitudeArray

tripLength

private float tripLength

context

private android.content.Context context

fileName

private java.lang.String fileName
Constructor Detail

Trip

public Trip(java.lang.String filename,
            android.content.Context c)
     throws java.io.IOException
Load a trip by reading the specified file.

Parameters:
filename - The given file name to read.
c - Context requesting the trip.
Throws:
java.io.IOException - If reading fails an IOException is thrown.
Method Detail

getRefreshRate

public int getRefreshRate()

getScoreArray

public int[] getScoreArray()

getColorArray

public int[] getColorArray()

getSpeedArray

public float[] getSpeedArray()

isGpsCordsAvailable

public boolean isGpsCordsAvailable()

getShortColorArray

public int[] getShortColorArray()

getLatitudeArray

public float[] getLatitudeArray()

getLongitudeArray

public float[] getLongitudeArray()

getTripLengthInMeters

public float getTripLengthInMeters()

getTripLengthInKM

public float getTripLengthInKM()

getStartCity

public java.lang.String getStartCity()

getDestinationCity

public java.lang.String getDestinationCity()

getStartStreet

public java.lang.String getStartStreet()

getDestinationStreet

public java.lang.String getDestinationStreet()

getTripSummary

public java.lang.String getTripSummary()

buildFacebookShare

public java.lang.String buildFacebookShare(int score,
                                           java.lang.String duration,
                                           java.lang.String tripLength,
                                           int avgSpeed,
                                           int maxSpeed,
                                           java.lang.String speedUnit,
                                           java.lang.String fromCity,
                                           java.lang.String fromStreet,
                                           java.lang.String toCity,
                                           java.lang.String toStreet)
Build a trip summary string to share on Facebook.

Parameters:
score - The average quality rating.
duration - Trip duration, as a human readable string.
tripLength - Trip length, as a human readable string.
avgSpeed - Average speed.
maxSpeed - Maximum speed.
speedUnit - Speed unit to display with avgSpeed and maxSpeed.
fromCity - City where the GPS-monitoring first started.
fromStreet - Nearest street to where the GPS-monitoring first started.
toCity - City of the last GPS-reading.
toStreet - Nearest street to last GPS-reading.
Returns:
A short trip summary.
See Also:
Config.getSpeedConv(), Config.getSpeedUnit()