Skip to content
Merged
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
@@ -0,0 +1,88 @@
package com.apptasticsoftware.rssreader.module.georss;

import java.util.Objects;

/**
* Represents a geographic coordinate with latitude and longitude.
*/
public class Coordinate {
private double latitude;
private double longitude;

/**
* Constructs a Coordinate with default values.
*/
public Coordinate() {

}

/**
* Constructs a Coordinate with the specified latitude and longitude.
*
* @param latitude the latitude value
* @param longitude the longitude value
*/
public Coordinate(double latitude, double longitude) {
this.latitude = latitude;
this.longitude = longitude;
}

/**
* Returns the latitude value.
*
* @return the latitude
*/
public double getLatitude() {
return latitude;
}

/**
* Sets the latitude value.
*
* @param latitude the latitude to set
*/
public void setLatitude(double latitude) {
this.latitude = latitude;
}

/**
* Returns the longitude value.
*
* @return the longitude
*/
public double getLongitude() {
return longitude;
}

/**
* Sets the longitude value.
*
* @param longitude the longitude to set
*/
public void setLongitude(double longitude) {
this.longitude = longitude;
}

/**
* Compares this coordinate with another object for equality.
*
* @param o the object to compare with
* @return true if both coordinates have equal latitude and longitude
*/
@Override
public boolean equals(Object o) {
if (o == null || getClass() != o.getClass()) return false;
Coordinate that = (Coordinate) o;
return Double.compare(getLatitude(), that.getLatitude()) == 0 && Double.compare(getLongitude(), that.getLongitude()) == 0;
}

/**
* Returns the hash code for this coordinate.
*
* @return the hash code
*/
@Override
public int hashCode() {
return Objects.hash(getLatitude(), getLongitude());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.apptasticsoftware.rssreader.module.georss;

import com.apptasticsoftware.rssreader.Channel;

/**
* Represents a GeoRSS channel with geographic extension data.
*/
public interface GeoRssChannel extends Channel, GeoRssChannelData {

/**
* Returns the GeoRSS channel data.
*
* @return the GeoRSS channel data
*/
GeoRssChannelData getGeoRssChannelData();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
package com.apptasticsoftware.rssreader.module.georss;

import java.util.List;
import java.util.Optional;

/**
* Interface for GeoRSS channel data containing geographic information.
*/
public interface GeoRssChannelData {

/**
* Returns the underlying GeoRSS channel data implementation.
*
* @return the GeoRSS channel data
*/
GeoRssChannelData getGeoRssChannelData();

/**
* Returns the GeoRSS point as a string.
*
* @return the GeoRSS point
*/
default Optional<String> getGeoRssPoint() {
return getGeoRssChannelData().getGeoRssPoint();
}

/**
* Returns the GeoRSS point as a Coordinate.
*
* @return the coordinate
*/
default Optional<Coordinate> getGeoRssPointAsCoordinate() {
return getGeoRssChannelData().getGeoRssPointAsCoordinate();
}

/**
* Sets the GeoRSS point.
*
* @param geoRssPoint the point to set
*/
default void setGeoRssPoint(String geoRssPoint) {
getGeoRssChannelData().setGeoRssPoint(geoRssPoint);
}

/**
* Returns the GeoRSS line as a string.
*
* @return the GeoRSS line
*/
default Optional<String> getGeoRssLine() {
return getGeoRssChannelData().getGeoRssLine();
}

/**
* Returns the GeoRSS line as a list of Coordinates.
*
* @return the list of coordinates
*/
default List<Coordinate> getGeoRssLineAsCoordinates() {
return getGeoRssChannelData().getGeoRssLineAsCoordinates();
}

/**
* Sets the GeoRSS line.
*
* @param geoRssLine the line to set
*/
default void setGeoRssLine(String geoRssLine) {
getGeoRssChannelData().setGeoRssLine(geoRssLine);
}

/**
* Returns the GeoRSS polygon as a string.
*
* @return the GeoRSS polygon
*/
default Optional<String> getGeoRssPolygon() {
return getGeoRssChannelData().getGeoRssPolygon();
}

/**
* Returns the GeoRSS polygon as a list of Coordinates.
*
* @return the list of coordinates
*/
default List<Coordinate> getGeoRssPolygonAsCoordinates() {
return getGeoRssChannelData().getGeoRssPolygonAsCoordinates();
}

/**
* Sets the GeoRSS polygon.
*
* @param geoRssPolygon the polygon to set
*/
default void setGeoRssPolygon(String geoRssPolygon) {
getGeoRssChannelData().setGeoRssPolygon(geoRssPolygon);
}

/**
* Returns the GeoRSS box as a string.
*
* @return the GeoRSS box
*/
default Optional<String> getGeoRssBox() {
return getGeoRssChannelData().getGeoRssBox();
}

/**
* Returns the GeoRSS box as a list of Coordinates.
*
* @return the list of coordinates
*/
default List<Coordinate> getGeoRssBoxAsCoordinates() {
return getGeoRssChannelData().getGeoRssBoxAsCoordinates();
}

/**
* Sets the GeoRSS box.
*
* @param geoRssBox the box to set
*/
default void setGeoRssBox(String geoRssBox) {
getGeoRssChannelData().setGeoRssBox(geoRssBox);
}

/**
* Returns the GeoRSS elevation.
*
* @return the elevation
*/
default Optional<Double> getGeoRssElevation() {
return getGeoRssChannelData().getGeoRssElevation();
}

/**
* Sets the GeoRSS elevation.
*
* @param geoRssElevation the elevation to set
*/
default void setGeoRssElevation(Double geoRssElevation) {
getGeoRssChannelData().setGeoRssElevation(geoRssElevation);
}

/**
* Returns the GeoRSS floor.
*
* @return the floor
*/
default Optional<Integer> getGeoRssFloor() {
return getGeoRssChannelData().getGeoRssFloor();
}

/**
* Sets the GeoRSS floor.
*
* @param geoRssFloor the floor to set
*/
default void setGeoRssFloor(Integer geoRssFloor) {
getGeoRssChannelData().setGeoRssFloor(geoRssFloor);
}

/**
* Returns the GeoRSS radius.
*
* @return the radius
*/
default Optional<Double> getGeoRssRadius() {
return getGeoRssChannelData().getGeoRssRadius();
}

/**
* Sets the GeoRSS radius.
*
* @param geoRssRadius the radius to set
*/
default void setGeoRssRadius(Double geoRssRadius) {
getGeoRssChannelData().setGeoRssRadius(geoRssRadius);
}

/**
* Returns the GeoRSS feature type tag.
*
* @return the feature type tag
*/
default Optional<String> getGeoRssFeatureTypeTag() {
return getGeoRssChannelData().getGeoRssFeatureTypeTag();
}

/**
* Sets the GeoRSS feature type tag.
*
* @param geoRssFeatureTypeTag the feature type tag to set
*/
default void setGeoRssFeatureTypeTag(String geoRssFeatureTypeTag) {
getGeoRssChannelData().setGeoRssFeatureTypeTag(geoRssFeatureTypeTag);
}

/**
* Returns the GeoRSS relationship tag.
*
* @return the relationship tag
*/
default Optional<String> getGeoRssRelationshipTag() {
return getGeoRssChannelData().getGeoRssRelationshipTag();
}

/**
* Sets the GeoRSS relationship tag.
*
* @param geoRssRelationshipTag the relationship tag to set
*/
default void setGeoRssRelationshipTag(String geoRssRelationshipTag) {
getGeoRssChannelData().setGeoRssRelationshipTag(geoRssRelationshipTag);
}

/**
* Returns the GeoRSS feature name.
*
* @return the feature name
*/
default Optional<String> getGeoRssFeatureName() {
return getGeoRssChannelData().getGeoRssFeatureName();
}

/**
* Sets the GeoRSS feature name.
*
* @param geoRssFeatureName the feature name to set
*/
default void setGeoRssFeatureName(String geoRssFeatureName) {
getGeoRssChannelData().setGeoRssFeatureName(geoRssFeatureName);
}
}
Loading