20 package org.matsim.lanes;
22 import java.util.LinkedList;
23 import java.util.List;
25 import org.apache.logging.log4j.LogManager;
26 import org.apache.logging.log4j.Logger;
45 this.lanes = laneDefs;
49 log.info(
"checking consistency...");
50 List<Id<Link>> linksWithMalformedLanes =
new LinkedList<>();
53 linksWithMalformedLanes.add(l2l.getLinkId());
57 if (this.removeMalformed){
58 for (
Id<Link> linkId : linksWithMalformedLanes) {
60 log.info(
"remove lanes on link " + linkId);
63 log.info(
"checked consistency. Lanes on " + linksWithMalformedLanes.size() +
" links have been removed.");
69 log.error(
"No link found for lanesToLinkAssignment on link Id(linkIdRef): " + l2l.
getLinkId());
76 if (link.
getLength() < l.getStartsAtMeterFromLinkEnd()) {
77 log.error(
"Link Id " + link.
getId() +
" is shorter than an assigned lane with id " + l.getId());
85 if (lane.getToLaneIds() != null) {
86 for (
Id<Lane> toLaneId : lane.getToLaneIds()){
87 if (! l2l.
getLanes().containsKey(toLaneId)){
88 log.error(
"Error: toLane not existing:");
89 log.error(
" Lane Id: " + lane.getId() +
" on Link Id: " + l2l.
getLinkId() +
90 " leads to Lane Id: " + toLaneId +
" that is not existing!");
97 else if (lane.getToLinkIds() != null){
98 for (
Id<Link> toLinkId : lane.getToLinkIds()) {
99 if (! this.network.
getLinks().containsKey(toLinkId)){
100 log.error(
"No link found in network for toLinkId " + toLinkId +
" of laneId " + lane.getId() +
" of link id " + l2l.
getLinkId());
106 log.error(
"The given toLink " + toLinkId +
" is not reachable from lane " + lane.getId() +
" on link " + link.
getId());
SortedMap< Id< Link >, LanesToLinkAssignment > getLanesToLinkAssignments()
boolean isLaneOnLinkConsistent(LanesToLinkAssignment l2l)
boolean isRemoveMalformed()
void setRemoveMalformed(boolean removeMalformed)
Map< Id< Link >, ? extends Link > getLinks()
SortedMap< Id< Lane >, Lane > getLanes()
Map< Id< Link >, ? extends Link > getOutLinks()
LanesConsistencyChecker(Network net, Lanes laneDefs)