ParameterTypeInteger.java
package org.opentrafficsim.base.parameters;
import org.opentrafficsim.base.parameters.constraint.Constraint;
/**
* Wrapper class for int parameters.
* <p>
* Copyright (c) 2013-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
* BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
* </p>
* @author Alexander Verbraeck
* @author Wouter Schakel
*/
public class ParameterTypeInteger extends ParameterTypeNumeric<Integer>
{
/**
* Construct a new ParameterTypeInteger with default value, without check.
* @param id short name of the new ParameterTypeInteger
* @param description parameter description or full name of the new ParameterTypeInteger
* @param defaultValue the default value of the new ParameterTypeInteger
*/
public ParameterTypeInteger(final String id, final String description, final int defaultValue)
{
super(id, description, Integer.class, defaultValue);
}
/**
* Construct a new ParameterTypeInteger with default value and check.
* @param id short name of the new ParameterTypeInteger
* @param description parameter description or full name of the new ParameterTypeInteger
* @param defaultValue the default value of the new ParameterTypeInteger
* @param constraint constraint for parameter values
*/
public ParameterTypeInteger(final String id, final String description, final int defaultValue,
final Constraint<? super Integer> constraint)
{
super(id, description, Integer.class, defaultValue, constraint);
}
/**
* Construct a new ParameterTypeInteger with default value and check.
* @param id short name of the new ParameterTypeInteger
* @param description parameter description or full name of the new ParameterTypeInteger
* @param defaultValue the default value of the new ParameterTypeInteger
* @param constraint constraint for parameter values
*/
public ParameterTypeInteger(final String id, final String description, final Integer defaultValue,
final Constraint<Number> constraint)
{
super(id, description, Integer.class, defaultValue, constraint);
}
@Override
public final String printValue(final Parameters parameters) throws ParameterException
{
return Integer.toString(parameters.getParameter(this));
}
@Override
public String toString()
{
return "ParameterTypeInteger [id=" + getId() + ", description=" + getDescription() + "]";
}
}