public class MarkerPostTypeConverter implements
		Converter<MarkerPostType, MarkerPost> {

	public static final Converter<MarkerPostType, MarkerPost> INSTANCE = new MarkerPostTypeConverter();

	public MarkerPost convert(MarkerPostType value) {
		Ensure.propertyIsNull(value.getBeginLifespanVersion(), value,
				"beginLifespanVersion");
		Ensure.propertyIsNull(value.getBoundedBy(), value, "boundedBy");
		Ensure.propertyIsNull(value.getDescription(), value, "description");
		Ensure.propertyIsNull(value.getDescriptionReference(), value,
				"descriptionReference");
		Ensure.propertyIsNull(value.getLocation(), value, "location");
		Ensure.propertyIsNull(value.getValidFrom(), value, "validFrom");
		Ensure.propertyIsNil(value.getValidTo(), value, "validTo");

		Ensure.propertyIsEmpty(value.getMetaDataProperty(), value,
				"metaDataProperty");
		Ensure.propertyIsEmpty(value.getName(), value, "name");
		Ensure.propertyIsNil(value.getEndLifespanVersion(), value,
				"endLifespanVersion");
		Ensure.propertyIsNotNull(value.getInspireId(), value, "inspireId");
		Ensure.propertyIsNotNull(value.getGeometry(), value, "geometry");

		final String id = CodeWithAuthorityTypeToStringConverter.INSTANCE
				.convert(value.getIdentifier());
		Ensure.propertyStartsWith(id, value, "identifier",
				DBNetzConstants.ID_COLON_PREFIX);
		final String localId = IdentifierPropertyTypeToStringConverter.INSTANCE
				.convert(value.getInspireId());
		final String expectedLocalId = id.substring(DBNetzConstants.ID_COLON_PREFIX
				.length());
		Ensure.propertyEquals(value.getId(), value, "id", localId);
		Ensure.propertyEquals(value.getId(), value, "id", expectedLocalId);

		final List<Double> coordinates = PointPropertyTypeToDoublesConverter.INSTANCE
				.convert(value.getGeometry());

		final ReferenceType inNetwork = Ensure.propertyHasSingleItem(
				value.getInNetwork(), value, "inNetwork");
		final String inNetworkId = ReferenceTypeToStringConverter.INSTANCE
				.convert(inNetwork);

		final String railwayLineId;
		if (value.getRoute() != null) {
			railwayLineId = ReferenceTypeToStringConverter.INSTANCE
					.convert(value.getRoute());
		} else {
			railwayLineId = null;
		}

		Ensure.propertyIsNotNull(value.getMarkerLocation(), value,
				"markerLocation");

		final Double location = LengthTypeToDoubleConverter.INSTANCE
				.convert(value.getMarkerLocation());

		return new MarkerPost(localId, railwayLineId, location, coordinates);
	}
} public class RailwayLineTypeConverter implements
		Converter<RailwayLineType, RailwayLine> {

	public static final Converter<RailwayLineType, RailwayLine> INSTANCE = new RailwayLineTypeConverter();

	@Override
	public RailwayLine convert(RailwayLineType value) {
		Validate.notNull(value);
		Ensure.propertyIsNull(value.getBeginLifespanVersion(), value,
				"beginLifespanVersion");
		Ensure.propertyIsNull(value.getBoundedBy(), value, "boundedBy");
		Ensure.propertyIsNull(value.getDescription(), value, "description");
		Ensure.propertyIsNull(value.getDescriptionReference(), value,
				"descriptionReference");
		Ensure.propertyIsNull(value.getLocation(), value, "location");
		Ensure.propertyIsNull(value.getValidFrom(), value, "validFrom");
		Ensure.propertyIsNull(value.getValidTo(), value, "validTo");

		Ensure.propertyIsEmpty(value.getMetaDataProperty(), value,
				"metaDataProperty");
		Ensure.propertyIsEmpty(value.getName(), value, "name");
		Ensure.propertyIsNil(value.getEndLifespanVersion(), value,
				"endLifespanVersion");
		Ensure.propertyIsNotNull(value.getGeographicalName(), value,
				"geographicalName");
		Ensure.propertyIsNotNull(value.getInspireId(), value, "inspireId");

		// Ensure.propertyIsNotNull(value.getStartNode(), value, "startNode");
		// Ensure.propertyIsNotNull(value.getEndNode(), value, "endNode");
		Ensure.propertyIsNotNull(value.getInNetwork(), value, "inNetwork");

		final String geographicalName = TransportLinkSetType_JAXBElement_GeographicalName_ToStringConverter.INSTANCE
				.convert(value.getGeographicalName());
		final String id = CodeWithAuthorityTypeToStringConverter.INSTANCE
				.convert(value.getIdentifier());
		Ensure.propertyStartsWith(id, value, "identifier",
				DBNetzConstants.ID_COLON_PREFIX);
		final String localId = IdentifierPropertyTypeToStringConverter.INSTANCE
				.convert(value.getInspireId());
		final String expectedLocalId = id.substring(DBNetzConstants.ID_COLON_PREFIX
				.length());
		Ensure.propertyEquals(value.getId(), value, "id", localId);
		Ensure.propertyEquals(value.getId(), value, "id", expectedLocalId);

		final ReferenceType inNetwork = Ensure.propertyHasSingleItem(
				value.getInNetwork(), value, "inNetwork");
		final String inNetworkId = ReferenceTypeToStringConverter.INSTANCE
				.convert(inNetwork);

		Ensure.propertyIsNotEmpty(value.getLink(), value, "link");

		final List<String> linkIds = new ArrayList<>(value.getLink().size());
		for (final Link link : value.getLink()) {
			linkIds.add(LinkSetType_LinkToIdConverter.INSTANCE.convert(link));
		}
		Ensure.propertyIsNotNull(value.getRailwayLineCode(), value,
				"railwayLineCode");
		final RailwayLineCode railwayLineCode = value.getRailwayLineCode();
		final String code = RailwayLineCodeToIdConverter.INSTANCE
				.convert(railwayLineCode);

		return new RailwayLine(localId, geographicalName, code, linkIds);
	}

} public class RailwayLinkSequenceTypeConverter implements
		Converter<RailwayLinkSequenceType, RailwayLinkSequence> {

	public static final Converter<RailwayLinkSequenceType, RailwayLinkSequence> INSTANCE = new RailwayLinkSequenceTypeConverter();

	@Override
	public RailwayLinkSequence convert(RailwayLinkSequenceType value) {
		Validate.notNull(value);
		Ensure.propertyIsNull(value.getBeginLifespanVersion(), value,
				"beginLifespanVersion");
		Ensure.propertyIsNull(value.getBoundedBy(), value, "boundedBy");
		Ensure.propertyIsNull(value.getDescription(), value, "description");
		Ensure.propertyIsNull(value.getDescriptionReference(), value,
				"descriptionReference");
		Ensure.propertyIsNull(value.getLocation(), value, "location");
		Ensure.propertyIsNull(value.getValidFrom(), value, "validFrom");
		Ensure.propertyIsNull(value.getValidTo(), value, "validTo");

		Ensure.propertyIsEmpty(value.getMetaDataProperty(), value,
				"metaDataProperty");
		Ensure.propertyIsEmpty(value.getName(), value, "name");
		Ensure.propertyIsNil(value.getEndLifespanVersion(), value,
				"endLifespanVersion");
		Ensure.propertyIsNull(value.getGeographicalName(), value,
				"geographicalName");
		Ensure.propertyIsNotNull(value.getInspireId(), value, "inspireId");

		// Ensure.propertyIsNotNull(value.getStartNode(), value, "startNode");
		// Ensure.propertyIsNotNull(value.getEndNode(), value, "endNode");
		Ensure.propertyIsNotNull(value.getInNetwork(), value, "inNetwork");

		// final String geographicalName =
		// TransportLinkType_JAXBElement_GeographicalName_ToStringConverter.INSTANCE
		// .convert(value.getGeographicalName());
		final String id = CodeWithAuthorityTypeToStringConverter.INSTANCE
				.convert(value.getIdentifier());
		Ensure.propertyStartsWith(id, value, "identifier",
				DBNetzConstants.ID_COLON_PREFIX);
		final String localId = IdentifierPropertyTypeToStringConverter.INSTANCE
				.convert(value.getInspireId());
		final String expectedLocalId = id.substring(DBNetzConstants.ID_COLON_PREFIX
				.length());
		Ensure.propertyEquals(value.getId(), value, "id", localId);
		Ensure.propertyEquals(value.getId(), value, "id", expectedLocalId);

		final ReferenceType inNetwork = Ensure.propertyHasSingleItem(
				value.getInNetwork(), value, "inNetwork");
		final String inNetworkId = ReferenceTypeToStringConverter.INSTANCE
				.convert(inNetwork);

		Ensure.propertyIsNotEmpty(value.getLink(), value, "link");

		final List<String> railwayLinkIds = new ArrayList<>(value.getLink().size());
		for (final DirectedLinkPropertyType link : value.getLink()) {
			railwayLinkIds.add(DirectedLinkPropertyTypeToIdConverter.INSTANCE
					.convert(link));
		}

		return new RailwayLinkSequence(localId, railwayLinkIds);
	}

} public class RailwayLinkTypeConverter implements
		Converter<RailwayLinkType, RailwayLink> {

	public static final Converter<RailwayLinkType, RailwayLink> INSTANCE = new RailwayLinkTypeConverter();

	@Override
	public RailwayLink convert(RailwayLinkType value) {
		Validate.notNull(value);
		Ensure.propertyIsNull(value.getBeginLifespanVersion(), value,
				"beginLifespanVersion");
		Ensure.propertyIsNull(value.getBoundedBy(), value, "boundedBy");
		Ensure.propertyIsNull(value.getDescription(), value, "description");
		Ensure.propertyIsNull(value.getDescriptionReference(), value,
				"descriptionReference");
		Ensure.propertyIsNull(value.getLocation(), value, "location");
		Ensure.propertyIsNull(value.getValidFrom(), value, "validFrom");
		Ensure.propertyIsNull(value.getValidTo(), value, "validTo");

		Ensure.propertyIsEmpty(value.getMetaDataProperty(), value,
				"metaDataProperty");
		Ensure.propertyIsEmpty(value.getName(), value, "name");
		Ensure.propertyIsNil(value.getEndLifespanVersion(), value,
				"endLifespanVersion");
		Ensure.propertyIsNull(value.getGeographicalName(), value,
				"geographicalName");
		Ensure.propertyIsNotNull(value.getInspireId(), value, "inspireId");
		Ensure.propertyIsNotNull(value.getCentrelineGeometry(), value,
				"centrelineGeometry");

		Ensure.propertyIsNotNull(value.getStartNode(), value, "startNode");
		Ensure.propertyIsNotNull(value.getEndNode(), value, "endNode");
		Ensure.propertyIsNotNull(value.getInNetwork(), value, "inNetwork");

		// final String geographicalName =
		// TransportLinkType_JAXBElement_GeographicalName_ToStringConverter.INSTANCE
		// .convert(value.getGeographicalName());
		final String id = CodeWithAuthorityTypeToStringConverter.INSTANCE
				.convert(value.getIdentifier());
		Ensure.propertyStartsWith(id, value, "identifier",
				DBNetzConstants.ID_COLON_PREFIX);
		final String localId = IdentifierPropertyTypeToStringConverter.INSTANCE
				.convert(value.getInspireId());
		final String expectedLocalId = id.substring(DBNetzConstants.ID_COLON_PREFIX
				.length());
		Ensure.propertyEquals(value.getId(), value, "id", localId);
		Ensure.propertyEquals(value.getId(), value, "id", expectedLocalId);

		final List<Double> coordinates = CurvePropertyTypeToDoublesConverter.INSTANCE
				.convert(value.getCentrelineGeometry());

		final ReferenceType inNetwork = Ensure.propertyHasSingleItem(
				value.getInNetwork(), value, "inNetwork");
		final String inNetworkId = ReferenceTypeToStringConverter.INSTANCE
				.convert(inNetwork);

		final String startNodeId = ReferenceTypeToStringConverter.INSTANCE
				.convert(value.getStartNode());
		final String endNodeId = ReferenceTypeToStringConverter.INSTANCE
				.convert(value.getEndNode());

		Ensure.propertyEquals(value.isFictitious(), value, "fictitious", false);

		return new RailwayLink(localId, startNodeId, endNodeId, coordinates);
	}

} public class RailwayNodeTypeConverter implements
		Converter<RailwayNodeType, RailwayNode> {

	public static final Converter<RailwayNodeType, RailwayNode> INSTANCE = new RailwayNodeTypeConverter();

	public RailwayNode convert(RailwayNodeType value) {
		Ensure.propertyIsNull(value.getBeginLifespanVersion(), value,
				"beginLifespanVersion");
		Ensure.propertyIsNull(value.getBoundedBy(), value, "boundedBy");
		Ensure.propertyIsNull(value.getDescription(), value, "description");
		Ensure.propertyIsNull(value.getDescriptionReference(), value,
				"descriptionReference");
		Ensure.propertyIsNull(value.getLocation(), value, "location");
		Ensure.propertyIsNull(value.getValidFrom(), value, "validFrom");
		Ensure.propertyIsNull(value.getValidTo(), value, "validTo");

		Ensure.propertyIsEmpty(value.getMetaDataProperty(), value,
				"metaDataProperty");
		Ensure.propertyIsEmpty(value.getName(), value, "name");
		Ensure.propertyIsNil(value.getEndLifespanVersion(), value,
				"endLifespanVersion");
		Ensure.propertyIsNotNull(value.getFormOfNode(), value, "formOfNode");
		// Ensure.propertyIsNil(value.getGeographicalName(), value,
		// "geographicalName");
		Ensure.propertyIsNotNull(value.getInspireId(), value, "inspireId");
		Ensure.propertyIsNotNull(value.getGeometry(), value, "geometry");

		final String formOfNode = FormOfNodeToStringConverter.INSTANCE
				.convert(value.getFormOfNode());
		final String geographicalName;
		if (value.getGeographicalName() != null
				&& !value.getGeographicalName().isNil()) {
			geographicalName = TransportNodeType_JAXBElement_GeographicalName_ToStringConverter.INSTANCE
					.convert(value.getGeographicalName());
		} else {
			geographicalName = null;
		}
		final String id = CodeWithAuthorityTypeToStringConverter.INSTANCE
				.convert(value.getIdentifier());
		Ensure.propertyStartsWith(id, value, "identifier",
				DBNetzConstants.ID_COLON_PREFIX);
		final String localId = IdentifierPropertyTypeToStringConverter.INSTANCE
				.convert(value.getInspireId());
		final String expectedLocalId = id.substring(DBNetzConstants.ID_COLON_PREFIX
				.length());
		Ensure.propertyEquals(value.getId(), value, "id", localId);
		Ensure.propertyEquals(value.getId(), value, "id", expectedLocalId);

		final List<Double> coordinates = PointPropertyTypeToDoublesConverter.INSTANCE
				.convert(value.getGeometry());

		final ReferenceType inNetwork = Ensure.propertyHasSingleItem(
				value.getInNetwork(), value, "inNetwork");
		final String inNetworkId = ReferenceTypeToStringConverter.INSTANCE
				.convert(inNetwork);

		Ensure.propertyHasNoNulls(value.getSpokeStart(), value, "spokeStart");
		Ensure.propertyHasNoNulls(value.getSpokeEnd(), value, "spokeEnd");
		// TODO set?
		final List<String> spokeStart = new ArrayList<>(value.getSpokeStart()
				.size());
		for (ReferenceType reference : value.getSpokeStart()) {
			spokeStart.add(ReferenceTypeToStringConverter.INSTANCE
					.convert(reference));
		}
		final List<String> spokeEnd = new ArrayList<>(value.getSpokeEnd()
				.size());
		for (ReferenceType reference : value.getSpokeEnd()) {
			spokeEnd.add(ReferenceTypeToStringConverter.INSTANCE
					.convert(reference));
		}

		return new RailwayNode(localId, geographicalName, formOfNode,
				spokeStart, spokeEnd, coordinates);
	}
} public class RailwayStationCodeTypeConverter implements
		Converter<RailwayStationCodeType, RailwayStationCode> {

	public static final RailwayStationCodeTypeConverter INSTANCE = new RailwayStationCodeTypeConverter();

	public RailwayStationCode convert(RailwayStationCodeType value) {
		Ensure.propertyIsNull(value.getBeginLifespanVersion(), value,
				"beginLifespanVersion");
		Ensure.propertyIsNull(value.getBoundedBy(), value, "boundedBy");
		Ensure.propertyIsNull(value.getDescription(), value, "description");
		Ensure.propertyIsNull(value.getDescriptionReference(), value,
				"descriptionReference");
		Ensure.propertyIsNull(value.getLocation(), value, "location");
		Ensure.propertyIsNull(value.getValidFrom(), value, "validFrom");
		Ensure.propertyIsNil(value.getValidTo(), value, "validTo");

		Ensure.propertyIsEmpty(value.getMetaDataProperty(), value,
				"metaDataProperty");
		Ensure.propertyIsEmpty(value.getName(), value, "name");
		Ensure.propertyIsNil(value.getEndLifespanVersion(), value,
				"endLifespanVersion");
		Ensure.propertyIsNotNull(value.getInspireId(), value, "inspireId");

		final NetworkRef networkRef = Ensure.propertyHasSingleItem(
				value.getNetworkRef(), value, "networkRef");

		final String railwayStationNodeId = NetworkRefToRailwayStationNodeIdConverter.INSTANCE
				.convert(networkRef);

		final String id = CodeWithAuthorityTypeToStringConverter.INSTANCE
				.convert(value.getIdentifier());
		Ensure.propertyStartsWith(id, value, "identifier",
				DBNetzConstants.ID_COLON_PREFIX);
		final String localId = IdentifierPropertyTypeToStringConverter.INSTANCE
				.convert(value.getInspireId());
		final String expectedLocalId = id.substring(DBNetzConstants.ID_COLON_PREFIX
				.length());
		Ensure.propertyEquals(value.getId(), value, "id", localId);
		Ensure.propertyEquals(value.getId(), value, "id", expectedLocalId);

		Ensure.propertyIsNotNull(value.getStationCode(), value, "stationCode");
		final String stationCode = value.getStationCode().trim();

		return new RailwayStationCode(localId, railwayStationNodeId,
				stationCode);
	}
} public class RailwayStationNodeTypeConverter implements
		Converter<RailwayStationNodeType, RailwayStationNode> {

	public static final RailwayStationNodeTypeConverter INSTANCE = new RailwayStationNodeTypeConverter();

	public RailwayStationNode convert(RailwayStationNodeType value) {
		Ensure.propertyIsNull(value.getBeginLifespanVersion(), value,
				"beginLifespanVersion");
		Ensure.propertyIsNull(value.getBoundedBy(), value, "boundedBy");
		Ensure.propertyIsNull(value.getDescription(), value, "description");
		Ensure.propertyIsNull(value.getDescriptionReference(), value,
				"descriptionReference");
		Ensure.propertyIsNull(value.getLocation(), value, "location");
		Ensure.propertyIsNull(value.getNumberOfPlatforms(), value,
				"numberOfPlatforms");
		Ensure.propertyIsNull(value.getValidFrom(), value, "validFrom");
		Ensure.propertyIsNull(value.getValidTo(), value, "validTo");

		Ensure.propertyIsEmpty(value.getMetaDataProperty(), value,
				"metaDataProperty");
		Ensure.propertyIsEmpty(value.getName(), value, "name");
		Ensure.propertyIsNil(value.getEndLifespanVersion(), value,
				"endLifespanVersion");
		Ensure.propertyIsNotNull(value.getFormOfNode(), value, "formOfNode");
		Ensure.propertyIsNotNull(value.getGeographicalName(), value,
				"geographicalName");
		Ensure.propertyIsNotNull(value.getInspireId(), value, "inspireId");
		Ensure.propertyIsNotNull(value.getGeometry(), value, "geometry");

		final String formOfNode = FormOfNodeToStringConverter.INSTANCE
				.convert(value.getFormOfNode());
		final String geographicalName = TransportNodeType_JAXBElement_GeographicalName_ToStringConverter.INSTANCE
				.convert(value.getGeographicalName());
		final String id = CodeWithAuthorityTypeToStringConverter.INSTANCE
				.convert(value.getIdentifier());
		Ensure.propertyStartsWith(id, value, "identifier",
				DBNetzConstants.ID_COLON_PREFIX);
		final String localId = IdentifierPropertyTypeToStringConverter.INSTANCE
				.convert(value.getInspireId());
		final String expectedLocalId = id.substring(DBNetzConstants.ID_COLON_PREFIX
				.length());
		Ensure.propertyEquals(value.getId(), value, "id", localId);
		Ensure.propertyEquals(value.getId(), value, "id", expectedLocalId);

		final List<Double> coordinates = PointPropertyTypeToDoublesConverter.INSTANCE
				.convert(value.getGeometry());

		final double x = coordinates.get(0);
		final double y = coordinates.get(1);

		final ReferenceType inNetwork = Ensure.propertyHasSingleItem(
				value.getInNetwork(), value, "inNetwork");
		final String inNetworkId = ReferenceTypeToStringConverter.INSTANCE
				.convert(inNetwork);

		Ensure.propertyHasNoNulls(value.getSpokeStart(), value, "spokeStart");
		Ensure.propertyHasNoNulls(value.getSpokeEnd(), value, "spokeEnd");
		// TODO set?
		final List<String> spokeStartIds = new ArrayList<>(value.getSpokeStart()
				.size());
		for (ReferenceType reference : value.getSpokeStart()) {
			spokeStartIds.add(ReferenceTypeToStringConverter.INSTANCE
					.convert(reference));
		}
		final List<String> spokeEndIds = new ArrayList<>(value.getSpokeEnd()
				.size());
		for (ReferenceType reference : value.getSpokeEnd()) {
			spokeEndIds.add(ReferenceTypeToStringConverter.INSTANCE
					.convert(reference));
		}

		return new RailwayStationNode(localId, 
				geographicalName, formOfNode, spokeStartIds, spokeEndIds, coordinates);
	}
} public class DistanceCalculator {

	public static double calculateDistance(double[] a, double[] b,
			double[] q) {
		final Vector2D ab = new Vector2D(b[0] - a[0], b[1] - a[1]);
		final Vector2D aq = new Vector2D(q[0] - a[0], q[1] - a[1]);
		final Vector2D bq = new Vector2D(q[0] - b[0], q[1] - b[1]);

		final double aqDotProduct = ab.dotProduct(aq);
		final double bqDotProduct = -ab.dotProduct(bq);
		
		if (aqDotProduct < 0)
		{
			return aq.getNorm();
		}
		else if (bqDotProduct < 0)
		{
			return bq.getNorm();
		}
		else
		{
			final Line line = new Line(new Vector2D(a), new Vector2D(b), 1.0e-10);
			return Math.abs(line.getOffset(new Vector2D(q)));
		}
	}

} public class MarkerPost {

	private String id;
	private RailwayLine railwayLine;
	private String railwayLineId;
	private String railwayLineGeographicalName;
	private String railwayLineCode;
	private Double location;
	private List<Double> coordinates;

	public MarkerPost(String id, String railwayLineId, Double location,
			List<Double> coordinates) {
		this.id = id;
		this.railwayLineId = railwayLineId;
		this.location = location;
		this.coordinates = coordinates;
	}

	public String getId() {
		return id;
	}

	public String getRailwayLineId() {
		return railwayLineId;
	}

	public RailwayLine getRailwayLine() {
		return railwayLine;
	}

	public void setRailwayLine(RailwayLine railwayLine) {
		this.railwayLine = railwayLine;
	}

	public List<Double> getCoordinates() {
		return coordinates;
	}

	public Double getLocation() {
		return location;
	}

	public String getRailwayLineCode() {
		return railwayLineCode;
	}

	public void setRailwayLineCode(String railwayLineCode) {
		this.railwayLineCode = railwayLineCode;
	}

	public String getRailwayLineGeographicalName() {
		return railwayLineGeographicalName;
	}

	public void setRailwayLineGeographicalName(
			String railwayLineGeographicalName) {
		this.railwayLineGeographicalName = railwayLineGeographicalName;
	}
} public class RailwayLine implements Item {

	private String id;
	private String geographicalName;
	private String railwayLineCode;
	private List<RailwayLink> railwayLinks;
	private List<String> railwayLinkIds;

	public RailwayLine(String id, String geographicalName, String code,
			List<String> linkIds) {
		this.id = id;
		this.geographicalName = geographicalName;
		this.railwayLinkIds = linkIds;
		this.railwayLineCode = code;
	}

	public String getId() {
		return id;
	}

	public String getGeographicalName() {
		return geographicalName;
	}

	public List<RailwayLink> getRailwayLinks() {
		return railwayLinks;
	}

	public void setRailwayLinks(List<RailwayLink> links) {
		this.railwayLinks = links;
	}

	public List<String> getRailwayLinkIds() {
		return railwayLinkIds;
	}

	public String getRailwayLineCode() {
		return railwayLineCode;
	}
} public class RailwayLink implements Item {

	private String id;
	private String startNodeId;
	private RailwayNode startNode;
	private String endNodeId;
	private RailwayNode endNode;
	private List<Double> coordinates;
	private RailwayLine railwayLine;
	private String railwayLineId;
	private String railwayLineCode;
	private String railwayLineGeographicalName;
	private String railwayLinkSequenceId;
	private RailwayLinkSequence railwayLinkSequence;

	public RailwayLink(String id, String startNodeId, String endNodeId,
			List<Double> coordinates) {
		this.id = id;
		this.startNodeId = startNodeId;
		this.endNodeId = endNodeId;
		this.coordinates = coordinates;
	}

	public String getId() {
		return this.id;
	}

	public String getStartNodeId() {
		return startNodeId;
	}
	
	public void setStartNodeId(String startNodeId) {
		this.startNodeId = startNodeId;
	}

	public String getEndNodeId() {
		return this.endNodeId;
	}
	
	public void setEndNodeId(String endNodeId) {
		this.endNodeId = endNodeId;
	}

	public RailwayNode getStartNode() {
		return startNode;
	}

	public void setStartNode(RailwayNode startNode) {
		this.startNode = startNode;
	}

	public RailwayNode getEndNode() {
		return endNode;
	}

	public void setEndNode(RailwayNode endNode) {
		this.endNode = endNode;
	}

	public List<Double> getCoordinates() {
		return coordinates;
	}

	public RailwayLine getRailwayLine() {
		return railwayLine;
	}

	public void setRailwayLine(RailwayLine railwayLine) {
		this.railwayLine = railwayLine;
	}

	public String getRailwayLineId() {
		return railwayLineId;
	}

	public void setRailwayLineId(String railwayLineId) {
		this.railwayLineId = railwayLineId;
	}

	public String getRailwayLineCode() {
		return railwayLineCode;
	}

	public void setRailwayLineCode(String railwayLineCode) {
		this.railwayLineCode = railwayLineCode;
	}

	public String getRailwayLineGeographicalName() {
		return railwayLineGeographicalName;
	}

	public void setRailwayLineGeographicalName(
			String railwayLineGeographicalName) {
		this.railwayLineGeographicalName = railwayLineGeographicalName;
	}

	public RailwayLinkSequence getRailwayLinkSequence() {
		return railwayLinkSequence;
	}

	public void setRailwayLinkSequence(RailwayLinkSequence railwayLinkSequence) {
		this.railwayLinkSequence = railwayLinkSequence;
	}

	public String getRailwayLinkSequenceId() {
		return railwayLinkSequenceId;
	}

	public void setRailwayLinkSequenceId(String railwayLinkSequenceId) {
		this.railwayLinkSequenceId = railwayLinkSequenceId;
	}
} public class RailwayLinkSequence {

	private String id;
	private List<RailwayLink> railwayLinks;
	private List<String> railwayLinkIds;
	private RailwayLine railwayLine;
	private String railwayLineId;
	private String railwayLineGeographicalName;
	private String railwayLineCode;

	public RailwayLinkSequence(String id, List<String> railwayLinkIds) {
		this.id = id;
		this.railwayLinkIds = railwayLinkIds;
	}

	public String getId() {
		return id;
	}

	public List<String> getRailwayLinkIds() {
		return railwayLinkIds;
	}

	public List<RailwayLink> getRailwayLinks() {
		return railwayLinks;
	}

	public void setRailwayLinks(List<RailwayLink> railwayLinks) {
		this.railwayLinks = railwayLinks;
	}

	public RailwayLine getRailwayLine() {
		return railwayLine;
	}

	public void setRailwayLine(RailwayLine railwayLine) {
		Validate.notNull(railwayLine);
		this.railwayLine = railwayLine;
		this.railwayLineId = railwayLine.getId();
		this.railwayLineGeographicalName = railwayLine.getGeographicalName();
		this.railwayLineCode = railwayLine.getRailwayLineCode();
	}

	public String getRailwayLineId() {
		return railwayLineId;
	}

	public String getRailwayLineGeographicalName() {
		return railwayLineGeographicalName;
	}

	public String getRailwayLineCode() {
		return railwayLineCode;
	}

} public class RailwayNode implements Item {

	private String id;
	private String geographicalName;
	private String formOfNode;
	private List<RailwayLink> spokeStarts;
	private List<String> spokeStartIds;
	private List<RailwayLink> spokeEnds;
	private List<String> spokeEndIds;
	private List<Double> coordinates;

	public RailwayNode(String id, String geographicalName, String formOfNode,
			List<String> spokeStartIds, List<String> spokeEndIds,
			List<Double> coordinates) {
		this.id = id;
		this.geographicalName = geographicalName;
		this.formOfNode = formOfNode;
		this.spokeStartIds = spokeStartIds;
		this.spokeEndIds = spokeEndIds;
		this.coordinates = coordinates;
	}

	public String getId() {
		return id;
	}

	public List<String> getSpokeStartIds() {
		return spokeStartIds;
	}

	public List<String> getSpokeEndIds() {
		return spokeEndIds;
	}

	public List<RailwayLink> getSpokeStarts() {
		return spokeStarts;
	}

	public void setSpokeStarts(List<RailwayLink> spokeStarts) {
		this.spokeStarts = spokeStarts;
	}

	public List<RailwayLink> getSpokeEnds() {
		return spokeEnds;
	}

	public void setSpokeEnds(List<RailwayLink> spokeEnds) {
		this.spokeEnds = spokeEnds;
	}

	public String getFormOfNode() {
		return formOfNode;
	}

	public String getGeographicalName() {
		return geographicalName;
	}

	public List<Double> getCoordinates() {
		return coordinates;
	}
} public class RailwayStationCode implements Item {

	private String id;
	private RailwayStationNode railwayStationNode;
	private String railwayStationNodeId;
	private String stationCode;

	public RailwayStationCode(String id, String railwayStationNodeId,
			String stationCode) {
		this.id = id;
		this.railwayStationNodeId = railwayStationNodeId;
		this.stationCode = stationCode;
	}

	public String getId() {
		return id;
	}

	public String getRailwayStationNodeId() {
		return railwayStationNodeId;
	}

	public String getStationCode() {
		return stationCode;
	}

	public RailwayStationNode getRailwayStationNode() {
		return railwayStationNode;
	}

	public void setRailwayStationNode(RailwayStationNode railwayStationNode) {
		this.railwayStationNode = railwayStationNode;
	}

} public class RailwayStationNode extends RailwayNode {
	
	public RailwayStationNode(String id, String geographicalName, String formOfNode, List<String> spokeStartIds,
			List<String> spokeEndIds, List<Double> coordinates) {
		super(id, geographicalName, formOfNode, spokeStartIds, spokeEndIds, coordinates);
	}

	private RailwayStationCode railwayStationCode;

	public RailwayStationCode getRailwayStationCode() {
		return railwayStationCode;
	}

	public void setRailwayStationCode(RailwayStationCode railwayStationCode) {
		this.railwayStationCode = railwayStationCode;
	}
} public class Ensure {

	private Ensure() {
	}

	public static final <T> T propertyHasSingleItem(
			Iterable<? extends T> value, Object parent, String propertyName) {
		Validate.notNull(propertyName);
		if (value == null) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be equal have a single item, but it is null. Parent is [{0}].",
									parent, propertyName));
		} else {
			final Iterator<? extends T> iterator = value.iterator();
			if (!iterator.hasNext()) {
				throw new IllegalArgumentException(
						MessageFormat
								.format("Property [{1}] is expected to be equal have a single item, but it is empty. Parent is [{0}].",
										parent, propertyName));
			} else {
				final T result = iterator.next();
				if (iterator.hasNext()) {
					throw new IllegalArgumentException(
							MessageFormat
									.format("Property [{1}] is expected to be equal have a single item, but it has more: [{2}]. Parent is [{0}].",
											parent, propertyName, value));
				} else {
					return result;
				}
			}
		}
	}

	public static final void propertyStartsWith(String value, Object parent,
			String propertyName, String prefix) {
		Validate.notNull(propertyName);
		Validate.notNull(prefix);
		if (value == null) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be start with [{2}] but the value is null. Parent is [{0}].",
									parent, propertyName, prefix));
		} else if (!value.startsWith(prefix)) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be start with [{2}] but it does not: [{3}]. Parent is [{0}].",
									parent, propertyName, prefix, value));
		}
	}

	public static final void propertyEquals(Object value, Object parent,
			String propertyName, Object expectedValue) {
		Validate.notNull(propertyName);
		if (expectedValue == null ? value != null : !expectedValue
				.equals(value)) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be equal to [{2}] but the value is [{3}]. Parent is [{0}].",
									parent, propertyName, expectedValue, value));
		}
	}

	public static final void propertyIsNotNull(Object value, Object parent,
			String propertyName) {
		Validate.notNull(propertyName);
		if (value == null) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be not null, but it is. Parent is [{0}].",
									parent, propertyName, value));
		}
	}

	public static final void propertyIsNull(Object value, Object parent,
			String propertyName) {
		Validate.notNull(propertyName);
		if (value != null) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be null, but it is not: [{2}]. Parent is [{0}].",
									parent, propertyName, value));
		}
	}

	public static final void propertyIsEmpty(Iterable<?> value, Object parent,
			String propertyName) {
		Validate.notNull(propertyName);
		if (value != null && value.iterator().hasNext()) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be empty but it is not: [{2}]. Parent is [{0}].",
									parent, propertyName, value));
		}
	}

	public static final void propertyIsNotEmpty(Iterable<?> value,
			Object parent, String propertyName) {
		Validate.notNull(propertyName);
		if (value == null) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be empty but it is null. Parent is [{0}].",
									parent, propertyName, value));
		} else if (!value.iterator().hasNext()) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be empty but it is. Parent is [{0}].",
									parent, propertyName, value));
		}

	}

	public static final void propertyIsNil(JAXBElement<?> value, Object parent,
			String propertyName) {
		Validate.notNull(propertyName);
		if (value != null && !value.isNil()) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be nil but it is not. Parent is [{0}].",
									parent, propertyName));
		}
	}

	public static final <T> void propertyHasNumberOfItems(
			Collection<? extends T> value, Object parent, String propertyName,
			int number) {
		Validate.notNull(propertyName);
		if (value == null) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be equal have [{2}] items, but it is null. Parent is [{0}].",
									parent, propertyName, number));
		} else {
			if (value.isEmpty()) {
				throw new IllegalArgumentException(
						MessageFormat
								.format("Property [{1}] is expected to be equal have [{2}] items, but it is empty. Parent is [{0}].",
										parent, propertyName, number));
			} else {
				if (number != value.size()) {
					throw new IllegalArgumentException(
							MessageFormat
									.format("Property [{1}] is expected to be equal [{2}] items, but it has [{3}]. Parent is [{0}].",
											parent, propertyName, number,
											value.size()));
				}
			}
		}
	}

	public static final <T> void propertyHasMultipleNumberOfItems(
			Collection<? extends T> value, Object parent, String propertyName,
			int number) {
		Validate.notNull(propertyName);
		if (value == null) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be equal have [{2}n] items, but it is null. Parent is [{0}].",
									parent, propertyName, number));
		} else {
			if (value.isEmpty()) {
				throw new IllegalArgumentException(
						MessageFormat
								.format("Property [{1}] is expected to be equal have [{2}n] items, but it is empty. Parent is [{0}].",
										parent, propertyName, number));
			} else {
				if ((value.size() % number) != 0) {
					throw new IllegalArgumentException(
							MessageFormat
									.format("Property [{1}] is expected to be equal [{2}n] items, but it has [{3}]. Parent is [{0}].",
											parent, propertyName, number,
											value.size()));
				}
			}
		}
	}

	public static <T> void propertyHasNoNulls(Iterable<? extends T> value,
			Object parent, String propertyName) {
		Validate.notNull(propertyName);
		if (value == null) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to have no null items but it is null. Parent is [{0}].",
									parent, propertyName));
		} else {
			int position = 0;
			for (T item : value) {
				if (item == null) {
					throw new IllegalArgumentException(
							MessageFormat
									.format("Property [{1}] is expected to have no null items but it has null at position [{2}]. Parent is [{0}].",
											parent, propertyName, position));
				}
				position++;
			}
		}
	}

	public static final <T> T propertyIsInstanceOf(Object value, Object parent,
			String propertyName, Class<T> theClass) {
		Validate.notNull(propertyName);
		if (value == null) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be an instance of [{2}], but it is null. Parent is [{0}].",
									parent, propertyName, theClass));
		} else if (!theClass.isInstance(value)) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be an instance of [{2}], but it is not: [{3}]. Parent is [{0}].",
									parent, propertyName, theClass, value));

		} else {
			@SuppressWarnings("unchecked")
			final T result = (T) value;
			return result;
		}
	}

	public static void propertyIsFiniteNumber(double value, Object parent,
			String propertyName) {
		if (Double.isNaN(value)) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be a number, but it is not a number: [{2}]. Parent is [{0}].",
									parent, propertyName, value));
		} else if (Double.isInfinite(value)) {
			throw new IllegalArgumentException(
					MessageFormat
							.format("Property [{1}] is expected to be a number, but it is infinite: [{2}]. Parent is [{0}].",
									parent, propertyName, value));
		}
	}

	public static <K, V> V mapContainsKey(Map<K, V> map, K key, String mapName) {
		Validate.notNull(map);
		Validate.notNull(mapName);
		if (key == null) {
			return null;
		} else {
			final V value = map.get(key);
			if (value == null) {
				throw new IllegalArgumentException(
						MessageFormat
								.format("The map [{0}] must contain values for the key [{1}] but it does not.",
										mapName, key));
			} else {
				return value;
			}
		}
	}
}
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.Objects;
import java.util.TreeMap;
import org.apache.commons.lang3.Validate;
import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
import org.hisrc.tenra.converter.commontransportelements._3.MarkerPostTypeConverter;
import org.hisrc.tenra.converter.railwaytransportnetwork._3.RailwayLineTypeConverter;
import org.hisrc.tenra.converter.railwaytransportnetwork._3.RailwayLinkSequenceTypeConverter;
import org.hisrc.tenra.converter.railwaytransportnetwork._3.RailwayLinkTypeConverter;
import org.hisrc.tenra.converter.railwaytransportnetwork._3.RailwayNodeTypeConverter;
import org.hisrc.tenra.converter.railwaytransportnetwork._3.RailwayStationCodeTypeConverter;
import org.hisrc.tenra.converter.railwaytransportnetwork._3.RailwayStationNodeTypeConverter;
import org.hisrc.tenra.geometry.euclidean.DistanceCalculator;
import org.hisrc.tenra.model.MarkerPost;
import org.hisrc.tenra.model.RailwayLine;
import org.hisrc.tenra.model.RailwayLink;
import org.hisrc.tenra.model.RailwayLinkSequence;
import org.hisrc.tenra.model.RailwayNode;
import org.hisrc.tenra.model.RailwayStationCode;
import org.hisrc.tenra.model.RailwayStationNode;
import org.hisrc.tenra.util.Ensure;
import inspire.x.specification.gmlas.commontransportelements._3.ConditionOfFacilityType;
import inspire.x.specification.gmlas.commontransportelements._3.MaintenanceAuthorityType;
import inspire.x.specification.gmlas.commontransportelements._3.MarkerPostType;
import inspire.x.specification.gmlas.commontransportelements._3.OwnerAuthorityType;
import inspire.x.specification.gmlas.commontransportelements._3.TrafficFlowDirectionType;
import inspire.x.specification.gmlas.commontransportelements._3.VerticalPositionType;
import inspire.x.specification.gmlas.network._3.NetworkType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.DesignSpeedType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.NominalTrackGaugeType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.NumberOfTracksType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.RailwayElectrificationType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.RailwayLineType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.RailwayLinkSequenceType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.RailwayLinkType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.RailwayNodeType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.RailwayStationCodeType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.RailwayStationNodeType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.RailwayTypeType;
import inspire.x.specification.gmlas.railwaytransportnetwork._3.RailwayUseType;
package org.hisrc.tenra.builder;




