コード例 #1
0
  private void initBikeRental() {
    BikeRentalStationService service = new BikeRentalStationService();
    BikeRentalStation station = new BikeRentalStation();
    station.x = -122.637634;
    station.y = 45.513084;
    station.bikesAvailable = 5;
    station.spacesAvailable = 4;
    station.id = "1";
    station.name = "bike rental station";

    service.addStation(station);
    graph.putService(BikeRentalStationService.class, service);
  }
コード例 #2
0
  public BikeRentalStation makeStation(JsonNode kioskNode) {

    if (!kioskNode.path("Status").getTextValue().equals("Active")) {
      return null;
    }

    BikeRentalStation brstation = new BikeRentalStation();

    brstation.id = kioskNode.path("Id").toString();
    brstation.x = kioskNode.path("Location").path("Longitude").asDouble();
    brstation.y = kioskNode.path("Location").path("Latitude").asDouble();
    brstation.name = kioskNode.path("Name").getTextValue();
    brstation.bikesAvailable = kioskNode.path("BikesAvailable").asInt();
    brstation.spacesAvailable = kioskNode.path("DocksAvailable").asInt();

    return brstation;
  }