org.opentrafficsim.road.network.sampling.LaneDataRoad Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ots-road Show documentation
Show all versions of ots-road Show documentation
OpenTrafficSim road classes
The newest version!
package org.opentrafficsim.road.network.sampling;
import org.djunits.value.vdouble.scalar.Length;
import org.opentrafficsim.kpi.interfaces.LaneData;
import org.opentrafficsim.road.network.lane.Lane;
/**
* Lane representation in road sampler.
*
* Copyright (c) 2013-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License.
*
* @author Alexander Verbraeck
* @author Peter Knoppers
* @author Wouter Schakel
*/
public class LaneDataRoad implements LaneData
{
/** Wrapped lane. */
private final Lane lane;
/**
* @param lane Lane; wrapped lane
*/
public LaneDataRoad(final Lane lane)
{
this.lane = lane;
}
/**
* @return lane.
*/
public final Lane getLane()
{
return this.lane;
}
/** {@inheritDoc} */
@Override
public final Length getLength()
{
return this.lane.getLength();
}
/** {@inheritDoc} */
@Override
public final LinkDataRoad getLinkData()
{
return new LinkDataRoad(this.lane.getLink());
}
/** {@inheritDoc} */
@Override
public final String getId()
{
return this.lane.getId();
}
/** {@inheritDoc} */
@Override
public final int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((this.lane == null) ? 0 : this.lane.hashCode());
return result;
}
/** {@inheritDoc} */
@Override
public final boolean equals(final Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
LaneDataRoad other = (LaneDataRoad) obj;
if (this.lane == null)
{
if (other.lane != null)
{
return false;
}
}
else if (!this.lane.equals(other.lane))
{
return false;
}
return true;
}
/** {@inheritDoc} */
@Override
public final String toString()
{
return "LaneData [lane=" + this.lane + "]";
}
}