public class ModelBuilder {

	public void add(Object value) {
		if (value instanceof RailwayLinkType) {
			addRailwayLink((RailwayLinkType) value);
		} else if (value instanceof RailwayLinkSequenceType) {
			addRailwayLinkSequence((RailwayLinkSequenceType) value);
		} else if (value instanceof RailwayStationCodeType) {
			addRailwayStationCode((RailwayStationCodeType) value);
		} else if (value instanceof RailwayElectrificationType) {
			addRailwayElectrification((RailwayElectrificationType) value);
		} else if (value instanceof RailwayLineType) {
			addRailwayLine((RailwayLineType) value);
		} else if (value instanceof DesignSpeedType) {
			addDesignSpeed((DesignSpeedType) value);
		} else if (value instanceof OwnerAuthorityType) {
			addOwnerAuthority((OwnerAuthorityType) value);
		} else if (value instanceof NominalTrackGaugeType) {
			addNominalTrackGauge((NominalTrackGaugeType) value);
		} else if (value instanceof TrafficFlowDirectionType) {
			addTrafficFlowDirection((TrafficFlowDirectionType) value);
		} else if (value instanceof RailwayStationNodeType) {
			addRailwayStationNode((RailwayStationNodeType) value);
		} else if (value instanceof NetworkType) {
			addNetwork((NetworkType) value);
		} else if (value instanceof RailwayTypeType) {
			addRailwayType((RailwayTypeType) value);
		} else if (value instanceof ConditionOfFacilityType) {
			addConditionOfFacility((ConditionOfFacilityType) value);
		} else if (value instanceof NumberOfTracksType) {
			addNumberOfTracks((NumberOfTracksType) value);
		} else if (value instanceof RailwayUseType) {
			addRailwayUse((RailwayUseType) value);
		} else if (value instanceof MarkerPostType) {
			addMarkerPost((MarkerPostType) value);
		} else if (value instanceof RailwayNodeType) {
			addRailwayNode((RailwayNodeType) value);
		} else if (value instanceof MaintenanceAuthorityType) {
			addMaintenanceAuthority((MaintenanceAuthorityType) value);
		} else if (value instanceof VerticalPositionType) {
			addVerticalPosition((VerticalPositionType) value);
		} else {
			throw new IllegalArgumentException(
					MessageFormat.format("Unsupported class [{0}], value [{1}].", value.getClass(), value));
		}
	}

