ptolemy.actor
Interface Executable
- All Superinterfaces:
- Initializable
- All Known Subinterfaces:
- Actor, BranchActor, CTDynamicActor, CTEventGenerator, CTStatefulActor, CTStepSizeControlActor, CTWaveformGenerator, DDI, GTCompositeActor, PeriodicDirector, RefinementActor, RefinementActor, Suspendable, TMActor, TypedActor, WirelessChannel
- All Known Implementing Classes:
- Absent, AbsoluteValue, AbstractCalInterpreter, AbstractDDI, AbstractPlaceableActor, Accumulator, Accumulator, ActorRecursion, AdaptiveMedian, AddSubtract, AddSubtract, AnythingToDouble, ApplyFilterOverArray, ApplyFunction, ApplyFunctionOverSequence, ArrayAppend, ArrayAverage, ArrayContains, ArrayElement, ArrayElementAsMatrix, ArrayExtract, ArrayLength, ArrayLevelCrossing, ArrayMaximum, ArrayMinimum, ArrayOfRecordsExporter, ArrayOfRecordsRecorder, ArrayPeakSearch, ArrayPeakSearch, ArrayPlotter, ArrayPlotterXY, ArrayRemoveElement, ArraySort, ArraySum, ArrayToElements, ArrayToSequence, ArrowKeyProbe, ArrowKeySensor, AtomicActor, AtomicActorMatcher, AtomicWirelessChannel, AudioCapture, AudioPlayer, AudioPlayer, AudioReadBuffer, AudioReader, AudioWriteBuffer, AudioWriter, Autocorrelation, Autocorrelation, Average, Average, AverageOverTime, BackDropQueue, Backtrack, BandlimitedNoise, BarGraph, Barrier, Barrier, Bernoulli, BinarySwitch, BitsToInt, BooleanMultiplexor, BooleanSelect, BooleanSelect, BooleanSwitch, BooleanSwitch, BooleanToAnything, BoundedBufferNondeterministicDelay, BoundedBufferTimedDelay, Box2D, Box3D, Buffer, Buffer, BusAssembler, BusDisassembler, ButtonTime, CalInterpreter, CartesianToComplex, CartesianToPolar, Case, Case, Case, CaseDirector, Chop, Chop, CIActor, CIDirector, CipherActor, CircularSweep3D, ClassWrapper, ClipPlayer, Clock, ClockSensor, CodegenActor, CollisionDetector, ColorFinder, ColtBeta, ColtBinomial, ColtBinomialSelector, ColtBreitWigner, ColtChiSquare, ColtExponential, ColtExponentialPower, ColtGamma, ColtHyperGeometric, ColtLogarithmic, ColtNegativeBinomial, ColtNormal, ColtPoisson, ColtPoissonSlow, ColtRandomSource, ColtStudentT, ColtVonMises, ColtZeta, Commutator, Commutator, Comparator, CompiledCompositeActor, CompiledCompositeActor, ComplexAddSubtract, ComplexToCartesian, ComplexToPolar, CompositeActor, CompositeActorMatcher, CompositeProcessDirector, ComputeHistogram, ComputeHistogram, Concat, Cone3D, ConfigurationSelect, ConfigurationSwitch, Configurer, Configurer, Const, ContinuousClock, ContinuousDirector, ContinuousIntegrator, ContinuousMerge, ContinuousTimeDelay, ContinuousTransferFunction, ContinuousTransferFunction, Converter, ConvolutionalCoder, Counter, Counter, CountTrues, Course, CryptographyActor, CSP, CSPActor, CSPBuffer, CSPDirector, CSPMultiSink, CSPMultiSource, CSPSieve, CSPSink, CSPSource, CTBaseIntegrator, CTCase, CTCaseDirector, CTCompositeActor, CTCompositeActor, CTDirector, CTEmbeddedDirector, CTMixedSignalDirector, CTMultiSolverDirector, CTPeriodicSampler, CTRateLimiter, CTRefinement, CTTriggeredSampler, Current, CurrentTime, Cylinder3D, DatabaseInsert, DatabaseManager, DatabaseQuery, DatabaseSelect, Dataflow, DataflowWithRates, DatagramReader, DatagramWriter, DB, DB, DCT2x2dc, DCT4x4dc, DCT8x8, DDEActor, DDEDirector, DDESink, DDF, DDFBooleanSelect, DDFDirector, DDFOrderedMerge, DDFSelect, DDFSingleTokenCommutator, DEActor, DEDirector, Default, DelayChannel, DelayLine, DelayLine, DelayStart, Derivative, DeScrambler, DEThreadActor, DETransformer, Differential, Differential, DifferentialSystem, DifferentialSystem, Director, DirectoryListing, Discard, DiscreteClock, DiscreteClock, DiscreteClock, DiscreteRandomSource, Display, DistributedDirector, DistributedLineWriter, DistributedSDFDirector, DistributedTypedCompositeActor, Distributor, Distributor, DoNothingDirector, DotProduct, DoubleFork, DoubleMatrixToJAI, DoubleReader, DoubleReader, DoubleToFix, DoubleToMatrix, DownSample, DTDirector, ElementsToArray, Ellipse2D, EmbeddedCActor, EmbeddedCActor.EmbeddedActor, EmbeddedCFileActor, EmbeddedCFileActor.EmbeddedFileActor, EmbeddedJavaActor, EmbeddedJavaActor.EmbeddedActor, EnabledComposite, Equals, ErasureChannel, EventButton, EventFilter, EventSource, EventSource, Exec, ExecutionTime, Exit, Expression, Expression, ExpressionReader, ExpressionToToken, ExpressionWriter, FeedBackDelay, FFT, FFT, FileReader, FileWriter, FIR, FirstOrderHold, FixComparator, FixConst, FixCounter, FixedPointDirector, FixSequence, FixToDouble, FixToFix, FixToString, FixTransformer, FmvAutomaton, FmvAutomaton, FrontDropQueue, FSMActor, FSMActor, FSMDirector, FSMDirector, FSMMatcher, Gaussian, Gaussian, GetCausalityInterface, GetCurrentMicrostep, GetProperties, GiottoDirector, GRActor, GRActor2D, GRActor3D, GradientAdaptiveLattice, GradientAdaptiveLattice, GraphicalLocator, GRDirector, GRShadedShape, GRShape2D, GRTransform, GRTransform2D, HadamardCode, HammingCoder, HammingDecoder, HDFDirector, HDFFSMDirector, HistogramPlotter, HSFSMDirector, HSModalDirector, HTVQEncode, HuffmanBasic, HuffmanCoder, HuffmanDecoder, HybridModalDirector, IDCT4x4dc, IDCT8x8, IFFT, IFFT, IIR, IIR, Image2D, ImageContrast, ImageDisplay, ImageDisplay, ImagePartition, ImageReader, ImageRotate, ImageSequence, ImageToJAI, ImageToJMF, ImageToString, ImageUnpartition, Inhibit, InstantaneousDialogGenerator, IntArrayToString, IntegerCounter, Integrator, Integrator, Integrator, InteractiveShell, InterfaceAutomaton, InterfaceAutomaton, Interpolator, Interpolator, IntToBits, InUnitsOf, IsPresent, IterateOverArray, IterateOverArray.IterateComposite, IterateOverArray.IterateDirector, JAIAffineTransform, JAIBandCombine, JAIBandSelect, JAIBMPWriter, JAIBorder, JAIBoxFilter, JAIConstant, JAIConvolve, JAICrop, JAIDataConvert, JAIDCT, JAIDFT, JAIEdgeDetection, JAIIDCT, JAIIDFT, JAIImageReader, JAIInvert, JAIJPEGWriter, JAILog, JAIMagnitude, JAIMedianFilter, JAIPeriodicShift, JAIPhase, JAIPNGWriter, JAIPNMWriter, JAIPolarToComplex, JAIRotate, JAIScale, JAITIFFWriter, JAIToDoubleMatrix, JAITranslate, JAITranspose, JAIWriter, JopReadPort, JopSerialRead, JopSerialWrite, JopWatchDog, JopWritePort, KeyInput3D, KeyInput3DProbe, KeyReader, KeyStoreActor, KeyWriter, Lattice, LazyTypedCompositeActor, LEDMatrix, LempelZivCoder, LempelZivDecoder, LevelCrossingDetector, LevelCrossingDetector, LevinsonDurbin, LifeCycleManager, LimitedFiringSource, LimitedRangeChannel, Limiter, Line2D, LinearDifferenceEquationSystem, LinearDifferenceEquationSystem, LinearStateSpace, LinearStateSpace, LineCoder, LineReader, LineWriter, LinkVisualizer, LiveSoundActor, LMSAdaptive, Locator, LogicalNot, LogicalNot, LogicFunction, LogicFunction, LongToDouble, LookupTable, MapFileStorage, MapWorker, MathFunction, MatrixJoin, MatrixSplit, MatrixToDouble, MatrixToSequence, MatrixViewer, Maximum, MaxIndex, Memory, Merge, Merge, MicaCompositeActor, MicaLeds, Minimum, MirrorComposite, MirrorComposite.MirrorCompositeContents, MobileFunction, MobileModel, ModalController, ModalController, ModalDirector, ModalDirector, ModalModel, ModalModel, ModalModelMatcher, ModalRefinement, ModelCombine, ModelDisplay, ModelExecutor, ModelExecutor.Wrapper, ModelExecutor.Wrapper.WrapperDirector, ModelGenerator, ModelReference, ModelView, MoMLGenerator, MonitorImage, MonitorValue, MouseInput3D, MovableViewScreen3D, MovieReader, MovieWriter, MovingAverage, MovingMaximum, MultiCompositeActor, MultiInstanceComposite, Multiplexor, Multiplexor, Multiplexor, Multiplier, MultiplyDivide, MultirateFSMDirector, MultirateFSMDirector, NCComponentBase, NCCompositeActor, NodeRandomizer, Noise, Noise, NondeterministicMerge, NondeterministicMerge.ChannelActor, NondeterministicMerge.MergeDirector, NonInterruptibleTimer, NonStrictDelay, NonStrictDisplay, NonStrictFSMDirector, NonStrictFSMDirector, NonStrictLogicFunction, NonStrictTest, NonStrictThreeBitAdder, Occupants, Or, OrderedMerge, OrderedMerge, OrderedRecordAssembler, ParameterSet, Pattern, PeriodicSampler, PetriNetActor, PetriNetDirector, PhaseUnwrap, PhaseUnwrap, PID, Place, PlaySound, Plotter, PlotterBase, PNDirector, PoissonClock, PoissonClock, PolarToCartesian, PolarToComplex, PolyCylinder3D, PowerLossChannel, Pre, Previous, PrivateKeyReader, ProcessDirector, PSDFDirector, PSNR, PtalonActor, PtalonMatcher, PtalonMatcher.NestedPtalonActor, PteraController, PteraDirector, PteraModalModel, PtinyOSCompositeActor, PtinyOSDirector, PublicKeyReader, Publisher, PublisherNonStrictTest, PublisherTest, Pulse, Pulse, PythonScript, Quantizer, Queue, Queue, RaisedCosine, Ramp, Ramp, RandomSource, RandomSource, Reader, RealTimeComposite, RealTimeComposite.RealTimeDirector, RealTimePlotter, RecordAssembler, RecordDisassembler, Recorder, Recorder, RecordUpdater, Rectangle2D, RectangularFigure2D, RecursiveLattice, RecursiveLattice, ReduceWorker, Refinement, Refinement, Refinement, Region, Register, Register, RegisterSR, Remainder, RemoveNilTokens, RendezvousDirector, Repeat, Replacement, ResettableTimer, ResourcePool, ResourcePool, Rician, ROM, Room, Rotate2D, Rotate3D, Round, RunCompositeActor, SaltAndPepper, SampleDelay, Sampler, Sampler, Scale, Scale2D, Scale3D, Scrambler, SDF, SDFConverter, SDFDirector, SDFTransformer, SecretKey, SecretKeyReader, Select, Select, Sequence, Sequence, SequencePlotter, Sequencer, Sequencer, SequenceScope, SequenceSource, SequenceToArray, SequenceToMatrix, SequentialClock, SequentialClock, SerialComm, Server, SetProperties, SetVariable, SharedQueue, SignatureActor, SignatureSigner, SignatureVerifier, Simulator, SingleEvent, SingleTokenCommutator, SingleTokenDistributor, Sink, SketchedSource, Sleep, Slice, Slicer, SliderSource, SMVLegacyCodeActor, SoundActor, SoundPlayer, Source, Sphere3D, SplitReader, SQLStatement, SRDirector, Starver, StateMatcher, StaticSchedulingDirector, Stop, StreamLoader, StringCompare, StringConst, StringFunction, StringIndexOf, StringLength, StringMatches, StringReplace, StringSimpleReplace, StringSubstring, StringToIntArray, StringToKeyValue, StringToUnsignedByteArray, StringToXML, SubMatrix, Subscriber, SubscriptionAggregator, SumofAbsoluteDifferences, SuppressSimultaneousEvents, SurgeVisualizer, Switch, Switch, SymmetricDecryption, SymmetricEncryption, Synchronizer, SynchronousFixTransformer, SystemCommand, TDLActor, TDLController, TDLModule, TDLModuleDirector, TDLRefinement, TDLTask, TerrainProperty, Test, TestActorPortDepth, TesterDirector, TestExceptionHandler, TextString3D, ThreadedComposite, ThreadedComposite.ThreadedDirector, ThresholdMonitor, ThrowException, ThrowModelError, TimeCompare, TimedDelay, TimeDelay, TimedPlotter, TimedPNDirector, TimedScope, TimedSource, TimeGap, Timer, TMCompositeFacade, TMDirector, TokenToExpression, TopLevelCurrentTime, Torus3D, Transform.EmbeddedConfigurer, TransformationRule, TransformationRule.TransformationDirector, Transformer, TransitionRefinement, TransitionRefinement, Translate2D, Translate3D, TransmitPropertyTransformer, TrellisDecoder, Triangular, Triangulator, TrigFunction, TriggeredClock, TriggeredContinuousClock, TrueGate, TypedAtomicActor, TypedCompositeActor, TypeOpaqueCompositeActor, TypeTest, UnaryMathFunction, Undefined, Uniform, UnionDisassembler, UnionMerge, UnsignedByteArrayToString, UpSample, URLDirectoryReader, URLReader, URLToImage, VariableClock, VariableDelay, VariableFIR, VariableLattice, VariableRecursiveLattice, VariableSleep, VectorAssembler, VectorDisassembler, VideoCamera, VideoPlayer, ViewScreen2D, ViewScreen3D, VisualModelReference, ViterbiDecoder, VQDecode, WaitingTime, WallClockTime, When, Wire, Wire, WiredToWireless, WirelessComposite, WirelessDirector, WirelessToWired, Writer, XMLInclusion, XSLTransformer, XYPlotter, XYScope, ZeroCrossingDetector, ZeroOrderHold, ZeroOrderHold
public interface Executable
- extends Initializable
This interface defines the action methods, which determine
how an object can be invoked. It should be implemented by actors
and directors. In an execution of an application,
the preinitialize() and initialize() methods should be
invoked exactly once, followed by any number of iterations, followed
by exactly one invocation of the wrapup() method. An iteration
is defined to be any number of invocations of prefire() and fire(),
where fire() is invoked only if prefire() returns true, followed by
exactly one invocation of the postfire() method.
The postfire() method returns false if no further iterations
should occur. The initialize(), fire() and postfire() methods may produce
output data. The preinitialize() method runs
before type resolution has been done, and is permitted to make
changes in the topology of the model.
- Since:
- Ptolemy II 0.2
- Version:
- $Id: Executable.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Mudit Goel, Edward A. Lee, Lukito Muliadi, Steve Neuendorffer
- Accepted Rating:
- Proposed Rating:
Field Summary |
static int |
COMPLETED
An indicator that the iterate() method completed successfully. |
static int |
NOT_READY
An indicator that the iterate() method did not complete because
the actor was not ready (prefire() returned false). |
static int |
STOP_ITERATING
An indicator that the actor does not wish to be fired again. |
Method Summary |
void |
fire()
Fire the actor. |
boolean |
isFireFunctional()
Return true if this executable does not change state in either
the prefire() or the fire() method. |
boolean |
isStrict()
Return true if this executable is strict, meaning all inputs must
be known before iteration. |
int |
iterate(int count)
Invoke a specified number of iterations of the actor. |
boolean |
postfire()
This method should be invoked once per iteration, after the last
invocation of fire() in that iteration. |
boolean |
prefire()
This method should be invoked prior to each invocation of fire(). |
void |
stop()
Request that execution of this Executable stop as soon
as possible. |
void |
stopFire()
Request that execution of the current iteration complete. |
void |
terminate()
Terminate any currently executing model with extreme prejudice. |
COMPLETED
static final int COMPLETED
- An indicator that the iterate() method completed successfully.
- See Also:
- Constant Field Values
NOT_READY
static final int NOT_READY
- An indicator that the iterate() method did not complete because
the actor was not ready (prefire() returned false).
- See Also:
- Constant Field Values
STOP_ITERATING
static final int STOP_ITERATING
- An indicator that the actor does not wish to be fired again.
- See Also:
- Constant Field Values
fire
void fire()
throws IllegalActionException
- Fire the actor. This may be invoked several times between
invocations of prefire() and postfire(). Output data may
(and normally will) be produced.
Typically, the fire() method performs the computation associated
with an actor. This method is not required to have bounded
execution. However, after endFire() is called, this method should
return in bounded time.
- Throws:
IllegalActionException
- If firing is not permitted.
isFireFunctional
boolean isFireFunctional()
- Return true if this executable does not change state in either
the prefire() or the fire() method. A class that returns true
is said to obey the actor abstract semantics. In particular,
such an actor can be used in domains that have a fixed point
semantics and may repeatedly fire the actor before committing
to state changes.
- Returns:
- True if this executable only updates its states during
an iteration in the postfire() method.
isStrict
boolean isStrict()
throws IllegalActionException
- Return true if this executable is strict, meaning all inputs must
be known before iteration. Normally, classes that implement this
interface are strict, so this method will return true.
However, some classes can perform an iteration even if some
inputs are not known (i.e., these classes tolerate a return value
of false from the isKnown() method of Receiver).
- Returns:
- True if this executable is strict, meaning all inputs must
be known before iteration.
- Throws:
IllegalActionException
- Thrown by subclass.
iterate
int iterate(int count)
throws IllegalActionException
- Invoke a specified number of iterations of the actor. An
iteration here is equivalent to invoking prefire(), fire(), and
postfire(), in that order. In an iteration, if prefire()
returns true, then fire() will be called once, followed by
postfire(). Otherwise, if prefire() returns false, fire()
and postfire() are not invoked, and this method returns
NOT_READY. If postfire() returns false, then no more
iterations are invoked, and this method returns STOP_ITERATING.
Otherwise, it returns COMPLETED.
An implementation of this method is not required to
actually invoke prefire(), fire(), and postfire(). An
implementation of this method must, however,
perform the equivalent operations.
Note that this method for iterating an actor should
be used only in domains where a single invocation of
prefire() and fire() is sufficient in an iteration.
- Parameters:
count
- The number of iterations to perform.
- Returns:
- NOT_READY, STOP_ITERATING, or COMPLETED.
- Throws:
IllegalActionException
- If iterating is not
permitted, or if prefire(), fire(), or postfire() throw it.
postfire
boolean postfire()
throws IllegalActionException
- This method should be invoked once per iteration, after the last
invocation of fire() in that iteration. The postfire() method should
not produce output data on output ports of the actor.
It returns true if the execution can proceed into the next iteration,
false if the actor does not wish to be fired again.
This method typically wraps up an iteration, which may involve
updating local state or updating displays.
- Returns:
- True if the execution can continue.
- Throws:
IllegalActionException
- If postfiring is not permitted.
prefire
boolean prefire()
throws IllegalActionException
- This method should be invoked prior to each invocation of fire().
It returns true if the fire() method can be invoked, given the
current status of the inputs and parameters of the actor. Thus
this method will typically check preconditions for a firing, if
there are any. In an opaque, non-atomic entity,
it may move data into an inner subsystem.
- Returns:
- True if the iteration can proceed.
- Throws:
IllegalActionException
- If prefiring is not permitted.
stop
void stop()
- Request that execution of this Executable stop as soon
as possible. An implementation of this method should
pass on the request to any contained executable objects.
An implementation should also return false from postfire()
to indicate to the caller that no further execution of
this Executable is appropriate. After this method is
called, the executable object should not be fired again.
The stopFire() method, by contrast, requests that the
current iteration be completed, but not that the entire
execution be stopped. I.e., the Executable may be fired
again after stopFire() is called.
stopFire
void stopFire()
- Request that execution of the current iteration complete. If
an iteration is always a finite computation (the usual case),
i.e. the fire() method always returns in finite time, then
nothing needs to be done in this method, except possibly to
pass on the request to any contained executable objects. This
method is used to request that an unbounded computation
suspend, returning control to the caller. Thus, if the fire()
method does not normally return in finite time, then this
method is used to request that it return. It should suspend
execution in such a way that if the fire() method is called
again, execution will resume at the point where it was
suspended. However, it should not assume the fire() method
will be called again. It is possible that the wrapup() method
will be called next.
terminate
void terminate()
- Terminate any currently executing model with extreme prejudice.
This method is not intended to be used as a normal route of
stopping execution. To normally stop execution, call the finish()
method instead. This method should be called only
when execution fails to terminate by normal means due to certain
kinds of programming errors (infinite loops, threading errors, etc.).
After this method completes, all resources in use should be
released and any sub-threads should be killed.
However, a consistent state is not guaranteed. The
topology should probably be recreated before attempting any
further operations.
This method should not be synchronized because it must
happen as soon as possible, no matter what.