Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial OSMParser #21

Merged
merged 13 commits into from
Mar 18, 2024
47 changes: 0 additions & 47 deletions src/main/java/org/Tags.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/main/java/org/example/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
package org.example;

import org.parser.FileDistributer;
import org.parser.XMLParser;
//import org.parser.XMLParser;
import org.parser.XMLReader;
import org.parser.XMLWriter;

Expand Down
49 changes: 0 additions & 49 deletions src/main/java/org/parser/ParseTagResult.java

This file was deleted.

197 changes: 0 additions & 197 deletions src/main/java/org/parser/Tag.java

This file was deleted.

30 changes: 30 additions & 0 deletions src/main/java/org/parser/TagAddress.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.parser;

import java.util.HashMap;

enum Address{
ID, LAT, LON, CITY, STREET, HOUSENUMBER, POSTCODE, MUNICIPALITY;
}

/**
* Class for storing a {@link HashMap} of the adress tags.
* Contains the following tags:
* <p>
* {@link Address#ID}, {@link Address#LAT}, {@link Address#LON}, {@link Address#STREET}, {@link Address#HOUSENUMBER}, {@link Address#POSTCODE}, {@link Address#MUNICIPALITY}
* </p>
*/
public class TagAddress extends HashMap<Address, String> {
TagAddress(XMLReader.Builder builder){
super(new HashMap<Address, String>(){
{
put(Address.ID, builder.getID().toString());
put(Address.LAT, builder.getLat().toString());
put(Address.LON, builder.getLon().toString());
put(Address.STREET, builder.getAddressBuilder().street);
put(Address.HOUSENUMBER, builder.getAddressBuilder().house);
put(Address.POSTCODE, builder.getAddressBuilder().postcode);
put(Address.MUNICIPALITY, builder.getAddressBuilder().municipality);
}
});
}
}
58 changes: 58 additions & 0 deletions src/main/java/org/parser/TagBound.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.parser;

import java.math.BigDecimal;
import java.util.HashMap;
import javax.xml.stream.XMLStreamReader;

enum Bounds {
MINLAT, MAXLAT, MINLON, MAXLON
}

/**
* Class for storing a {@link HashMap} of the bounds tags.
* Contains the following tags:
* <p>
* {@link Bounds#MINLAT}, {@link Bounds#MAXLAT}, {@link Bounds#MINLON}, {@link Bounds#MAXLON}
* </p>
*/
public class TagBound extends HashMap<Bounds, BigDecimal>{
public TagBound(XMLStreamReader reader) {
super(new HashMap<Bounds, BigDecimal>(){
{
put(Bounds.MINLAT, XMLReader.getAttributeByBigDecimal(reader, "minlat"));
put(Bounds.MAXLAT, XMLReader.getAttributeByBigDecimal(reader, "maxlat"));
put(Bounds.MINLON, XMLReader.getAttributeByBigDecimal(reader, "minlon"));
put(Bounds.MAXLON, XMLReader.getAttributeByBigDecimal(reader, "maxlon"));
}
});
}

/**
* Get the minimum latitude of the bounds.
* @return The minimum latitude of the bounds.
*/
public BigDecimal getMinLat() {
return this.get(Bounds.MINLAT);
}
/**
* Get the maximum latitude of the bounds.
* @return The maximum latitude of the bounds.
*/
public BigDecimal getMaxLat() {
return this.get(Bounds.MAXLAT);
}
/**
* Get the minimum longitude of the bounds.
* @return The minimum longitude of the bounds.
*/
public BigDecimal getMinLon() {
return this.get(Bounds.MINLON);
}
/**
* Get the maximum longitude of the bounds.
* @return The maximum longitude of the bounds.
*/
public BigDecimal getMaxLon() {
return this.get(Bounds.MAXLON);
}
}
Loading