Class CollectionConstraint<T>
java.lang.Object
org.opentrafficsim.base.parameters.constraint.CollectionConstraint<T>
- Type Parameters:
T
- value type
- All Implemented Interfaces:
Constraint<T>
- Direct Known Subclasses:
ClassConstraint
Constraint that checks whether a value is in a given constraint collection.
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, Peter Knoppers, Wouter Schakel
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Checks whether the value complies with constraints.Returns a message for value failure, pointing to a parameter using '%s'.static <T> CollectionConstraint<T>
newInstance
(T... objs) Creates a new instance with given objects.toString()
-
Field Details
-
objects
Acceptable objects.
-
-
Constructor Details
-
CollectionConstraint
- Parameters:
objects
- Collection<T>; acceptable objects
-
-
Method Details
-
accept
Checks whether the value complies with constraints.- Specified by:
accept
in interfaceConstraint<T>
- Parameters:
value
- T; Value to check.- Returns:
- Whether the value complies with constraints.
-
failMessage
Returns a message for value failure, pointing to a parameter using '%s'.- Specified by:
failMessage
in interfaceConstraint<T>
- Returns:
- Message for value failure, pointing to a parameter using '%s'.
-
newInstance
Creates a new instance with given objects.- Type Parameters:
T
- type- Parameters:
objs
- T...; acceptable objects- Returns:
- new instance with given objects
-
toString
-