public class LinkType extends HierarchicalType<LinkType> implements Serializable, Identifiable, Compatibility<GTUType,LinkType>
Copyright (c) 2013-2019 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2015-08-30 00:16:51 +0200 (Sun, 30 Aug 2015) $, @version $Revision: 1329 $, by $Author: averbraeck $,
initial version Aug 21, 2014
Modifier and Type | Class and Description |
---|---|
static class |
LinkType.DEFAULTS
Default types with their name.
|
Constructor and Description |
---|
LinkType(String id,
LinkType parent,
GTUCompatibility<LinkType> compatibility,
Network network)
Create a new Link type with compatibility set.
|
Modifier and Type | Method and Description |
---|---|
GTUCompatibility<LinkType> |
getCompatibility() |
LongitudinalDirectionality |
getDirectionality(GTUType gtuType,
boolean tryParentsOfGTUType)
Retrieve the allowed driving directions for a GTUType.
|
Network |
getNetwork() |
Boolean |
isCompatible(GTUType gtuType,
GTUDirectionality directionality)
Test if a GTUType can travel over the infrastructure.
|
boolean |
isConnector() |
boolean |
isNone() |
boolean |
isOfType(LinkType.DEFAULTS type)
Whether this, or any of the parent types, equals the given type.
|
boolean |
isRailWay() |
boolean |
isRoad() |
boolean |
isWaterWay() |
LinkType |
reverse()
Returns a link type with directionality reversed.
|
String |
toString() |
commonAncestor, equals, getId, getParent, hashCode, isOfType
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getId
public LinkType(String id, LinkType parent, GTUCompatibility<LinkType> compatibility, Network network)
id
- String; the id of the lane type (may not be null)parent
- LinkType; the parent type (may be null)compatibility
- the collection of compatible GTUTypes for this LinkType; can be null (resulting in a LinkType that
is inaccessible to all GTU types). This constructor makes a deep copy of the compatibility
.network
- Network; The network to which the LinkType belongspublic boolean isOfType(LinkType.DEFAULTS type)
type
- DEFAULTS; typepublic Boolean isCompatible(GTUType gtuType, GTUDirectionality directionality)
isCompatible
in interface Compatibility<GTUType,LinkType>
gtuType
- G; the type of the GTUdirectionality
- GTUDirectionality; the direction of the GTU with respect to the design direction of the
infrastructureisCompatible
on a higher level in the infrastructure hierarchypublic GTUCompatibility<LinkType> getCompatibility()
public final LinkType reverse()
public final boolean isNone()
NONE
public final boolean isRoad()
ROAD
public final boolean isWaterWay()
WATER_WAY
public final boolean isRailWay()
RAIL_WAY
public final boolean isConnector()
CONNECTOR
public Network getNetwork()
public final LongitudinalDirectionality getDirectionality(GTUType gtuType, boolean tryParentsOfGTUType)
tryParentsOfGTUType
. tryParentsOfGTUType
is false, the value null is returned. If true; the parent of the GTUType is used and
the search is repeated, etc. If none of the parents of the GTUType yields a result, this method returns
LongitudinalDirectionality.DIR_NONE
.getDirectionality
in interface Compatibility<GTUType,LinkType>
gtuType
- G; type of the GTUtryParentsOfGTUType
- boolean; if true; the parents of the GTUType are tried if no match was found for the given
GTUTypeLongitudinalDirectionality.DIR_NONE
if neither the GTUType or any of its parents specifies a
directionalityCopyright © 2014–2019 Delft University of Technology. All rights reserved.