Ejemplo n.º 1
0
  public UpcomingWeatherImpl() {
    setIs(new Contract(UpcomingWeather.CONTRACT));

    probabilitycode.setRange(new Uri(ProbabilityCodeImpl.CONTRACT));
    probabilitycode.setHref(new Uri("probabiltityCode"));
    temperature.setUnit(new Uri("obix:units/celsius"));
    temperature.setHref(new Uri("temperature"));
    humidity.setUnit(new Uri("obix:units/percent"));
    humidity.setHref(new Uri("humidity"));
    pressure.setUnit(new Uri("obix:units/hectopascal")); // 100*kg^1*m^-1*s^-2
    pressure.setHref(new Uri("pressure"));
    precipitation.setUnit(new Uri("obix:units/millimeter")); // 0.001*m^1
    precipitation.setHref(new Uri("precipitation"));
    cloudiness.setUnit(new Uri("obix:units/percent"));
    cloudiness.setHref(new Uri("cloudiness"));
    fog.setUnit(new Uri("obix:units/percent"));
    fog.setHref(new Uri("fog"));
    windSpeed.setUnit(new Uri("obix:units/beaufort"));
    windSpeed.setHref(new Uri("windspeed"));
    dewpointTemperature.setUnit(new Uri("obix:units/celsius"));
    dewpointTemperature.setHref(new Uri("dewpointTemperature"));
    windDirection.setName("windDirection");

    add(timestamp);
    // add(probabilitycode);
    add(temperature);
    add(humidity);
    add(pressure);
    add(precipitation);
    add(cloudiness);
    add(fog);
    add(windSpeed);
    add(windDirection);
    add(dewpointTemperature);
  }
Ejemplo n.º 2
0
  public void setAll(UpcomingWeather rec) {
    timestamp.set(rec.timestamp().getMillis(), rec.timestamp().getTimeZone());

    if (ProbabilityCodeImpl.GetByName(rec.probabilitycode().get())
        != ProbabilityCodeImpl.ID_UNKNOWN) {
      probabilitycode.set(rec.probabilitycode().get());
    } else {
      probabilitycode.set(ProbabilityCodeImpl.NAME_UNKNOWN);
    }

    temperature.set(rec.temperature().get());
    humidity.set(rec.humidity().get());
    pressure.set(rec.pressure().get());
    precipitation.set(rec.precipitation().get());
    cloudiness.set(rec.cloudiness().get());
    fog.set(rec.fog().get());
    windSpeed.set(rec.windspeed().get());
    windDirection.set(rec.windDirection().get());
    dewpointTemperature.set(rec.dewpointTemperature().get());
  }