ptolemy.actor.lib
Class Uniform
java.lang.Object
ptolemy.kernel.util.NamedObj
ptolemy.kernel.InstantiableNamedObj
ptolemy.kernel.Entity
ptolemy.kernel.ComponentEntity
ptolemy.actor.AtomicActor
ptolemy.actor.TypedAtomicActor
ptolemy.actor.lib.Source
ptolemy.actor.lib.RandomSource
ptolemy.actor.lib.Uniform
- All Implemented Interfaces:
- Actor, Changeable, java.lang.Cloneable, Debuggable, DebugListener, Derivable, Executable, Instantiable, ModelErrorHandler, MoMLExportable, Nameable, java.io.Serializable, TypedActor
- public class Uniform
- extends RandomSource
Produce a random sequence with a uniform distribution. On each iteration,
a new random number is produced. The output port is of type DoubleToken.
The values that are generated are independent and identically distributed
with bounds defined by the parameters. In addition, the
seed can be specified as a parameter to control the sequence that is
generated.
- Since:
- Ptolemy II 1.0
- Version:
- $Id: Uniform.java,v 1.14 2004/04/13 03:04:59 cxh Exp $
- Author:
- Edward A. Lee
- See Also:
- Serialized Form
- Accepted Rating:
- Proposed Rating:
| Fields inherited from class ptolemy.kernel.util.NamedObj |
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _elementName, _isPersistent, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS |
|
Constructor Summary |
Uniform(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name. |
|
Method Summary |
void |
fire()
Send a random number with a uniform distribution to the output.
|
boolean |
prefire()
Calculate the next random number. |
| Methods inherited from class ptolemy.actor.AtomicActor |
_createReceivers, connectionsChanged, getDirector, getExecutiveDirector, getFunctionDependency, getManager, inputPortList, iterate, newReceiver, outputPortList, postfire, preinitialize, pruneDependencies, removeDependency, setContainer, stop, stopFire, terminate, wrapup |
| Methods inherited from class ptolemy.kernel.Entity |
_description, _exportMoMLContents, _removePort, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName, validateSettables |
| Methods inherited from class ptolemy.kernel.util.NamedObj |
_addAttribute, _attachText, _cloneFixAttributeFields, _debug, _debug, _debug, _debug, _debug, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, attributeChanged, attributeList, attributeList, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, getAttribute, getAttributes, getChangeListeners, getClassName, getDerivedLevel, getDerivedList, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, message, propagateValue, propagateValues, removeChangeListener, removeDebugListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setModelErrorHandler, setPersistent, setSource, toplevel, toString, workspace |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
lowerBound
public Parameter lowerBound
- The lower bound.
This parameter contains a DoubleToken, initially with value 0.0.
upperBound
public Parameter upperBound
- The upper bound.
This parameter contains a DoubleToken, initially with value 0.0.
Uniform
public Uniform(CompositeEntity container,
java.lang.String name)
throws NameDuplicationException,
IllegalActionException
- Construct an actor with the given container and name.
- Parameters:
container - The container.name - The name of this actor.
- Throws:
IllegalActionException - If the actor cannot be contained
by the proposed container.
NameDuplicationException - If the container already has an
actor with this name.
fire
public void fire()
throws IllegalActionException
- Send a random number with a uniform distribution to the output.
This number is only changed in the prefire() method, so it will
remain constant throughout an iteration.
- Specified by:
fire in interface Executable- Overrides:
fire in class Source
- Throws:
IllegalActionException - If there is no director.
prefire
public boolean prefire()
throws IllegalActionException
- Calculate the next random number.
- Specified by:
prefire in interface Executable- Overrides:
prefire in class AtomicActor
- Returns:
- Whatever the superclass returns (probably true).
- Throws:
IllegalActionException - If the value of lowerBound
is greater than the value of upperBound.