public class Dictionary extends TypedAtomicActor
Red (cxh) |
Yellow (cxh) |
Entity.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
FileParameter |
file
If a file is given here, it will be read upon initialization
(if it exists and can be parsed as an array of arrays of tokens)
to initialize the dictionary.
|
TypedIOPort |
keys
Upon receiving any token at the triggerKeys port, this actor
will produce on this output an array containing all the keys
of entries in the dictionary.
|
FileParameter |
loggingDirectory
If given, a log file will be written to the specified
directory.
|
TypedIOPort |
notFound
An output listing one or more keys that were
requested but not found in the dictionary.
|
TypedIOPort |
readKey
An input that provides a key for a value to be read from the
dictionary.
|
TypedIOPort |
readKeyArray
An input that provides an array of keys to be read
simultaneously from the dictionary.
|
TypedIOPort |
result
An output providing the result of a single reading of the
dictionary via the readKey input port.
|
TypedIOPort |
resultArray
An output providing the result of a multiple reading of the
dictionary via the readKeyArray input port.
|
TypedIOPort |
triggerKeys
Upon receiving any token at this port, this actor will produce
on the keys output an array containing all the keys of entries
in the dictionary.
|
Parameter |
updateFile
If set to true, and if a file parameter is given, then
upon each update to the dictionary, the contents of the dictionary
will be stored in the file.
|
TypedIOPort |
value
Input port for providing a value to store in the dictionary.
|
TypedIOPort |
writeKey
An input that provides a key for a key-value pair to be stored
in the dictionary.
|
_typesValid
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
COMPLETED, NOT_READY, STOP_ITERATING
Constructor and Description |
---|
Dictionary(CompositeEntity container,
java.lang.String name)
Construct an actor with the given container and name.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone(Workspace workspace)
Clone the actor into the specified workspace.
|
void |
fire()
If there is a writeKey input, then update the dictionary;
specifically, if there is also a value input, then insert into
the dictionary the key-value pair given by these two inputs.
|
void |
initialize()
Clear the dictionary.
|
void |
wrapup()
If a file has been specified and updateFile is true, then
save the current state of the dictionary in the file.
|
_containedTypeConstraints, _customTypeConstraints, _defaultTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, postfire, prefire, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getFullName, getModelErrorHandler, getName, getName, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
isFireFunctional, isStrict, iterate, postfire, prefire, stop, stopFire, terminate
addInitializable, preinitialize, removeInitializable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
getDerivedLevel, getDerivedList, propagateValue
public FileParameter file
public TypedIOPort keys
public FileParameter loggingDirectory
A file name can also contain the following strings that start with "$", which get substituted with the appropriate values.
String | Description | Property |
---|---|---|
$CWD |
The current working directory | user.dir |
$HOME |
The user's home directory | user.home |
$PTII |
The home directory of the Ptolemy II installation | ptolemy.ptII.dir |
$TMPDIR |
The temporary directory | java.io.tmpdir |
$USERNAME |
The user's account name | user.name |
public TypedIOPort notFound
public TypedIOPort readKey
public TypedIOPort readKeyArray
public TypedIOPort result
notFound
output port.public TypedIOPort resultArray
readKeyArray
input is not in the dictionary,
there will be a nil token in the result array in the position
of the missing key. The missing keys will be produced on the
notFound output.public TypedIOPort triggerKeys
public Parameter updateFile
public TypedIOPort value
public TypedIOPort writeKey
public Dictionary(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of this actor.IllegalActionException
- If the actor cannot be contained
by the proposed container.NameDuplicationException
- If the container already has an
actor with this name.public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
clone
in class TypedAtomicActor
workspace
- The workspace for the new object.java.lang.CloneNotSupportedException
- If a derived class contains
an attribute that cannot be cloned.NamedObj.exportMoML(Writer, int, String)
,
NamedObj.setDeferringChangeRequests(boolean)
public void fire() throws IllegalActionException
fire
in interface Executable
fire
in class AtomicActor<TypedIOPort>
IllegalActionException
- Not thrown in this base class.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AtomicActor<TypedIOPort>
IllegalActionException
- If the superclass throws it.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class AtomicActor<TypedIOPort>
IllegalActionException
- If the file cannot be written.