package org.opentrafficsim.kpi.sampling;
import java.io.Serializable;
import org.djutils.exceptions.Throw;
import org.opentrafficsim.kpi.interfaces.LaneDataInterface;
/**
*
* Copyright (c) 2013-2021 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
* BSD-style license. See OpenTrafficSim License.
*
* $LastChangedDate: 2015-07-24 02:58:59 +0200 (Fri, 24 Jul 2015) $, @version $Revision: 1147 $, by $Author: averbraeck $,
* initial version Mar 30, 2016
* @author Alexander Verbraeck
* @author Peter Knoppers
*/
public class KpiLane implements Serializable
{
/** */
private static final long serialVersionUID = 20160330L;
/** The lane. */
private final LaneDataInterface lane;
/**
* @param lane LaneDataInterface; the lane
*/
public KpiLane(final LaneDataInterface lane)
{
Throw.whenNull(lane, "Lane may not be null.");
this.lane = lane;
}
/**
* @return the lane
*/
public final LaneDataInterface getLaneData()
{
return this.lane;
}
/** {@inheritDoc} */
@Override
public String toString()
{
return "[" + this.lane + "]";
}
/** {@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;
}
KpiLane other = (KpiLane) obj;
if (this.lane == null)
{
if (other.lane != null)
{
return false;
}
}
else if (!this.lane.equals(other.lane))
{
return false;
}
return true;
}
}