	private void addNetwork(NetworkType value) {
	}

	private void addOwnerAuthority(OwnerAuthorityType value) {
	}

	private void addMaintenanceAuthority(MaintenanceAuthorityType value) {
	}

	private final Map<String, RailwayNode> railwayNodes = new HashMap<String, RailwayNode>();
	private final Map<String, RailwayNode> railwayAndStationNodes = new HashMap<String, RailwayNode>();
	private final Map<String, String> railwayLinkStartingRailwayNodeIds = new HashMap<String, String>();
	private final Map<String, String> railwayLinkEndingRailwayNodeIds = new HashMap<String, String>();

	private void addRailwayNode(RailwayNodeType value) {
		final RailwayNode railwayNode = RailwayNodeTypeConverter.INSTANCE.convert(value);
		railwayNodes.put(railwayNode.getId(), railwayNode);
		addRailwayOrStationNode(railwayNode);
	}

	private void addRailwayOrStationNode(final RailwayNode railwayNode) {
		final String railwayNodeId = railwayNode.getId();
		railwayAndStationNodes.put(railwayNodeId, railwayNode);
		for (String spokeStartId : railwayNode.getSpokeStartIds()) {
			Validate.notNull(spokeStartId);
			String existingRailwayLinkStartingRailwayNodeId = railwayLinkStartingRailwayNodeIds.get(spokeStartId);
			if (existingRailwayLinkStartingRailwayNodeId != null
					&& !Objects.equals(existingRailwayLinkStartingRailwayNodeId, railwayNodeId)) {
				System.err.println(MessageFormat.format(
						"Another starting railway node {0} found for the railway link {1}, the other railway node is {2}.",
						railwayNodeId, spokeStartId, existingRailwayLinkStartingRailwayNodeId));
			}
			railwayLinkStartingRailwayNodeIds.put(spokeStartId, railwayNodeId);
		}
		for (String spokeEndId : railwayNode.getSpokeEndIds()) {
			Validate.notNull(spokeEndId);
			String existingRailwayLinkEndingRailwayNodeId = railwayLinkEndingRailwayNodeIds.get(spokeEndId);
			if (existingRailwayLinkEndingRailwayNodeId != null
					&& !Objects.equals(existingRailwayLinkEndingRailwayNodeId, railwayNodeId)) {
				System.err.println(MessageFormat.format(
						"Another ending railway node {0} found for the railway link {1}, the other railway node is {2}.",
						railwayNodeId, spokeEndId, existingRailwayLinkEndingRailwayNodeId));
			}
			railwayLinkEndingRailwayNodeIds.put(spokeEndId, railwayNodeId);
		}
	}

