001/* *********************************************************************** * 002 * project: org.matsim.* 003 * Lane 004 * * 005 * *********************************************************************** * 006 * * 007 * copyright : (C) 2014 by the members listed in the COPYING, * 008 * LICENSE and WARRANTY file. * 009 * email : info at matsim dot org * 010 * * 011 * *********************************************************************** * 012 * * 013 * This program is free software; you can redistribute it and/or modify * 014 * it under the terms of the GNU General Public License as published by * 015 * the Free Software Foundation; either version 2 of the License, or * 016 * (at your option) any later version. * 017 * See also COPYING, LICENSE and WARRANTY file * 018 * * 019 * *********************************************************************** */ 020package org.matsim.lanes; 021 022import java.util.ArrayList; 023import java.util.List; 024 025import org.matsim.api.core.v01.Id; 026import org.matsim.api.core.v01.network.Link; 027 028 029/** 030 * Serves as meta structure between the data classes and the mobility simulation. 031 * The lane data classes do not have any lane length specified. To calculate the 032 * lane length the link is required that is not available if data is separated in 033 * different containers. 034 * Further, there is a List of downstream LaneImpl instances. 035 * 036 * @author dgrether 037 */ 038public final class ModelLane { 039 040 private final Lane laneData; 041 private double length; 042 private double endsAtMetersFromLinkEnd; 043 private final List<Id<Link>> destinationLinkIds = new ArrayList<>(); 044 private final List<ModelLane> toLanes = new ArrayList<>(); 045 046 ModelLane(Lane data) { 047 this.laneData = data; 048 } 049 050 public Lane getLaneData(){ 051 return this.laneData; 052 } 053 054 public List<ModelLane> getToLanes(){ 055 return toLanes; 056 } 057 058 void addAToLane(ModelLane toLane) { 059 this.toLanes.add(toLane); 060 } 061 062 void setLength(double lengthMeter) { 063 this.length = lengthMeter; 064 } 065 066 public double getLength() { 067 return this.length; 068 } 069 070 071 double getEndsAtMeterFromLinkEnd(){ 072 return this.endsAtMetersFromLinkEnd; 073 } 074 075 void setEndsAtMetersFromLinkEnd(double endsAtMetersFromLinkEnd) { 076 this.endsAtMetersFromLinkEnd = endsAtMetersFromLinkEnd; 077 } 078 079 void addDestinationLink(Id<Link> toLinkId) { 080 this.destinationLinkIds.add(toLinkId); 081 } 082 083 List<Id<Link>> getDestinationLinkIds() { 084 return this.destinationLinkIds; 085 } 086 087 088 089}