public class CrimeRecord
extends java.lang.Object
Constructor and Description |
---|
CrimeRecord()
This constructor performs default initialization to all members.
|
CrimeRecord(double x,
double y,
int time,
java.lang.String street,
java.lang.String offense,
java.lang.String date,
java.lang.String tract,
double lat,
double lon)
This constructor sets all members of a CrimeRecord object.
|
Modifier and Type | Method and Description |
---|---|
static double |
distanceBetween(CrimeRecord a,
CrimeRecord b)
pre: two crime records contain valid State Plane coordinate data
|
java.lang.String |
getDate() |
double |
getLat() |
double |
getLon() |
java.lang.String |
getOffense() |
java.lang.String |
getStreet() |
int |
getTime() |
java.lang.String |
getTract() |
double |
getX() |
double |
getY() |
static CrimeRecord |
parseLine(java.lang.String line)
pre: line contains comma separated values of crime data - as shown by
each line in the file.
|
void |
setDate(java.lang.String date) |
void |
setLat(double lat) |
void |
setLon(double lon) |
void |
setOffense(java.lang.String offense) |
void |
setStreet(java.lang.String street) |
void |
setTime(int time) |
void |
setTract(java.lang.String tract) |
void |
setX(double x) |
void |
setY(double y) |
java.lang.String |
toString() |
public CrimeRecord()
public CrimeRecord(double x, double y, int time, java.lang.String street, java.lang.String offense, java.lang.String date, java.lang.String tract, double lat, double lon)
x
- double x-coordinate in State Plane coordinate systemy
- double y-coordinate in State Plane coordinate system
State plane is useful for computing distance between
crimes.time
- int time represents time of day the crime occurredstreet
- String street address of crimeoffense
- String crime type (Robbery and so on)date
- String date of crimetract
- String tractlat
- double lat latitude used for displaylon
- double lon longitude used for displaypublic java.lang.String getDate()
public double getLat()
public double getLon()
public java.lang.String getOffense()
public java.lang.String getStreet()
public int getTime()
public java.lang.String getTract()
public double getX()
public double getY()
public void setDate(java.lang.String date)
public void setLat(double lat)
public void setLon(double lon)
public void setOffense(java.lang.String offense)
public void setStreet(java.lang.String street)
public void setTime(int time)
public void setTract(java.lang.String tract)
public void setX(double x)
public void setY(double y)
public java.lang.String toString()
toString
in class java.lang.Object
public static CrimeRecord parseLine(java.lang.String line)
line
- is a single line of input from the crime file.
This routine makes good use of the split method in the String class.
It calls the setter members as it gathers the data from the string.public static double distanceBetween(CrimeRecord a, CrimeRecord b)
a
- CrimeRecardb
- CrimeRecord