	private final Map<String, RailwayLink> railwayLinks = new HashMap<String, RailwayLink>();

	private void addRailwayLink(RailwayLinkType value) {
		final RailwayLink railwayLink = RailwayLinkTypeConverter.INSTANCE.convert(value);
		railwayLinks.put(railwayLink.getId(), railwayLink);
	}

	private Map<String, RailwayStationNode> railwayStationNodes = new HashMap<>();

	private void addRailwayStationNode(RailwayStationNodeType value) {
		final RailwayStationNode railwayStationNode = RailwayStationNodeTypeConverter.INSTANCE.convert(value);
		final String railwayStationNodeId = railwayStationNode.getId();
		railwayStationNodes.put(railwayStationNodeId, railwayStationNode);
		addRailwayOrStationNode(railwayStationNode);
	}

	private Map<String, RailwayStationCode> railwayStationCodes = new HashMap<>();

	private void addRailwayStationCode(RailwayStationCodeType value) {
		final RailwayStationCode railwayStationCode = RailwayStationCodeTypeConverter.INSTANCE.convert(value);
		railwayStationCodes.put(railwayStationCode.getId(), railwayStationCode);
	}

	private Map<String, RailwayLine> railwayLines = new HashMap<>();

	private void addRailwayLine(RailwayLineType value) {
		final RailwayLine railwayLine = RailwayLineTypeConverter.INSTANCE.convert(value);
		railwayLines.put(railwayLine.getId(), railwayLine);
	}

	private Map<String, MarkerPost> markerPosts = new HashMap<>();

	private void addMarkerPost(MarkerPostType value) {
		final MarkerPost markerPost = MarkerPostTypeConverter.INSTANCE.convert(value);
		// TODO
		if (markerPost.getRailwayLineId() != null) {
			markerPosts.put(markerPost.getId(), markerPost);
		}
	}

	private Map<String, RailwayLinkSequence> railwayLinkSequences = new HashMap<>();

	private void addRailwayLinkSequence(RailwayLinkSequenceType value) {
		final RailwayLinkSequence railwayLinkSequence = RailwayLinkSequenceTypeConverter.INSTANCE.convert(value);