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 a MultiConstraint from given constraints.
    java.lang.String failMessage()
    Returns a message for value failure, pointing to a parameter using '%s'.
    java.lang.String toString()

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • MultiConstraint

      public MultiConstraint​(java.util.Set<Constraint<T>> constraints)
      Constructor.
      Parameters:
      constraints - Set<Constraint<T>>; constraints
  • Method Details

    • create

      @SafeVarargs public static final <T> MultiConstraint<T> create​(Constraint<T>... constraints)
      Creates a MultiConstraint from given constraints.
      Type Parameters:
      T - value type
      Parameters:
      constraints - Constraint<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 java.lang.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 java.lang.String toString()
      Overrides:
      toString in class java.lang.Object