test_class.declarator: TAG = ServicesManagerTest.class.getSimpleName()
test_class.modifier: public static final
test_class.original_string: public static final String TAG = ServicesManagerTest.class.getSimpleName();
test_class.type: String
test_class.var_name: TAG
test_class.declarator: mServicesManger = null
test_class.modifier: private
test_class.original_string: private ServicesManager mServicesManger = null;
test_class.type: ServicesManager
test_class.var_name: mServicesManger
test_class.file: model/src/test/java/com/zeuschan/littlefreshweather/model/restapi/ServicesManagerTest.java
test_class.identifier: ServicesManagerTest
test_case.body: @Test
      public void testServicesManagerGetCityWeather() throws Exception {
          assertNotNull(mServicesManger);
          TestSubscriber<WeatherEntity> testSubscriber = TestSubscriber.create(new GetCityWeatherDelegate());
          mServicesManger.getCityWeather("CN101010300", false).subscribe(testSubscriber);
          testSubscriber.awaitTerminalEvent();
          testSubscriber.assertNoErrors();
  
          /*final Logger logger = Logger.getLogger("testServicesManagerGetCityWeather");
          assertNotNull(mServicesManger);
          mServicesManger.getCityWeather("CN101010300")
                  .subscribe(new Subscriber<WeatherEntity>() {
                      @Override
                      public void onCompleted() {
                          logger.info("onCompleted");
                      }
  
                      @Override
                      public void onError(Throwable e) {
                          logger.info("onError");
                          logger.info(e.getMessage());
                      }
  
                      @Override
                      public void onNext(WeatherEntity weatherEntity) {
                          logger.info("onNext");
                          mWeatherEntity = weatherEntity;
                          logger.info(mWeatherEntity.toString());
                      }
                  });
          assertNotNull(mWeatherEntity);*/
      }
