public class Set extends Object implements Serializable, IStochasticOccurrence
SetType
,
which defines for which ParameterInstance
objects this set may define
eligible ParameterAssignment
objects. A set has a certain probability
of occurrence and will be randomly chosen from a list with all sets
associated with the same SetType
. If it is chosen, for each
ParameterInstance
that is defined by its SetType
one
ParameterAssignment
from this Set
will be chosen randomly
(so, there are two levels of random choosing, one in the SetType
, one
in the Set
). The eligible ParameterAssignment
objects are
stored in a Map
, there is a List
for each
ParameterInstance
.
See documentation of SetType
for more information.
Created on August 7, 2006Constructor and Description |
---|
Set()
Constructor for bean compatibility.
|
Set(List<ParameterInstance> definedParameters,
String setName,
String desc,
double prob)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addParameterAssignment(ParameterAssignment paramAssign)
Adds a new parameter assignment.
|
void |
addParameterInstance(ParameterInstance parameterInstance)
Adds a parameter instance to the set.
|
String |
getDescription() |
int |
getID() |
String |
getName() |
int |
getNumberOfAssignments(ParameterInstance instance)
Retrieve the number of eligible
ParameterAssignment objects for a
given ParameterInstance . |
ParameterAssignmentSet |
getParameterAssignments(ParameterInstance paramInstance)
Get eligible
ParameterAssignment objects for given
ParameterInstance . |
double |
getProbability()
Get the probability that this entity will be chosen.
|
Map<ParameterInstance,ParameterAssignmentSet> |
getSetData() |
boolean |
isValid()
Checks whether this set contains at least one assignment for every
parameter instance.
|
void |
removeParameterAssignment(ParameterAssignment paramAssign)
Removes a parameter assignment.
|
ParameterAssignmentSet |
removeParameterInstance(ParameterInstance parameterInstance)
Removes a parameter instance from the set.
|
void |
setDescription(String description) |
void |
setID(int uniqueID) |
void |
setName(String name) |
void |
setProbability(double probability)
Set probability for being chosen.
|
protected void |
setProblemOccurred(ParameterAssignment assignment)
Throws a
RuntimeException reporting on problems while processing a
ParameterAssignment . |
void |
setSetData(Map<ParameterInstance,ParameterAssignmentSet> setData) |
String |
toString() |
public Set(List<ParameterInstance> definedParameters, String setName, String desc, double prob)
definedParameters
- set of parameter instances for which this set may define
assignmentssetName
- name of the setdesc
- description of the setprob
- probability of the setpublic Set()
public ParameterAssignmentSet getParameterAssignments(ParameterInstance paramInstance)
ParameterAssignment
objects for given
ParameterInstance
.paramInstance
- the parameter instancepublic final void addParameterInstance(ParameterInstance parameterInstance)
ParameterAssignment
objects to setData
. This is a
management method for the associated SetType
.parameterInstance
- the parameter instance to be addedpublic ParameterAssignmentSet removeParameterInstance(ParameterInstance parameterInstance)
ParameterAssignment
objects will be removed from
setData
. This is a management method for the associated
SetType
.parameterInstance
- the parameter instance to be removedpublic void addParameterAssignment(ParameterAssignment paramAssign)
paramAssign
- parameter assignment to be addedpublic void removeParameterAssignment(ParameterAssignment paramAssign)
paramAssign
- parameter assignment to be removedprotected void setProblemOccurred(ParameterAssignment assignment)
RuntimeException
reporting on problems while processing a
ParameterAssignment
. This method is called when the
ParameterInstance
associated with the ParameterAssignment
is not managed by the SetType
of this set.assignment
- the parameter assignment to be processedpublic int getNumberOfAssignments(ParameterInstance instance)
ParameterAssignment
objects for a
given ParameterInstance
.instance
- the parameter instancepublic boolean isValid()
public void setProbability(double probability)
IStochasticOccurrence
setProbability
in interface IStochasticOccurrence
probability
- the probability (in [0,1])public Map<ParameterInstance,ParameterAssignmentSet> getSetData()
public void setSetData(Map<ParameterInstance,ParameterAssignmentSet> setData)
public String getDescription()
public void setDescription(String description)
public String getName()
public void setName(String name)
public double getProbability()
IStochasticOccurrence
getProbability
in interface IStochasticOccurrence
public int getID()
public void setID(int uniqueID)
Copyright © 2013. All Rights Reserved.