Package ptolemy.actor.lib.io
Class TokenReader
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.Cloneable
,Actor
,Executable
,FiringsRecordable
,Initializable
,TypedActor
,Changeable
,Debuggable
,DebugListener
,Derivable
,Instantiable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
@Deprecated public class TokenReader extends FileReader
Deprecated.Use LineReader followed by ExpressionToToken.An actor that reads a string expression from a file or URL upon receiving a signal on its trigger input port, and outputs a token that is the result of evaluating the read string. The file or URL is specified by the FileOrURL parameter or set using the FileOrURL port. If the file or URL cannot be read, the expression cannot be parsed successfully, or the resulting token does not match the type constraint of the output port, the value of the errorHandlingStrategy parameter determines the behavior of this actor. TODO: describe automatic port constraint setting FIXME: More here. Particularly, document output type handling.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Edward A. Lee, Marten Lohstroh
- Pt.AcceptedRating:
- Red (reviewmoderator)
- Pt.ProposedRating:
- Red (eal)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.Entity
Entity.ContainedObjectsIterator
-
-
Field Summary
Fields Modifier and Type Field Description StringParameter
errorHandlingStrategy
Deprecated.The error handled strategy.Parameter
outputType
Deprecated.If this parameter has a value, then the value specifies the type of the output port.-
Fields inherited from class ptolemy.actor.lib.io.FileReader
fileOrURL, fileOrURLPort, newline
-
Fields inherited from class ptolemy.actor.lib.LimitedFiringSource
_firingCountLimit, _iterationCount, firingCountLimit
-
Fields inherited from class ptolemy.actor.lib.Source
_triggered, output, trigger
-
Fields inherited from class ptolemy.actor.TypedAtomicActor
_typesValid
-
Fields inherited from class ptolemy.actor.AtomicActor
_actorFiringListeners, _initializables, _notifyingActorFiring, _stopRequested
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
Fields inherited from interface ptolemy.actor.Executable
COMPLETED, NOT_READY, STOP_ITERATING
-
-
Constructor Summary
Constructors Constructor Description TokenReader(CompositeEntity container, java.lang.String name)
Deprecated.Construct an actor with a name and a container.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.util.Set<Inequality>
_defaultTypeConstraints()
Deprecated.Do not establish the usual default type constraints.protected void
_handleFileData(java.lang.String fileContents)
Deprecated.FIXME: Send the specified string to the output.void
fire()
Deprecated.Not implemented entirely yet.-
Methods inherited from class ptolemy.actor.lib.LimitedFiringSource
attributeChanged, initialize, postfire
-
Methods inherited from class ptolemy.actor.lib.Source
_customTypeConstraints, prefire
-
Methods inherited from class ptolemy.actor.TypedAtomicActor
_containedTypeConstraints, _fireAt, _fireAt, attributeTypeChanged, clone, clone, isBackwardTypeInferenceEnabled, newPort, typeConstraintList, typeConstraints
-
Methods inherited from class ptolemy.actor.AtomicActor
_actorFiring, _actorFiring, _declareDelayDependency, addActorFiringListener, addInitializable, connectionsChanged, createReceivers, declareDelayDependency, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, isFireFunctional, isStrict, iterate, newReceiver, outputPortList, preinitialize, pruneDependencies, recordFiring, removeActorFiringListener, removeDependency, removeInitializable, setContainer, stop, stopFire, terminate, wrapup
-
Methods inherited from class ptolemy.kernel.ComponentEntity
_adjustDeferrals, _checkContainer, _getContainedObject, _propagateExistence, getContainer, instantiate, isAtomic, isOpaque, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, propagateExistence, setName
-
Methods inherited from class ptolemy.kernel.Entity
_addPort, _description, _exportMoMLContents, _removePort, _validateSettables, connectedPortList, connectedPorts, containedObjectsIterator, getAttribute, getPort, getPorts, linkedRelationList, linkedRelations, portList, removeAllPorts, setClassDefinition, uniqueName
-
Methods inherited from class ptolemy.kernel.InstantiableNamedObj
_setParent, exportMoML, getChildren, getElementName, getParent, getPrototypeList, isClassDefinition, isWithinClassDefinition
-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _executeChangeRequests, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, addChangeListener, addDebugListener, addHierarchyListener, 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
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ptolemy.actor.Actor
createReceivers, getCausalityInterface, getDirector, getExecutiveDirector, getManager, inputPortList, newReceiver, outputPortList
-
Methods inherited from interface ptolemy.kernel.util.Derivable
getDerivedLevel, getDerivedList, propagateValue
-
Methods inherited from interface ptolemy.actor.Executable
isFireFunctional, isStrict, iterate, stop, stopFire, terminate
-
Methods inherited from interface ptolemy.actor.Initializable
addInitializable, preinitialize, removeInitializable, wrapup
-
Methods inherited from interface ptolemy.kernel.util.Nameable
description, getContainer, getDisplayName, getFullName, getName, getName, setName
-
-
-
-
Field Detail
-
errorHandlingStrategy
public StringParameter errorHandlingStrategy
Deprecated.The error handled strategy. The strategy to use if:- the file or URL cannot be read,
- the data read from the file or the URL cannot be parsed,
- the parsed token cannot be converted into a token of the type given by outputType, if such a type is given, or
- the parsed token cannot be converted to a token of the resolved type of the output, if no outputType is given.
-
outputType
public Parameter outputType
Deprecated.If this parameter has a value, then the value specifies the type of the output port. When the actor reads from the file or URL, it expects the data read to be a string that can be parsed into a token that is convertible to (or identical to) this output type. If it is not, then the action taken is specified by the errorHandlingStrategy parameter. If this parameter has no value (the default), then the output type will be set to match whatever is first read from the file or URL and will be updated on each subsequent firing if the data read from the file or URL cannot be converted to the type determined by the first read.
-
-
Constructor Detail
-
TokenReader
public TokenReader(CompositeEntity container, java.lang.String name) throws IllegalActionException, NameDuplicationException
Deprecated.Construct an actor with a name and a container. The container argument must not be null, or a NullPointerException will be thrown.- Parameters:
container
- The container.name
- The name of this actor.- Throws:
IllegalActionException
- If the container is incompatible with this actor.NameDuplicationException
- If the name coincides with an actor already in the container.
-
-
Method Detail
-
fire
public void fire() throws IllegalActionException
Deprecated.Not implemented entirely yet. FIXME- Specified by:
fire
in interfaceExecutable
- Overrides:
fire
in classFileReader
- Throws:
IllegalActionException
- If thrown by the base class.
-
_defaultTypeConstraints
protected java.util.Set<Inequality> _defaultTypeConstraints()
Deprecated.Do not establish the usual default type constraints.- Overrides:
_defaultTypeConstraints
in classTypedAtomicActor
- Returns:
- null
-
_handleFileData
protected void _handleFileData(java.lang.String fileContents) throws IllegalActionException
Deprecated.FIXME: Send the specified string to the output.- Overrides:
_handleFileData
in classFileReader
- Parameters:
fileContents
- The contents of the file or URL that was read.- Throws:
IllegalActionException
- If sending the data fails.
-
-