test_case.class_method_signature: ServicesManagerTest.testServicesManagerGetCityWeather()
test_case.full_signature: @Test public void testServicesManagerGetCityWeather()
test_case.identifier: testServicesManagerGetCityWeather
test_case.invocations: assertNotNull create subscribe getCityWeather awaitTerminalEvent assertNoErrors
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testServicesManagerGetCityWeather()
focal_class.declarator: TAG = ServicesManager.class.getSimpleName()
focal_class.modifier: private static final
focal_class.original_string: private static final String TAG = ServicesManager.class.getSimpleName();
focal_class.type: String
focal_class.var_name: TAG
focal_class.declarator: DEFAULT_TIMEOUT = 5
focal_class.modifier: private static final
focal_class.original_string: private static final int DEFAULT_TIMEOUT = 5;
focal_class.type: int
focal_class.var_name: DEFAULT_TIMEOUT
focal_class.declarator: ourInstance = new ServicesManager()
focal_class.modifier: private static
focal_class.original_string: private static ServicesManager ourInstance = new ServicesManager();
focal_class.type: ServicesManager
focal_class.var_name: ourInstance
focal_class.declarator: weatherInfoService
focal_class.modifier: private final
focal_class.original_string: private final WeatherInfoService weatherInfoService;
focal_class.type: WeatherInfoService
focal_class.var_name: weatherInfoService
focal_class.declarator: mNameMap = new android.support.v4.util.ArrayMap<>(6)
focal_class.modifier: private
focal_class.original_string: private Map<String, String> mNameMap = new android.support.v4.util.ArrayMap<>(6);
focal_class.type: Map<String, String>
focal_class.var_name: mNameMap
focal_class.declarator: mCityEntities = new ArrayList<>()
focal_class.modifier: private
focal_class.original_string: private List<CityEntity> mCityEntities = new ArrayList<>();
focal_class.type: List<CityEntity>
focal_class.var_name: mCityEntities
focal_class.declarator: mWeatherCondtionEntities = new ArrayList<>()
focal_class.modifier: private
focal_class.original_string: private List<WeatherConditionEntity> mWeatherCondtionEntities = new ArrayList<>();
focal_class.type: List<WeatherConditionEntity>
focal_class.var_name: mWeatherCondtionEntities
focal_class.declarator: mForecasts = new ArrayList<>()
focal_class.modifier: private
focal_class.original_string: private List<WeatherEntity.Forecast> mForecasts = new ArrayList<>();
focal_class.type: List<WeatherEntity.Forecast>
focal_class.var_name: mForecasts
focal_class.file: model/src/main/java/com/zeuschan/littlefreshweather/model/restapi/ServicesManager.java
focal_class.identifier: ServicesManager
focal_class.interfaces: implements DataSource
focal_class.class_method_signature: ServicesManager.getInstance()
focal_class.full_signature: public static ServicesManager getInstance()
focal_class.identifier: getInstance
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: ServicesManager
focal_class.signature: ServicesManager getInstance()
focal_class.class_method_signature: ServicesManager.ServicesManager()
focal_class.full_signature: private  ServicesManager()
focal_class.identifier: ServicesManager
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  ServicesManager()
focal_class.class_method_signature: ServicesManager.clear()
focal_class.full_signature: @Override public void clear()
focal_class.identifier: clear
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void clear()
focal_class.class_method_signature: ServicesManager.getCityEntities()
focal_class.full_signature: @Override public Observable<List<CityEntity>> getCityEntities()
focal_class.identifier: getCityEntities
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Observable<List<CityEntity>>
focal_class.signature: Observable<List<CityEntity>> getCityEntities()
focal_class.class_method_signature: ServicesManager.getWeatherConditionEntities()
focal_class.full_signature: @Override public Observable<List<WeatherConditionEntity>> getWeatherConditionEntities()
focal_class.identifier: getWeatherConditionEntities
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Observable<List<WeatherConditionEntity>>
focal_class.signature: Observable<List<WeatherConditionEntity>> getWeatherConditionEntities()
focal_class.class_method_signature: ServicesManager.getCityWeather(String cityId, boolean fromCache)
focal_class.full_signature: @Override public Observable<WeatherEntity> getCityWeather(String cityId, boolean fromCache)
focal_class.identifier: getCityWeather
focal_class.modifiers: @Override public
focal_class.parameters: (String cityId, boolean fromCache)
focal_class.return: Observable<WeatherEntity>
focal_class.signature: Observable<WeatherEntity> getCityWeather(String cityId, boolean fromCache)
focal_method.body: @Override
      public Observable<WeatherEntity> getCityWeather(String cityId, boolean fromCache) {
          Map<String, String> params = new android.support.v4.util.ArrayMap<>(2);
          params.put("city", cityId);
          params.put("key", Constants.WEATHER_KEY);
  
          return weatherInfoService.getCityWeatherInfo(params)
                  .map(new Func1<CityWeatherResponse, WeatherEntity>() {
                      @Override
                      public WeatherEntity call(CityWeatherResponse cityWeatherResponse) {
                          if (null == cityWeatherResponse || null == cityWeatherResponse.getCityWeatherInfos()) {
                              throw new WeatherServiceException("no data");
                          }
                          CityWeatherResponse.CityWeatherInfo cityWeatherInfo = cityWeatherResponse.getCityWeatherInfos().get(0);
                          if (null == cityWeatherInfo) {
                              throw new WeatherServiceException("no data");
                          }
                          if (!cityWeatherInfo.getResultCode().equals(Constants.OK)) {
                              throw new WeatherServiceException("error code: " + cityWeatherInfo.getResultCode());
                          }
                          WeatherEntity weatherEntity = new WeatherEntity();
  
                          CityWeatherResponse.CityWeatherInfo.Basic basic = cityWeatherInfo.getBasic();
                          if (basic != null) {
                              if (basic.getId() != null)
                                  weatherEntity.setCityId(basic.getId());
                              if (basic.getCity() != null)
                                  weatherEntity.setCityName(basic.getCity());
                              if (basic.getUpdate() != null && basic.getUpdate().getLoc() != null)
                                  weatherEntity.setDataUpdateTime(basic.getUpdate().getLoc());
                          }
  
                          CityWeatherResponse.CityWeatherInfo.Aqi aqi = cityWeatherInfo.getAqi();
                          if (aqi != null) {
                              CityWeatherResponse.CityWeatherInfo.Aqi.City city = aqi.getCity();
                              if (city != null) {
                                  if (city.getAqi() != null)
                                      weatherEntity.setAirQulityIndex(city.getAqi());
                                  if (city.getPm25() != null)
                                      weatherEntity.setPm25(city.getPm25());
                                  if (city.getPm10() != null)
                                      weatherEntity.setPm10(city.getPm10());
                                  if (city.getSo2() != null)
                                      weatherEntity.setSo2(city.getSo2());
                                  if (city.getNo2() != null)
                                      weatherEntity.setNo2(city.getNo2());
                                  if (city.getCo() != null)
                                      weatherEntity.setCo(city.getCo());
                                  if (city.getO3() != null)
                                      weatherEntity.setO3(city.getO3());
                                  if (city.getQlty() != null)
                                      weatherEntity.setAirQulityType(city.getQlty());
                              }
                          }
  
                          CityWeatherResponse.CityWeatherInfo.Now now = cityWeatherInfo.getNow();
                          if (now != null) {
                              CityWeatherResponse.CityWeatherInfo.Now.Cond cond = now.getCond();
                              if (cond != null) {
                                  if (cond.getCode() != null)
                                      weatherEntity.setWeatherCode(cond.getCode());
                                  if (cond.getTxt() != null)
                                      weatherEntity.setWeatherDescription(cond.getTxt());
                              }
                              if (now.getTmp() != null)
                                  weatherEntity.setCurrentTemperature(now.getTmp());
                              if (now.getFl() != null)
                                  weatherEntity.setFeltTemperature(now.getFl());
                              if (now.getPcpn() != null)
                                  weatherEntity.setRainfall(now.getPcpn());
                              if (now.getHum() != null)
                                  weatherEntity.setHumidity(now.getHum());
                              if (now.getPres() != null)
                                  weatherEntity.setAirPressure(now.getPres());
                              if (now.getVis() != null)
                                  weatherEntity.setVisibility(now.getVis());
                              CityWeatherResponse.CityWeatherInfo.Now.Wind wind = now.getWind();
                              if (wind != null) {
                                  if (wind.getSpd() != null)
                                      weatherEntity.setWindSpeed(wind.getSpd());
                                  if (wind.getSc() != null)
                                      weatherEntity.setWindScale(wind.getSc());
                                  if (wind.getDir() != null)
                                      weatherEntity.setWindDirection(wind.getDir());
                              }
                          }
  
                          CityWeatherResponse.CityWeatherInfo.Suggestion suggestion = cityWeatherInfo.getSuggestion();
                          if (suggestion != null) {
                              CityWeatherResponse.CityWeatherInfo.Suggestion.Drsg drsg = suggestion.getDrsg();
                              if (drsg != null) {
                                  if (drsg.getBrf() != null)
                                      weatherEntity.setDressBrief(drsg.getBrf());
                                  if (drsg.getTxt() != null)
                                      weatherEntity.setDressDescription(drsg.getTxt());
                              }
                              CityWeatherResponse.CityWeatherInfo.Suggestion.Uv uv = suggestion.getUv();
                              if (uv != null) {
                                  if (uv.getBrf() != null)
                                      weatherEntity.setUvBrief(uv.getBrf());
                                  if (uv.getTxt() != null)
                                      weatherEntity.setUvDescription(uv.getTxt());
                              }
                              CityWeatherResponse.CityWeatherInfo.Suggestion.Cw cw = suggestion.getCw();
                              if (cw != null) {
                                  if (cw.getBrf() != null)
                                      weatherEntity.setCarWashBrief(cw.getBrf());
                                  if (cw.getTxt() != null)
                                      weatherEntity.setCarWashDescription(cw.getTxt());
                              }
                              CityWeatherResponse.CityWeatherInfo.Suggestion.Trav trav = suggestion.getTrav();
                              if (trav != null) {
                                  if (trav.getBrf() != null)
                                      weatherEntity.setTravelBrief(trav.getBrf());
                                  if (trav.getTxt() != null)
                                      weatherEntity.setTravelDescription(trav.getTxt());
                              }
                              CityWeatherResponse.CityWeatherInfo.Suggestion.Flu flu = suggestion.getFlu();
                              if (flu != null) {
                                  if (flu.getBrf() != null)
                                      weatherEntity.setFluBrief(flu.getBrf());
                                  if (flu.getTxt() != null)
                                      weatherEntity.setFluDescription(flu.getTxt());
                              }
                              CityWeatherResponse.CityWeatherInfo.Suggestion.Sport sport = suggestion.getSport();
                              if (sport != null) {
                                  if (sport.getBrf() != null)
                                      weatherEntity.setSportBrief(sport.getBrf());
                                  if (sport.getTxt() != null)
                                      weatherEntity.setSportDescription(sport.getTxt());
                              }
                          }
  
                          mForecasts.clear();
                          List<CityWeatherResponse.CityWeatherInfo.DailyForecast> forecastsResponse = cityWeatherInfo.getDaily_forecast();
                          if (forecastsResponse != null) {
                              for (CityWeatherResponse.CityWeatherInfo.DailyForecast forecastResponse :
                                      forecastsResponse) {
                                  if (forecastResponse != null) {
                                      WeatherEntity.Forecast forcast = new WeatherEntity.Forecast();
  
                                      if (forecastResponse.getDate() != null)
                                          forcast.setDate(forecastResponse.getDate());
  
                                      CityWeatherResponse.CityWeatherInfo.DailyForecast.Astro astro = forecastResponse.getAstro();
                                      if (astro != null) {
                                          if (astro.getSr() != null)
                                              forcast.setSunriseTime(astro.getSr());
                                          if (astro.getSs() != null)
                                              forcast.setSunsetTime(astro.getSs());
                                      }
  
                                      CityWeatherResponse.CityWeatherInfo.DailyForecast.Tmp tmp = forecastResponse.getTmp();
                                      if (tmp != null) {
                                          forcast.setMaxTemperature(tmp.getMax());
                                          forcast.setMinTemperature(tmp.getMin());
                                      }
  
                                      CityWeatherResponse.CityWeatherInfo.DailyForecast.Wind wind = forecastResponse.getWind();
                                      if (wind != null) {
                                          if (wind.getSpd() != null)
                                              forcast.setWindSpeed(wind.getSpd());
                                          if (wind.getSc() != null)
                                              forcast.setWindScale(wind.getSc());
                                          if (wind.getDir() != null)
                                              forcast.setWindDirection(wind.getDir());
                                      }
  
                                      CityWeatherResponse.CityWeatherInfo.DailyForecast.Cond cond = forecastResponse.getCond();
                                      if (cond != null) {
                                          if (cond.getCode_d() != null)
                                              forcast.setWeatherCodeDaytime(cond.getCode_d());
                                          if (cond.getCode_n() != null)
                                              forcast.setWeatherCodeNight(cond.getCode_n());
                                          if (cond.getTxt_d() != null)
                                              forcast.setWeatherDescriptionDaytime(cond.getTxt_d());
                                          if (cond.getTxt_n() != null)
                                              forcast.setWeatherDescriptionNight(cond.getTxt_n());
                                      }
  
                                      if (forecastResponse.getPcpn() != null)
                                          forcast.setRainfall(forecastResponse.getPcpn());
                                      if (forecastResponse.getPop() != null)
                                          forcast.setRainProbability(forecastResponse.getPop());
                                      if (forecastResponse.getHum() != null)
                                          forcast.setHumidity(forecastResponse.getHum());
                                      if (forecastResponse.getPres() != null)
                                          forcast.setAirPressure(forecastResponse.getPres());
                                      if (forecastResponse.getVis() != null)
                                          forcast.setVisibility(forecastResponse.getVis());
  
                                      mForecasts.add(forcast);
                                  }
                              }
                          }
                          weatherEntity.setForecasts(mForecasts);
  
                          return weatherEntity;
                      }
                  });
      }
