This repository has been archived on 2025-02-01. You can view files and clone it, but cannot push or open issues or pull requests.
SBBCli/src/sbbcommandline/objects/SBBStation.java

50 lines
1.3 KiB
Java

package sbbcommandline.objects;
import org.jdom2.Element;
public class SBBStation {
/** Name of the station */
private String name;
/** Identifier of the station in the HAFAS system */
private String externalId;
/** UNKNOWN */
private String externalStationNr;
/** Always WGS84 */
private String type;
/** GPS Coordinates */
private int x;
/** GPS Coordinates */
private int y;
private final static String ELEMENT_NAME = "Station";
public SBBStation(String name) {
this.name = name;
}
public void fillFromXML(Element elem) {
if (!elem.getName().equals(ELEMENT_NAME)) throw new IllegalArgumentException("XML Element must be " + ELEMENT_NAME);
this.name = elem.getAttributeValue("name");
this.externalId = elem.getAttributeValue("externalId");
this.externalStationNr = elem.getAttributeValue("externalStationNr");
this.type = elem.getAttributeValue("type");
this.x = Integer.parseInt(elem.getAttributeValue("x"));
this.y = Integer.parseInt(elem.getAttributeValue("y"));
}
public String getName() {
return name;
}
public String getExternalId() {
return externalId;
}
}