Class MultiConstraint<T>
java.lang.Object
org.opentrafficsim.base.parameters.constraint.MultiConstraint<T>
- Type Parameters:
T
- value type
- All Implemented Interfaces:
Constraint<T>
public class MultiConstraint<T> extends java.lang.Object implements Constraint<T>
Constraint containing multiple constraints.
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.
- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 11 sep. 2017
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
Constructor Summary
Constructors Constructor Description MultiConstraint(java.util.Set<Constraint<T>> constraints)
Constructor. -
Method Summary
Modifier and Type Method Description boolean
accept(T value)
Checks whether the value complies with constraints.static <T> MultiConstraint<T>
create(Constraint<T>... constraints)
Creates aMultiConstraint
from given constraints.java.lang.String
failMessage()
Returns a message for value failure, pointing to a parameter using '%s'.java.lang.String
toString()
-
Constructor Details
-
MultiConstraint
Constructor.- Parameters:
constraints
- Set<Constraint<T>>; constraints
-
-
Method Details
-
create
Creates aMultiConstraint
from given constraints.- Type Parameters:
T
- value type- Parameters:
constraints
- Constraint<T>...; constraints- Returns:
MultiConstraint
-
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
public java.lang.String 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'.
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-