Skip to content

Commit 78abd19

Browse files
authored
GeoRSS module support (#319)
1 parent 3a299c1 commit 78abd19

File tree

17 files changed

+1566
-0
lines changed

17 files changed

+1566
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package com.apptasticsoftware.rssreader.module.georss;
2+
3+
import java.util.Objects;
4+
5+
/**
6+
* Represents a geographic coordinate with latitude and longitude.
7+
*/
8+
public class Coordinate {
9+
private double latitude;
10+
private double longitude;
11+
12+
/**
13+
* Constructs a Coordinate with default values.
14+
*/
15+
public Coordinate() {
16+
17+
}
18+
19+
/**
20+
* Constructs a Coordinate with the specified latitude and longitude.
21+
*
22+
* @param latitude the latitude value
23+
* @param longitude the longitude value
24+
*/
25+
public Coordinate(double latitude, double longitude) {
26+
this.latitude = latitude;
27+
this.longitude = longitude;
28+
}
29+
30+
/**
31+
* Returns the latitude value.
32+
*
33+
* @return the latitude
34+
*/
35+
public double getLatitude() {
36+
return latitude;
37+
}
38+
39+
/**
40+
* Sets the latitude value.
41+
*
42+
* @param latitude the latitude to set
43+
*/
44+
public void setLatitude(double latitude) {
45+
this.latitude = latitude;
46+
}
47+
48+
/**
49+
* Returns the longitude value.
50+
*
51+
* @return the longitude
52+
*/
53+
public double getLongitude() {
54+
return longitude;
55+
}
56+
57+
/**
58+
* Sets the longitude value.
59+
*
60+
* @param longitude the longitude to set
61+
*/
62+
public void setLongitude(double longitude) {
63+
this.longitude = longitude;
64+
}
65+
66+
/**
67+
* Compares this coordinate with another object for equality.
68+
*
69+
* @param o the object to compare with
70+
* @return true if both coordinates have equal latitude and longitude
71+
*/
72+
@Override
73+
public boolean equals(Object o) {
74+
if (o == null || getClass() != o.getClass()) return false;
75+
Coordinate that = (Coordinate) o;
76+
return Double.compare(getLatitude(), that.getLatitude()) == 0 && Double.compare(getLongitude(), that.getLongitude()) == 0;
77+
}
78+
79+
/**
80+
* Returns the hash code for this coordinate.
81+
*
82+
* @return the hash code
83+
*/
84+
@Override
85+
public int hashCode() {
86+
return Objects.hash(getLatitude(), getLongitude());
87+
}
88+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.apptasticsoftware.rssreader.module.georss;
2+
3+
import com.apptasticsoftware.rssreader.Channel;
4+
5+
/**
6+
* Represents a GeoRSS channel with geographic extension data.
7+
*/
8+
public interface GeoRssChannel extends Channel, GeoRssChannelData {
9+
10+
/**
11+
* Returns the GeoRSS channel data.
12+
*
13+
* @return the GeoRSS channel data
14+
*/
15+
GeoRssChannelData getGeoRssChannelData();
16+
}
Lines changed: 233 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,233 @@
1+
package com.apptasticsoftware.rssreader.module.georss;
2+
3+
import java.util.List;
4+
import java.util.Optional;
5+
6+
/**
7+
* Interface for GeoRSS channel data containing geographic information.
8+
*/
9+
public interface GeoRssChannelData {
10+
11+
/**
12+
* Returns the underlying GeoRSS channel data implementation.
13+
*
14+
* @return the GeoRSS channel data
15+
*/
16+
GeoRssChannelData getGeoRssChannelData();
17+
18+
/**
19+
* Returns the GeoRSS point as a string.
20+
*
21+
* @return the GeoRSS point
22+
*/
23+
default Optional<String> getGeoRssPoint() {
24+
return getGeoRssChannelData().getGeoRssPoint();
25+
}
26+
27+
/**
28+
* Returns the GeoRSS point as a Coordinate.
29+
*
30+
* @return the coordinate
31+
*/
32+
default Optional<Coordinate> getGeoRssPointAsCoordinate() {
33+
return getGeoRssChannelData().getGeoRssPointAsCoordinate();
34+
}
35+
36+
/**
37+
* Sets the GeoRSS point.
38+
*
39+
* @param geoRssPoint the point to set
40+
*/
41+
default void setGeoRssPoint(String geoRssPoint) {
42+
getGeoRssChannelData().setGeoRssPoint(geoRssPoint);
43+
}
44+
45+
/**
46+
* Returns the GeoRSS line as a string.
47+
*
48+
* @return the GeoRSS line
49+
*/
50+
default Optional<String> getGeoRssLine() {
51+
return getGeoRssChannelData().getGeoRssLine();
52+
}
53+
54+
/**
55+
* Returns the GeoRSS line as a list of Coordinates.
56+
*
57+
* @return the list of coordinates
58+
*/
59+
default List<Coordinate> getGeoRssLineAsCoordinates() {
60+
return getGeoRssChannelData().getGeoRssLineAsCoordinates();
61+
}
62+
63+
/**
64+
* Sets the GeoRSS line.
65+
*
66+
* @param geoRssLine the line to set
67+
*/
68+
default void setGeoRssLine(String geoRssLine) {
69+
getGeoRssChannelData().setGeoRssLine(geoRssLine);
70+
}
71+
72+
/**
73+
* Returns the GeoRSS polygon as a string.
74+
*
75+
* @return the GeoRSS polygon
76+
*/
77+
default Optional<String> getGeoRssPolygon() {
78+
return getGeoRssChannelData().getGeoRssPolygon();
79+
}
80+
81+
/**
82+
* Returns the GeoRSS polygon as a list of Coordinates.
83+
*
84+
* @return the list of coordinates
85+
*/
86+
default List<Coordinate> getGeoRssPolygonAsCoordinates() {
87+
return getGeoRssChannelData().getGeoRssPolygonAsCoordinates();
88+
}
89+
90+
/**
91+
* Sets the GeoRSS polygon.
92+
*
93+
* @param geoRssPolygon the polygon to set
94+
*/
95+
default void setGeoRssPolygon(String geoRssPolygon) {
96+
getGeoRssChannelData().setGeoRssPolygon(geoRssPolygon);
97+
}
98+
99+
/**
100+
* Returns the GeoRSS box as a string.
101+
*
102+
* @return the GeoRSS box
103+
*/
104+
default Optional<String> getGeoRssBox() {
105+
return getGeoRssChannelData().getGeoRssBox();
106+
}
107+
108+
/**
109+
* Returns the GeoRSS box as a list of Coordinates.
110+
*
111+
* @return the list of coordinates
112+
*/
113+
default List<Coordinate> getGeoRssBoxAsCoordinates() {
114+
return getGeoRssChannelData().getGeoRssBoxAsCoordinates();
115+
}
116+
117+
/**
118+
* Sets the GeoRSS box.
119+
*
120+
* @param geoRssBox the box to set
121+
*/
122+
default void setGeoRssBox(String geoRssBox) {
123+
getGeoRssChannelData().setGeoRssBox(geoRssBox);
124+
}
125+
126+
/**
127+
* Returns the GeoRSS elevation.
128+
*
129+
* @return the elevation
130+
*/
131+
default Optional<Double> getGeoRssElevation() {
132+
return getGeoRssChannelData().getGeoRssElevation();
133+
}
134+
135+
/**
136+
* Sets the GeoRSS elevation.
137+
*
138+
* @param geoRssElevation the elevation to set
139+
*/
140+
default void setGeoRssElevation(Double geoRssElevation) {
141+
getGeoRssChannelData().setGeoRssElevation(geoRssElevation);
142+
}
143+
144+
/**
145+
* Returns the GeoRSS floor.
146+
*
147+
* @return the floor
148+
*/
149+
default Optional<Integer> getGeoRssFloor() {
150+
return getGeoRssChannelData().getGeoRssFloor();
151+
}
152+
153+
/**
154+
* Sets the GeoRSS floor.
155+
*
156+
* @param geoRssFloor the floor to set
157+
*/
158+
default void setGeoRssFloor(Integer geoRssFloor) {
159+
getGeoRssChannelData().setGeoRssFloor(geoRssFloor);
160+
}
161+
162+
/**
163+
* Returns the GeoRSS radius.
164+
*
165+
* @return the radius
166+
*/
167+
default Optional<Double> getGeoRssRadius() {
168+
return getGeoRssChannelData().getGeoRssRadius();
169+
}
170+
171+
/**
172+
* Sets the GeoRSS radius.
173+
*
174+
* @param geoRssRadius the radius to set
175+
*/
176+
default void setGeoRssRadius(Double geoRssRadius) {
177+
getGeoRssChannelData().setGeoRssRadius(geoRssRadius);
178+
}
179+
180+
/**
181+
* Returns the GeoRSS feature type tag.
182+
*
183+
* @return the feature type tag
184+
*/
185+
default Optional<String> getGeoRssFeatureTypeTag() {
186+
return getGeoRssChannelData().getGeoRssFeatureTypeTag();
187+
}
188+
189+
/**
190+
* Sets the GeoRSS feature type tag.
191+
*
192+
* @param geoRssFeatureTypeTag the feature type tag to set
193+
*/
194+
default void setGeoRssFeatureTypeTag(String geoRssFeatureTypeTag) {
195+
getGeoRssChannelData().setGeoRssFeatureTypeTag(geoRssFeatureTypeTag);
196+
}
197+
198+
/**
199+
* Returns the GeoRSS relationship tag.
200+
*
201+
* @return the relationship tag
202+
*/
203+
default Optional<String> getGeoRssRelationshipTag() {
204+
return getGeoRssChannelData().getGeoRssRelationshipTag();
205+
}
206+
207+
/**
208+
* Sets the GeoRSS relationship tag.
209+
*
210+
* @param geoRssRelationshipTag the relationship tag to set
211+
*/
212+
default void setGeoRssRelationshipTag(String geoRssRelationshipTag) {
213+
getGeoRssChannelData().setGeoRssRelationshipTag(geoRssRelationshipTag);
214+
}
215+
216+
/**
217+
* Returns the GeoRSS feature name.
218+
*
219+
* @return the feature name
220+
*/
221+
default Optional<String> getGeoRssFeatureName() {
222+
return getGeoRssChannelData().getGeoRssFeatureName();
223+
}
224+
225+
/**
226+
* Sets the GeoRSS feature name.
227+
*
228+
* @param geoRssFeatureName the feature name to set
229+
*/
230+
default void setGeoRssFeatureName(String geoRssFeatureName) {
231+
getGeoRssChannelData().setGeoRssFeatureName(geoRssFeatureName);
232+
}
233+
}

0 commit comments

Comments
 (0)