public class ProbabilityDistributionProperty extends AbstractProperty<Double[]> implements Serializable
Copyright (c) 2013-2016 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
$LastChangedDate: 2016-05-28 11:33:31 +0200 (Sat, 28 May 2016) $, @version $Revision: 2051 $, by $Author: averbraeck $,
initial version 18 dec. 2014
AbstractProperty.PropertyIterator
Constructor and Description |
---|
ProbabilityDistributionProperty(String key,
String shortName,
String description,
String[] elementNames,
Double[] initialValue,
boolean readOnly,
int displayPriority)
Construct a new ProbabilityDistributionProperty.
|
Modifier and Type | Method and Description |
---|---|
AbstractProperty<Double[]> |
deepCopy()
Construct a deep copy of this property (duplicates everything except immutable fields).
|
(package private) String |
getElementName(int index)
Retrieve the name of one of the values of this ProbabilityDistributionProperty.
|
String[] |
getElementNames()
Return the names of the elements of this ProbabilityDistributionProperty.
|
Double[] |
getValue()
Retrieve the current value of the property.
|
(package private) Double |
getValue(int index)
Retrieve one probability value.
|
String |
htmlStateDescription()
Generate a description of the state of this property in HTML (excluding the <html> at the start and the
</html> at the end.
|
void |
setValue(Double[] newValue)
Change the value of the property.
|
findByKey, getDescription, getDisplayPriority, getKey, getParent, getShortName, isReadOnly, iterator, setParent, setReadOnly, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public ProbabilityDistributionProperty(String key, String shortName, String description, String[] elementNames, Double[] initialValue, boolean readOnly, int displayPriority) throws PropertyException
key
- String; the unique key of the new propertyshortName
- String; the short name of the new ProbabilityDistributionPropertydescription
- String; the description of the new ProbabilityDistributionProperty (may use HTML markup)elementNames
- String[]; names of the elements that, together, add up to probability 1.0initialValue
- Double[]; array of Double valuesreadOnly
- boolean; if true this ProbabilityDistributionProperty can not be altereddisplayPriority
- int; the display priority of the new ProbabilityDistributionPropertyPropertyException
- when the array is empty, any value is outside the range 0.0 .. 1.0, or when the sum of the
values is not equal to 1.0 within a small error marginpublic final Double[] getValue()
final Double getValue(int index)
index
- int; the index of the requested probability valuefinal String getElementName(int index)
index
- int; the index of the valuepublic final void setValue(Double[] newValue) throws PropertyException
setValue
in interface Property<Double[]>
newValue
- T; the new value for the propertyPropertyException
- when this Property is read-only, or newValue is not validpublic final String[] getElementNames()
public final String htmlStateDescription()
htmlStateDescription
in interface Property<Double[]>
htmlStateDescription
in class AbstractProperty<Double[]>
public final AbstractProperty<Double[]> deepCopy()
Copyright © 2014–2016 Delft University of Technology. All rights reserved.