E
- the element typepublic class EntityDistEmpirical<E extends Entity> extends EntityDist<E>
Distribution
Constructor and Description |
---|
EntityDistEmpirical(Model owner,
java.lang.String name,
boolean showInReport,
boolean showInTrace)
Creates a stream of entities, where an individual probability can be
assigned to each entity.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e,
double probability)
Adds an entity (type E) to the range of this distribution, unless it is
already present.
|
void |
changeProbability(E e,
double newProbability)
Adjusts the relative probability of an entity (type E from the range of
this distribution being sampled.
|
boolean |
contains(E e)
Checks whether an entity is present (i.e. potentially sampled) by this
distribution
|
Reporter |
createDefaultReporter()
Creates the default reporter for the EntityDistEmpirical distribution.
|
boolean |
remove(E e)
Removes an entity (type E) from the range of this distribution, if it is
included.
|
E |
sample()
Returns the next empirically distributed entity sample.
|
void |
setNonNegative(boolean newValue)
Overrides the same method of
desmoj.dist.Distribution . |
sampleObject
changeRandomGenerator, getInitialSeed, getNonNegative, getNumSamples, isAntithetic, reset, reset, setAntithetic, setSeed
getCorrespondingSchedulable, getDescription, getObservations, getReporter, incrementObservations, incrementObservations, reportIsOn, reportOff, reportOn, resetAt, setCorrespondingSchedulable, setDescription, setReporter
current, currentEntity, currentEntityAll, currentEvent, currentModel, currentSimProcess, debugIsOn, debugOff, debugOn, getModel, isExperimentCompatible, isModelCompatible, presentTime, sendDebugNote, sendMessage, sendTraceNote, sendWarning, skipTraceNote, skipTraceNote, traceIsOn, traceOff, traceOn
getName, getQuotedName, toString
public EntityDistEmpirical(Model owner, java.lang.String name, boolean showInReport, boolean showInTrace)
owner
- Model : The distribution's ownername
- java.lang.String : The distribution's nameshowInReport
- boolean : Flag for producing reportsshowInTrace
- boolean : Flag for producing trace outputpublic Reporter createDefaultReporter()
createDefaultReporter
in class Distribution
EntityDistEmpiricalReporter
public boolean add(E e, double probability)
e
- E : The entity to be added to the range of this distribution.probability
- double : The relative probability of this distribution
sampling Entity e.public void changeProbability(E e, double newProbability)
e
- E : The entity whose relative probability is adjusted.newProbability
- double : The new relative probability of this distribution
sampling Entity e.public boolean contains(E e)
e
- E : The entity to be checked.public boolean remove(E e)
e
- E : The entity to be removed from the range of this
distribution.public E sample()
sample
in class EntityDist<E extends Entity>
public void setNonNegative(boolean newValue)
desmoj.dist.Distribution
. A
warning that it makes no sense to set a EntityDistEmpirical
to be (not) negative is printed since the distribution samples are not
numerical.setNonNegative
in class Distribution
newValue
- boolean : No effect. A warning is issued.