focal_method.class_method_signature: ServicesManager.getCityWeather(String cityId, boolean fromCache)
focal_method.full_signature: @Override public Observable<WeatherEntity> getCityWeather(String cityId, boolean fromCache)
focal_method.identifier: getCityWeather
focal_method.invocations: put put map getCityWeatherInfo getCityWeatherInfos get getCityWeatherInfos equals getResultCode getResultCode getBasic getId setCityId getId getCity setCityName getCity getUpdate getLoc getUpdate setDataUpdateTime getLoc getUpdate getAqi getCity getAqi setAirQulityIndex getAqi getPm25 setPm25 getPm25 getPm10 setPm10 getPm10 getSo2 setSo2 getSo2 getNo2 setNo2 getNo2 getCo setCo getCo getO3 setO3 getO3 getQlty setAirQulityType getQlty getNow getCond getCode setWeatherCode getCode getTxt setWeatherDescription getTxt getTmp setCurrentTemperature getTmp getFl setFeltTemperature getFl getPcpn setRainfall getPcpn getHum setHumidity getHum getPres setAirPressure getPres getVis setVisibility getVis getWind getSpd setWindSpeed getSpd getSc setWindScale getSc getDir setWindDirection getDir getSuggestion getDrsg getBrf setDressBrief getBrf getTxt setDressDescription getTxt getUv getBrf setUvBrief getBrf getTxt setUvDescription getTxt getCw getBrf setCarWashBrief getBrf getTxt setCarWashDescription getTxt getTrav getBrf setTravelBrief getBrf getTxt setTravelDescription getTxt getFlu getBrf setFluBrief getBrf getTxt setFluDescription getTxt getSport getBrf setSportBrief getBrf getTxt setSportDescription getTxt clear getDaily_forecast getDate setDate getDate getAstro getSr setSunriseTime getSr getSs setSunsetTime getSs getTmp setMaxTemperature getMax setMinTemperature getMin getWind getSpd setWindSpeed getSpd getSc setWindScale getSc getDir setWindDirection getDir getCond getCode_d setWeatherCodeDaytime getCode_d getCode_n setWeatherCodeNight getCode_n getTxt_d setWeatherDescriptionDaytime getTxt_d getTxt_n setWeatherDescriptionNight getTxt_n getPcpn setRainfall getPcpn getPop setRainProbability getPop getHum setHumidity getHum getPres setAirPressure getPres getVis setVisibility getVis add setForecasts
focal_method.modifiers: @Override public
focal_method.parameters: (String cityId, boolean fromCache)
focal_method.return: Observable<WeatherEntity>
focal_method.signature: Observable<WeatherEntity> getCityWeather(String cityId, boolean fromCache)