Android Open Source - android-weather-demo-application Weather Model






From Project

Back to project page android-weather-demo-application.

License

The source code is released under:

GNU General Public License

If you think the Android project android-weather-demo-application listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.openweathermap.sql.model;
/*from   w w w .  ja va  2 s  . c om*/
import com.app.sqlite.base.BaseModel;

import java.util.HashMap;

import android.content.ContentValues;

public class WeatherModel extends BaseModel {
  private int pid;
  private int cityId;
  private int iconId;
  private String description;
  private String descriptionDetailed;
  private long timestamp;
  private double tmpDay;
  private double tmpMin;
  private double tmpMax;
  private double tmpNight;
  private double tmpEve;
  private double tmpMorn;
  private double pressure;
  private double humidity;
  private double windSpeed;
  private double windDegrees;
  private double cloudCoverage;

  private static final String COLUMN_PID = "pid";
  private static final String COLUMN_CITYID = "cityId";
  private static final String COLUMN_ICONID = "iconId";
  private static final String COLUMN_DESCRIPTION = "description";
  private static final String COLUMN_DESCRIPTIONDETAILED = "descriptionDetailed";
  private static final String COLUMN_TIMESTAMP = "timestamp";
  private static final String COLUMN_TMPDAY = "tmpDay";
  private static final String COLUMN_TMPMIN = "tmpMin";
  private static final String COLUMN_TMPMAX = "tmpMax";
  private static final String COLUMN_TMPNIGHT = "tmpNight";
  private static final String COLUMN_TMPEVE = "tmpEve";
  private static final String COLUMN_TMPMORN = "tmpMorn";
  private static final String COLUMN_PRESSURE = "pressure";
  private static final String COLUMN_HUMIDITY = "humidity";
  private static final String COLUMN_WINDSPEED = "windSpeed";
  private static final String COLUMN_WINDDEGREES = "windDegrees";
  private static final String COLUMN_CLOUDCOVERAGE = "cloudCoverage";

  // The SQL provider uses reflection to retrieve the table name from this variable
  public static final String TABLE_NAME = "Weather";

  public int getPid() {
    return pid;
  }

  public void setPid(int newVal) {
    pid = newVal;
  }
  public int getCityId() {
    return cityId;
  }

  public void setCityId(int newVal) {
    cityId = newVal;
  }
  public int getIconId() {
    return iconId;
  }

  public void setIconId(int newVal) {
    iconId = newVal;
  }
  public String getDescription() {
    return description;
  }

  public void setDescription(String newVal) {
    description = newVal;
  }
  public String getDescriptionDetailed() {
    return descriptionDetailed;
  }

  public void setDescriptionDetailed(String newVal) {
    descriptionDetailed = newVal;
  }
  public long getTimestamp() {
    return timestamp;
  }

  public void setTimestamp(long newVal) {
    timestamp = newVal;
  }
  public double getTmpDay() {
    return tmpDay;
  }

  public void setTmpDay(double newVal) {
    tmpDay = newVal;
  }
  public double getTmpMin() {
    return tmpMin;
  }

  public void setTmpMin(double newVal) {
    tmpMin = newVal;
  }
  public double getTmpMax() {
    return tmpMax;
  }

  public void setTmpMax(double newVal) {
    tmpMax = newVal;
  }
  public double getTmpNight() {
    return tmpNight;
  }

  public void setTmpNight(double newVal) {
    tmpNight = newVal;
  }
  public double getTmpEve() {
    return tmpEve;
  }

  public void setTmpEve(double newVal) {
    tmpEve = newVal;
  }
  public double getTmpMorn() {
    return tmpMorn;
  }

  public void setTmpMorn(double newVal) {
    tmpMorn = newVal;
  }
  public double getPressure() {
    return pressure;
  }

  public void setPressure(double newVal) {
    pressure = newVal;
  }
  public double getHumidity() {
    return humidity;
  }

  public void setHumidity(double newVal) {
    humidity = newVal;
  }
  public double getWindSpeed() {
    return windSpeed;
  }

  public void setWindSpeed(double newVal) {
    windSpeed = newVal;
  }
  public double getWindDegrees() {
    return windDegrees;
  }

  public void setWindDegrees(double newVal) {
    windDegrees = newVal;
  }
  public double getCloudCoverage() {
    return cloudCoverage;
  }

  public void setCloudCoverage(double newVal) {
    cloudCoverage = newVal;
  }

