예제 #1
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   Weather other = (Weather) obj;
   if (location == null) {
     if (other.location != null) return false;
   } else if (!location.equals(other.location)) return false;
   if (observationTime == null) {
     if (other.observationTime != null) return false;
   } else if (!observationTime.equals(other.observationTime)) return false;
   if (relativeHumidity == null) {
     if (other.relativeHumidity != null) return false;
   } else if (!relativeHumidity.equals(other.relativeHumidity)) return false;
   if (temperature == null) {
     if (other.temperature != null) return false;
   } else if (!temperature.equals(other.temperature)) return false;
   if (weatherDescription == null) {
     if (other.weatherDescription != null) return false;
   } else if (!weatherDescription.equals(other.weatherDescription)) return false;
   if (windDescription == null) {
     if (other.windDescription != null) return false;
   } else if (!windDescription.equals(other.windDescription)) return false;
   if (windDirection == null) {
     if (other.windDirection != null) return false;
   } else if (!windDirection.equals(other.windDirection)) return false;
   return true;
 }
예제 #2
0
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((location == null) ? 0 : location.hashCode());
   result = prime * result + ((observationTime == null) ? 0 : observationTime.hashCode());
   result = prime * result + ((relativeHumidity == null) ? 0 : relativeHumidity.hashCode());
   result = prime * result + ((temperature == null) ? 0 : temperature.hashCode());
   result = prime * result + ((weatherDescription == null) ? 0 : weatherDescription.hashCode());
   result = prime * result + ((windDescription == null) ? 0 : windDescription.hashCode());
   result = prime * result + ((windDirection == null) ? 0 : windDirection.hashCode());
   return result;
 }