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 Object implements Constraint<T>
Constraint containing multiple constraints.

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
  • Constructor Details

    • MultiConstraint

      public MultiConstraint(Set<Constraint<? super T>> constraints)
      Constructor.
      Parameters:
      constraints - Set<Constraint<? super T>>; constraints
  • Method Details

    • create

      @SafeVarargs public static final <T> MultiConstraint<T> create(Constraint<? super T>... constraints)
      Creates a MultiConstraint from given constraints.
      Type Parameters:
      T - value type
      Parameters:
      constraints - Constraint<? super T>...; constraints
      Returns:
      MultiConstraint
    • accept

      public boolean accept(T value)
      Checks whether the value complies with constraints.
      Specified by:
      accept in interface Constraint<T>
      Parameters:
      value - T; Value to check.
      Returns:
      Whether the value complies with constraints.
    • failMessage

      public String failMessage()
      Returns a message for value failure, pointing to a parameter using '%s'.
      Specified by:
      failMessage in interface Constraint<T>
      Returns:
      Message for value failure, pointing to a parameter using '%s'.
    • toString

      public String toString()
      Overrides:
      toString in class Object