I
- infrastructure type, e.g. LinkType or LaneType, or water way typepublic class GTUCompatibility<I extends HierarchicalType<I> & Compatibility<GTUType,I>> extends Object implements Compatibility<GTUType,I>
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.
Constructor and Description |
---|
GTUCompatibility(GTUCompatibility<I> original)
Construct a new Compatibility and deep copy the allowed and forbidden sets for both directions from an existing
Compatibility.
|
GTUCompatibility(I infrastructure)
Construct a new Compatibility object with empty allowed and forbidden sets for both directions.
|
Modifier and Type | Method and Description |
---|---|
GTUCompatibility<I> |
addAllowedGTUType(GTUType gtuType,
LongitudinalDirectionality directionality)
Add a GTUType to this GTUCompatibility.
|
boolean |
equals(Object obj) |
LongitudinalDirectionality |
getDirectionality(GTUType gtuType,
boolean tryParentsOfGTUType)
Retrieve the allowed driving directions for a GTUType.
|
int |
hashCode() |
Boolean |
isCompatible(GTUType gtuType,
GTUDirectionality directionality)
Determine if this Compatibility allows or denies a particular GTUType.
|
void |
isCompatibleWith(Compatibility<GTUType,?> parentCompatibility,
boolean tryParentsOfGTUType)
Check if a GTUCompatibility does not allow things that the GTUCompatibility of a parent object disallows, e.g.
|
GTUCompatibility<I> |
removeAllowedGTUType(GTUType gtuType,
LongitudinalDirectionality directionality)
Remove a GTUType from the allowed set of this Compatibility.
|
String |
toString() |
public GTUCompatibility(I infrastructure)
infrastructure
- I; the infrastructure type, e.g. LinkType, LaneType, SensorType.public GTUCompatibility(GTUCompatibility<I> original)
original
- GTUCompatibility<I>; the Compatibility from which the allowed and forbidden sets for both
directions will be copiedpublic final Boolean isCompatible(GTUType gtuType, GTUDirectionality directionality)
isCompatible
in interface Compatibility<GTUType,I extends HierarchicalType<I> & Compatibility<GTUType,I>>
gtuType
- GTUType; the GTUType to checkdirectionality
- GTUDirectionality; the GTUDirectionality in which the GTUType wants to movepublic final GTUCompatibility<I> addAllowedGTUType(GTUType gtuType, LongitudinalDirectionality directionality) throws NullPointerException
gtuType
- GTUType; the GTUType to add to the allowed set of this Compatibilitydirectionality
- LongitudinalDirectionality; directionality for which the GTUType must be addedNullPointerException
- when directionality
is nullpublic final GTUCompatibility<I> removeAllowedGTUType(GTUType gtuType, LongitudinalDirectionality directionality)
gtuType
- GTUType; the GTUType to remove from the allowed setdirectionality
- LongitudinalDirectionality; the longitudinal directionality for which the GTUType must be removedpublic final void isCompatibleWith(Compatibility<GTUType,?> parentCompatibility, boolean tryParentsOfGTUType) throws GTUException
parentCompatibility
- Compatibility<GTUType, ?>; the GTUCompatibility of the parent objecttryParentsOfGTUType
- boolean; whether to try parent GTU typesGTUException
- if a conflict is foundpublic 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,I extends HierarchicalType<I> & Compatibility<GTUType,I>>
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.