  @Override
  public HashMap<String,Integer> getModelColumnTypeMap() {
    HashMap<String,Integer> modelColumns = new HashMap<String,Integer>();
    modelColumns.put(COLUMN_PID, BaseModel.FIELD_INTEGER);
    modelColumns.put(COLUMN_CITYID, BaseModel.FIELD_INTEGER);
    modelColumns.put(COLUMN_ICONID, BaseModel.FIELD_INTEGER);
    modelColumns.put(COLUMN_DESCRIPTION, BaseModel.FIELD_STRING);
    modelColumns.put(COLUMN_DESCRIPTIONDETAILED, BaseModel.FIELD_STRING);
    modelColumns.put(COLUMN_TIMESTAMP, BaseModel.FIELD_LONG);
    modelColumns.put(COLUMN_TMPDAY, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_TMPMIN, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_TMPMAX, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_TMPNIGHT, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_TMPEVE, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_TMPMORN, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_PRESSURE, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_HUMIDITY, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_WINDSPEED, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_WINDDEGREES, BaseModel.FIELD_DOUBLE);
    modelColumns.put(COLUMN_CLOUDCOVERAGE, BaseModel.FIELD_DOUBLE);
    return modelColumns;
  }

  @Override
  public ContentValues toContentValues() {
    ContentValues contentValues = new ContentValues();
    contentValues.put(COLUMN_CITYID, getCityId());
    contentValues.put(COLUMN_ICONID, getIconId());
    contentValues.put(COLUMN_DESCRIPTION, getDescription());
    contentValues.put(COLUMN_DESCRIPTIONDETAILED, getDescriptionDetailed());
    contentValues.put(COLUMN_TIMESTAMP, getTimestamp());
    contentValues.put(COLUMN_TMPDAY, getTmpDay());
    contentValues.put(COLUMN_TMPMIN, getTmpMin());
    contentValues.put(COLUMN_TMPMAX, getTmpMax());
    contentValues.put(COLUMN_TMPNIGHT, getTmpNight());
    contentValues.put(COLUMN_TMPEVE, getTmpEve());
    contentValues.put(COLUMN_TMPMORN, getTmpMorn());
    contentValues.put(COLUMN_PRESSURE, getPressure());
    contentValues.put(COLUMN_HUMIDITY, getHumidity());
    contentValues.put(COLUMN_WINDSPEED, getWindSpeed());
    contentValues.put(COLUMN_WINDDEGREES, getWindDegrees());
    contentValues.put(COLUMN_CLOUDCOVERAGE, getCloudCoverage());
    return contentValues;
  }
}




Java Source Code List

org.openweathermap.WeatherApplication.java
org.openweathermap.activity.MainActivity.java
org.openweathermap.activity.base.BaseActivity.java
org.openweathermap.adapter.CityAdapter.java
org.openweathermap.adapter.ForecastAdapter.java
org.openweathermap.asynctask.GetCitiesAsyncTask.java
org.openweathermap.asynctask.GetLastCityAsyncTask.java
org.openweathermap.asynctask.SaveForecastAsyncTask.java
org.openweathermap.asynctask.SearchCitiesAsyncTask.java
org.openweathermap.asynctask.base.BaseAsyncTask.java
org.openweathermap.asynctask.base.BaseResponse.java
org.openweathermap.asynctask.base.IParam.java
org.openweathermap.asynctask.param.SaveForecastParam.java
org.openweathermap.asynctask.param.SearchCitiesParam.java
org.openweathermap.asynctask.response.GetCitiesResponse.java
org.openweathermap.asynctask.response.GetLastCityResponse.java
org.openweathermap.asynctask.response.SaveForecastResponse.java
org.openweathermap.dto.CityDTO.java
org.openweathermap.dto.CoordDTO.java
org.openweathermap.dto.DayDTO.java
org.openweathermap.dto.ResultDTO.java
org.openweathermap.dto.TempDTO.java
org.openweathermap.dto.WeatherDTO.java
org.openweathermap.dto.base.IDTO.java
org.openweathermap.fragment.ForecastFragment.java
org.openweathermap.fragment.ModalDialogFragment.java
org.openweathermap.fragment.SelectCountryFragment.java
org.openweathermap.sql.SQLInitProvider.java
org.openweathermap.sql.model.CityModel.java
org.openweathermap.sql.model.IconModel.java
org.openweathermap.sql.model.WeatherModel.java
org.openweathermap.utils.DateHelper.java
org.openweathermap.utils.RESTProvider.java
org.openweathermap.utils.ReflectionHelper.java
org.openweathermap.utils.ResourceHelper.java
org.openweathermap.utils.StringHelper.java
org.openweathermap.view.CityListItemView.java
org.openweathermap.view.DateDisplayView.java
org.openweathermap.view.ViewPagerFade.java
org.openweathermap.view.ViewPagerIndicatorView.java
org.openweathermap.view.WeatherDataRowView.java
org.openweathermap.volley.callback.VolleyResponseCallback.java
org.openweathermap.volley.provider.VolleyImageLoader.java
org.openweathermap.volley.provider.VolleyRequest.java