Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4 from 200Puls/feature/1-0-release
Browse files Browse the repository at this point in the history
make latitude and longiutude also serializable
  • Loading branch information
200Puls authored Jan 11, 2018
2 parents 444624f + ea380ac commit 8cf2e79
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package tk.plogitech.darksky.forecast.model;

import java.io.Serializable;
import java.util.Objects;
import static tk.plogitech.darksky.forecast.util.Assert.notNull;

Expand All @@ -31,48 +32,48 @@
*
* @author Puls
*/
public class Latitude {
public class Latitude implements Serializable {

private final Double value;

/**
* @param value The latitude of a location (in decimal degrees). Positive is north, negative is south.
*/
public Latitude(Double value) {
notNull("The Latitude value cannot be null.", value);
if (value < -90 || value > 90) {
throw new IllegalArgumentException("Latitude must be between -90 and 90. Latitude value invalid: " + value);
}
notNull("The Latitude value cannot be null.", value);
if (value < -90 || value > 90) {
throw new IllegalArgumentException("Latitude must be between -90 and 90. Latitude value invalid: " + value);
}

this.value = value;
this.value = value;
}

/**
* @return The latitude of a location (in decimal degrees). Positive is north, negative is south.
*/
public Double value() {
return value;
return value;
}

@Override
public int hashCode() {
int hash = 3;
hash = 17 * hash + Objects.hashCode(this.value);
return hash;
int hash = 3;
hash = 17 * hash + Objects.hashCode(this.value);
return hash;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Latitude other = (Latitude) obj;
return Objects.equals(this.value, other.value);
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Latitude other = (Latitude) obj;
return Objects.equals(this.value, other.value);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package tk.plogitech.darksky.forecast.model;

import java.io.Serializable;
import java.util.Objects;
import static tk.plogitech.darksky.forecast.util.Assert.notNull;

Expand All @@ -31,48 +32,48 @@
*
* @author Puls
*/
public class Longitude {
public class Longitude implements Serializable {

private final Double value;

/**
* @param value The longitude of a location (in decimal degrees). Positive is east, negative is west.
*/
public Longitude(Double value) {
notNull("The Longitude value cannot be null.", value);
if (value < -180 || value > 180) {
throw new IllegalArgumentException("Longitude must be between -180 and 180. Latitude value invalid: " + value);
}
notNull("The Longitude value cannot be null.", value);
if (value < -180 || value > 180) {
throw new IllegalArgumentException("Longitude must be between -180 and 180. Latitude value invalid: " + value);
}

this.value = value;
this.value = value;
}

/**
* @return The longitude of a location (in decimal degrees). Positive is east, negative is west.
*/
public Double value() {
return value;
return value;
}

@Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + Objects.hashCode(this.value);
return hash;
int hash = 7;
hash = 53 * hash + Objects.hashCode(this.value);
return hash;
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Longitude other = (Longitude) obj;
return Objects.equals(this.value, other.value);
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Longitude other = (Longitude) obj;
return Objects.equals(this.value, other.value);
}
}

0 comments on commit 8cf2e79

Please sign in to comment.