T
- type of the ids of the pick itemspublic class PickList<T> extends ParameterType<T>
Copyright (c) 2013-2018 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
defaultValue
Constructor and Description |
---|
PickList(String id,
String description,
List<PickListItem<T>> items)
Construct a new PickList and fill it with the provided items.
|
PickList(String id,
String description,
PickListItem<T> firstItem,
PickListItem<T>... additionalItems)
Construct a new PickList and fill it with the provided items.
|
Modifier and Type | Method and Description |
---|---|
void |
addItem(PickListItem<T> item)
Add one item to this PickList.
|
String |
printValue(Parameters parameters)
Print the given value from the map in Parameters in a presentable format.
|
String |
toString() |
check, checkConstraint, equals, getConstraint, getDefaultValue, getDescription, getId, getValueClass, hasDefaultValue, hashCode
@SafeVarargs public PickList(String id, String description, PickListItem<T> firstItem, PickListItem<T>... additionalItems) throws ParameterException
id
- String; id of the new PickListdescription
- String; description of the new PickListfirstItem
- PickList<T> the first item to add to the new PickListadditionalItems
- PickList<T>...; any additional items to add to the new PickList; the reason for putting the
first item in a separate argument is to ensure that this constructor cannot construct a PickList with zero
itemsParameterException
- when the ids of the items are not all distinctpublic PickList(String id, String description, List<PickListItem<T>> items) throws ParameterException
id
- String; id of the new PickListdescription
- String; description of the new PickListitems
- List<PickListItem>; the items to add to the new PickListParameterException
- when the ids of the items are not all distinctpublic final void addItem(PickListItem<T> item) throws ParameterException
item
- PickListItem<T>; the item to addParameterException
- when the id of the provided item matches an existing itempublic String printValue(Parameters parameters) throws ParameterException
printValue
in class ParameterType<T>
parameters
- Parameters to get the value fromParameterException
- If the parameter is not presentpublic String toString()
toString
in class ParameterType<T>
Copyright © 2014–2018 Delft University of Technology. All rights reserved.