public class ContDistConstant extends ContDist
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Constructor and Description |
---|
ContDistConstant(Model owner,
java.lang.String name,
double constantValue,
boolean showInReport,
boolean showInTrace)
Constructs a simple distribution which produces samples equal to the
constant value it has been given.
|
Modifier and Type | Method and Description |
---|---|
Reporter |
createDefaultReporter()
Creates the default reporter for the constant distribution.
|
double |
getConstantValue()
Returns the constant value associated with this
ConstantDiscreteDist distribution |
java.lang.Double |
getInverseOfCumulativeProbabilityFunction(double p)
Method to map a double
p from 0...1 to the
distribution's domain by determining the value x that satisfies
P(X < x) = p . |
java.lang.Double |
sample()
Returns the next constant sample of this distribution.
|
void |
setConstant(double newValue)
Changes the constant value to the new one specified.
|
void |
setNonNegative(boolean newValue)
Overrides the same method of
desmoj.dist.Distribution . |
sampleTimeSpan, sampleTimeSpan
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 ContDistConstant(Model owner, java.lang.String name, double constantValue, boolean showInReport, boolean showInTrace)
owner
- Model : The distribution's ownername
- java.lang.String : The distribution's nameconstantValue
- double : The constant value produced by this distributionshowInReport
- boolean : Flag for producing reportsshowInTrace
- boolean : Flag for producing trace outputpublic Reporter createDefaultReporter()
createDefaultReporter
in class Distribution
DistributionReporter
public double getConstantValue()
ConstantDiscreteDist
distributionConstantDiscreteDist
distributionpublic java.lang.Double sample()
sample
in class NumericalDist<java.lang.Double>
public java.lang.Double getInverseOfCumulativeProbabilityFunction(double p)
p
from 0...1 to the
distribution's domain by determining the value x that satisfies
P(X < x) = p
.getInverseOfCumulativeProbabilityFunction
in class NumericalDist<java.lang.Double>
p
- double: A value between 0 and 1public void setConstant(double newValue)
newValue
- double : the new value to be returned by this pseudo
distributionpublic void setNonNegative(boolean newValue)
desmoj.dist.Distribution
. It
makes no sense to set a ConstantDiscreteDist
object with a
negative constant to nonNegative. In this case a warning will be sent. true
the distribution returns positive samples only,
otherwise it also produces negative samples, if possible.setNonNegative
in class Distribution
newValue
- boolean : If true
the distribution is set to
return positive samples only, otherwise it also produces
negative samples, if possible.