2013-04-18 23:35:02 +02:00
|
|
|
package net.osmand.data;
|
|
|
|
|
2013-11-10 16:54:28 +01:00
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
import java.util.Map;
|
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
|
|
|
|
public class Amenity extends MapObject {
|
|
|
|
|
2013-11-24 19:45:00 +01:00
|
|
|
public static final String WEBSITE = "website";
|
|
|
|
public static final String PHONE = "phone";
|
|
|
|
public static final String DESCRIPTION = "description";
|
|
|
|
public static final String OPENING_HOURS = "opening_hours";
|
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
private static final long serialVersionUID = 132083949926339552L;
|
|
|
|
private String subType;
|
|
|
|
private AmenityType type;
|
2013-11-10 16:54:28 +01:00
|
|
|
// duplicate for fast access
|
2013-04-18 23:35:02 +02:00
|
|
|
private String openingHours;
|
2013-11-10 16:54:28 +01:00
|
|
|
private Map<String, String> additionalInfo;
|
2013-04-18 23:35:02 +02:00
|
|
|
|
|
|
|
public Amenity(){
|
|
|
|
}
|
|
|
|
|
|
|
|
public AmenityType getType(){
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getSubType(){
|
|
|
|
return subType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setType(AmenityType type) {
|
|
|
|
this.type = type;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSubType(String subType) {
|
|
|
|
this.subType = subType;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getOpeningHours() {
|
2013-11-10 16:54:28 +01:00
|
|
|
// getAdditionalInfo("opening_hours");
|
2013-04-18 23:35:02 +02:00
|
|
|
return openingHours;
|
|
|
|
}
|
|
|
|
|
2013-11-10 16:54:28 +01:00
|
|
|
public String getAdditionalInfo(String key){
|
|
|
|
if(additionalInfo == null) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
return additionalInfo.get(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Map<String, String> getAdditionalInfo() {
|
|
|
|
if(additionalInfo == null) {
|
|
|
|
return Collections.emptyMap();
|
|
|
|
}
|
|
|
|
return additionalInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setAdditionalInfo(Map<String, String> additionalInfo) {
|
|
|
|
this.additionalInfo = additionalInfo;
|
2013-11-24 19:45:00 +01:00
|
|
|
openingHours = additionalInfo.get(OPENING_HOURS);
|
2013-11-10 16:54:28 +01:00
|
|
|
}
|
|
|
|
|
2013-11-13 14:13:48 +01:00
|
|
|
|
2013-11-10 16:54:28 +01:00
|
|
|
public void setAdditionalInfo(String tag, String value) {
|
|
|
|
if(this.additionalInfo == null){
|
|
|
|
this.additionalInfo = new LinkedHashMap<String, String>();
|
|
|
|
}
|
2013-11-20 10:34:31 +01:00
|
|
|
this.additionalInfo.put(tag, value);
|
2013-11-24 19:45:00 +01:00
|
|
|
if(OPENING_HOURS.equals(tag)) {
|
2013-11-13 14:13:48 +01:00
|
|
|
this.openingHours = value;
|
|
|
|
}
|
2013-11-10 16:54:28 +01:00
|
|
|
}
|
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return type.toString() + " : " + subType + " "+ getName();
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getSite() {
|
2013-11-24 19:45:00 +01:00
|
|
|
return getAdditionalInfo(WEBSITE);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setSite(String site) {
|
2013-11-24 19:45:00 +01:00
|
|
|
setAdditionalInfo(WEBSITE, site);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getPhone() {
|
2013-11-24 19:45:00 +01:00
|
|
|
return getAdditionalInfo(PHONE);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setPhone(String phone) {
|
2013-11-24 19:45:00 +01:00
|
|
|
setAdditionalInfo(PHONE, phone);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getDescription() {
|
2013-11-24 19:45:00 +01:00
|
|
|
return getAdditionalInfo(DESCRIPTION);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void setDescription(String description) {
|
2013-11-24 19:45:00 +01:00
|
|
|
setAdditionalInfo(DESCRIPTION, description);
|
2013-04-18 23:35:02 +02:00
|
|
|
}
|
|
|
|
|
2013-11-13 14:13:48 +01:00
|
|
|
public void setOpeningHours(String openingHours) {
|
2013-11-24 19:45:00 +01:00
|
|
|
setAdditionalInfo(OPENING_HOURS, openingHours);
|
2013-11-13 14:13:48 +01:00
|
|
|
}
|
|
|
|
|
2013-04-18 23:35:02 +02:00
|
|
|
|
|
|
|
}
|