Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,30 @@ public String toJson() {
return gson.create().toJson(this);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

BaseFeatureCollection that = (BaseFeatureCollection) o;

return type.equals(that.type);

}

@Override
public int hashCode() {
return type.hashCode();
}

@Override
public String toString() {
return "BaseFeatureCollection{"
+ "type='" + type + '\''
+ '}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,41 @@ public boolean hasProperty(String key) {
public boolean hasNonNullValueForProperty(String key) {
return hasProperty(key) && !getProperty(key).isJsonNull();
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

Feature feature = (Feature) o;

if (!type.equals(feature.type)) {
return false;
}
if (geometry != null ? !geometry.equals(feature.geometry) : feature.geometry != null) {
return false;
}
if (properties != null ? !properties.equals(feature.properties) : feature.properties != null) {
return false;
}
return id != null ? id.equals(feature.id) : feature.id == null;
}

@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + (geometry != null ? geometry.hashCode() : 0);
result = 31 * result + (properties != null ? properties.hashCode() : 0);
result = 31 * result + (id != null ? id.hashCode() : 0);
return result;
}

@Override
public String toString() {
return this.toJson();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,43 @@ public static FeatureCollection fromFeatures(List<Feature> features) {
return new FeatureCollection(features);
}

/**
* Create a {@link FeatureCollection} from an array of features.
*
* @param features Array of {@link Feature}
* @return new {@link FeatureCollection}
* @since 1.0.0
*/
public static FeatureCollection fromFeatures(Feature[] features) {
return new FeatureCollection(Arrays.asList(features));
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}

FeatureCollection that = (FeatureCollection) o;

return features != null ? features.equals(that.features) : that.features == null;
}

@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + (features != null ? features.hashCode() : 0);
return result;
}

@Override
public String toString() {
return this.toJson();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,33 @@ public String toJson() {
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

GeometryCollection that = (GeometryCollection) o;

if (!type.equals(that.type)) {
return false;
}
return geometries != null ? geometries.equals(that.geometries) : that.geometries == null;
}

@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + (geometries != null ? geometries.hashCode() : 0);
return result;
}

@Override
public String toString() {
return this.toJson();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,33 @@ public static LineString fromPolyline(String polyline, int precision) {
public String toPolyline(int precision) {
return PolylineUtils.encode(getCoordinates(), precision);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

LineString that = (LineString) o;

if (!type.equals(that.type)) {
return false;
}
return coordinates != null ? coordinates.equals(that.coordinates) : that.coordinates == null;
}

@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + (coordinates != null ? coordinates.hashCode() : 0);
return result;
}

@Override
public String toString() {
return this.toJson();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,33 @@ public String toJson() {
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

MultiLineString that = (MultiLineString) o;

if (!type.equals(that.type)) {
return false;
}
return coordinates != null ? coordinates.equals(that.coordinates) : that.coordinates == null;
}

@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + (coordinates != null ? coordinates.hashCode() : 0);
return result;
}

@Override
public String toString() {
return this.toJson();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,34 @@ public String toJson() {
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

MultiPoint that = (MultiPoint) o;

if (!type.equals(that.type)) {
return false;
}
return coordinates != null ? coordinates.equals(that.coordinates) : that.coordinates == null;

}

@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + (coordinates != null ? coordinates.hashCode() : 0);
return result;
}

@Override
public String toString() {
return this.toJson();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,33 @@ public String toJson() {
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

MultiPolygon that = (MultiPolygon) o;

if (!type.equals(that.type)) {
return false;
}
return coordinates != null ? coordinates.equals(that.coordinates) : that.coordinates == null;
}

@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + (coordinates != null ? coordinates.hashCode() : 0);
return result;
}

@Override
public String toString() {
return this.toJson();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ public int hashCode() {

@Override
public String toString() {
return "Point{"
+ "type='" + type + '\''
+ ", coordinates=" + coordinates
+ '}';
return this.toJson();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,33 @@ public String toJson() {
gson.registerTypeAdapter(Position.class, new PositionSerializer());
return gson.create().toJson(this);
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

Polygon polygon = (Polygon) o;

if (!type.equals(polygon.type)) {
return false;
}
return coordinates != null ? coordinates.equals(polygon.coordinates) : polygon.coordinates == null;
}

@Override
public int hashCode() {
int result = type.hashCode();
result = 31 * result + (coordinates != null ? coordinates.hashCode() : 0);
return result;
}

@Override
public String toString() {
return this.toJson();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,43 @@ public List<DirectionsRoute> getRoutes() {
public void setRoutes(List<DirectionsRoute> routes) {
this.routes = routes;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}

DirectionsResponse response = (DirectionsResponse) o;

if (getCode() != null ? !getCode().equals(response.getCode()) : response.getCode() != null) {
return false;
}
if (getRoutes() != null ? !getRoutes().equals(response.getRoutes()) : response.getRoutes() != null) {
return false;
}
return getWaypoints() != null ? getWaypoints().equals(response.getWaypoints()) : response.getWaypoints() == null;

}

@Override
public int hashCode() {
int result = 17;
result = 31 * result + (getCode() != null ? getCode().hashCode() : 0);
result = 31 * result + (getRoutes() != null ? getRoutes().hashCode() : 0);
result = 31 * result + (getWaypoints() != null ? getWaypoints().hashCode() : 0);
return result;
}

@Override
public String toString() {
return "DirectionsResponse{"
+ "code='" + code + '\''
+ ", routes=" + routes
+ ", waypoints=" + waypoints
+ '}';
}
}
Loading