Move off the HashMap stuff, stick a ParkingCoordinate inside a

ParkingLot
This commit is contained in:
bspeice 2013-10-28 14:58:44 -04:00
parent 6a37e14a47
commit 5ad1f3b075
5 changed files with 59 additions and 42 deletions

View File

@ -44,17 +44,18 @@ public class ParkingClient {
gds.rateLot(rating, new ParkingLotCallback());
}
public Map<ParkingLot, ParkingLocation> listLotLocation(ParkingLot p){
HashMap<ParkingLot, ParkingLocation> mMap = new HashMap<ParkingLot, ParkingLocation>();
mMap.put(p, gds.listLotLocation(p.getLocation().getValue()));
return mMap;
public ParkingLot listLotLocation(ParkingLot p){
ParkingCoordinate pc = gds.listLotLocation(p.getLocation().getValue());
p.setCoordinate(pc);
return p;
}
public Map<ParkingLot, ParkingLocation> listLotLocation(ParkingChoice c) {
HashMap<ParkingLot, ParkingLocation> mMap = new HashMap<ParkingLot, ParkingLocation>();
ParkingLot mParkingLot = new ParkingLot();
mParkingLot.setLocation(c);
mMap.put(mParkingLot, gds.listLotLocation(c.getValue()));
return mMap;
public ParkingLot listLotLocation(ParkingChoice c) {
ParkingCoordinate pc = gds.listLotLocation(c.getValue());
ParkingLot pl = new ParkingLot();
pl.setLocation(c);
pl.setCoordinate(pc);
return pl;
}
}

View File

@ -0,0 +1,33 @@
package com.uncc.gameday.parking;
public class ParkingCoordinate {
private double latitude;
private double longitude;
private String label;
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public ParkingCoordinate(double latitude, double longitude, String label) {
this.latitude = latitude;
this.longitude = longitude;
this.label = label;
}
}

View File

@ -1,27 +0,0 @@
package com.uncc.gameday.parking;
public class ParkingLocation {
private int latitude;
private int longitude;
private String label;
public int getLatitude() {
return latitude;
}
public void setLatitude(int latitude) {
this.latitude = latitude;
}
public int getLongitude() {
return longitude;
}
public void setLongitude(int longitude) {
this.longitude = longitude;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
}

View File

@ -4,6 +4,7 @@ public class ParkingLot {
private ParkingChoice location;
private int filled_pct;
private ParkingCoordinate coordinate;
public int getFilledPct() {
return filled_pct;
@ -17,5 +18,11 @@ public class ParkingLot {
public void setLocation(ParkingChoice location) {
this.location = location;
}
public ParkingCoordinate getCoordinate() {
return coordinate;
}
public void setCoordinate(ParkingCoordinate coordinate) {
this.coordinate = coordinate;
}
}

View File

@ -2,14 +2,17 @@ package com.uncc.gameday.rest;
import java.util.List;
import com.uncc.gameday.parking.ParkingLocation;
import retrofit.Callback;
import retrofit.http.Body;
import retrofit.http.GET;
import retrofit.http.POST;
import retrofit.http.Path;
import com.uncc.gameday.parking.ParkingCoordinate;
import com.uncc.gameday.parking.ParkingLot;
import com.uncc.gameday.parking.ParkingRating;
import com.uncc.gameday.registration.Attendee;
import retrofit.Callback;
import retrofit.http.*;
public interface GamedayService {
@GET("/lots/")
@ -22,7 +25,7 @@ public interface GamedayService {
void rateLot(@Body ParkingRating p, Callback<ParkingLot> lot);
@GET("/lots/{lot}/")
ParkingLocation listLotLocation(@Path("lot") String lot);
ParkingCoordinate listLotLocation(@Path("lot") String lot);
@GET("/register/{id}/")
Attendee getUser(@Path("id") int id);