ptolemy.kernel.util
Interface Instantiable
- All Superinterfaces:
- Derivable, Nameable
- All Known Implementing Classes:
- Absent, AbsoluteValue, AbstractCalInterpreter, AbstractPlaceableActor, Accumulator, Accumulator, ActorGraphTableau, 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, BrowserEffigy, BrowserEffigy.Factory, BrowserTableau, Buffer, Buffer, BusAssembler, BusDisassembler, ButtonTime, CalInterpreter, CartesianToComplex, CartesianToPolar, Case, Case, Case, CaseGraphTableau, CaseGraphTableau, Chop, Chop, CIActor, CipherActor, CircularSweep3D, ClassWrapper, ClipPlayer, Clock, ClockSensor, Clone, 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, ComponentEntity, CompositeActor, CompositeActorMatcher, CompositeEntity, ComputeHistogram, ComputeHistogram, Concat, Cone3D, Configuration, ConfigurationEffigy, ConfigurationSelect, ConfigurationSwitch, Configure, Configurer, Configurer, Const, ContinuousClock, ContinuousIntegrator, ContinuousMerge, ContinuousTimeDelay, ContinuousTransferFunction, ContinuousTransferFunction, Converter, ConvolutionalCoder, Counter, Counter, CountTrues, Course, CryptographyActor, CSPActor, CSPBuffer, CSPMultiSink, CSPMultiSource, CSPSieve, CSPSink, CSPSource, CTBaseIntegrator, CTCase, CTCompositeActor, CTCompositeActor, CTPeriodicSampler, CTRateLimiter, CTRefinement, CTTriggeredSampler, Current, CurrentTime, Cylinder3D, DatabaseInsert, DatabaseManager, DatabaseQuery, DatabaseSelect, DatagramReader, DatagramWriter, DB, DB, DCT2x2dc, DCT4x4dc, DCT8x8, DDEActor, DDESink, DDFBooleanSelect, DDFOrderedMerge, DDFSelect, DDFSingleTokenCommutator, DEActor, DebugListenerTableau, Default, DelayChannel, DelayLine, DelayLine, DelayStart, Derivative, DeScrambler, DEThreadActor, DETransformer, DialogTableau, Differential, Differential, DifferentialSystem, DifferentialSystem, DirectoryListing, Discard, DiscreteClock, DiscreteClock, DiscreteClock, DiscreteRandomSource, Display, Display.DisplayWindowTableau, DistributedLineWriter, DistributedTypedCompositeActor, Distributor, Distributor, DocBuilderEffigy, DocBuilderEffigy.Factory, DocBuilderTableau, DocEffigy, DocEffigy.Factory, DocTableau, DotProduct, DoubleFork, DoubleMatrixToJAI, DoubleReader, DoubleReader, DoubleToFix, DoubleToMatrix, DownSample, EditIconTableau, Effigy, EffigyFactory, ElementsToArray, Ellipse2D, EmbeddedCActor, EmbeddedCActor.EmbeddedActor, EmbeddedCFileActor, EmbeddedCFileActor.EmbeddedFileActor, EmbeddedJavaActor, EmbeddedJavaActor.EmbeddedActor, EnabledComposite, Entity, EntityLibrary, Equals, ErasureChannel, Event, EventButton, EventFilter, EventSource, EventSource, Exec, ExecShellEffigy, ExecShellEffigy.ShellFactory, ExecShellTableau, Execute, ExecutionTime, Exit, Expression, Expression, ExpressionReader, ExpressionShellEffigy, ExpressionShellEffigy.ShellFactory, ExpressionShellTableau, ExpressionToToken, ExpressionWriter, ExternalTextEffigy, ExternalTextTableau, FeedBackDelay, FFT, FFT, FileReader, FileWriter, FIR, FirstOrderHold, FixComparator, FixConst, FixCounter, FixSequence, FixToDouble, FixToFix, FixToString, FixTransformer, FmvAutomaton, FmvAutomaton, FmvAutomatonGraphTableau, FmvAutomatonGraphTableau, FmvState, FmvState, FrontDropQueue, FSMActor, FSMActor, FSMGraphTableau, FSMGraphTableau, FSMMatcher, Gaussian, Gaussian, GeneratorTableau, GetCausalityInterface, GetCurrentMicrostep, GetProperties, GRActor, GRActor2D, GRActor3D, GradientAdaptiveLattice, GradientAdaptiveLattice, GraphicalLocator, GRShadedShape, GRShape2D, GRTransform, GRTransform2D, GTEvent, GTTableau, HadamardCode, HammingCoder, HammingDecoder, HistogramPlotter, HSIFEffigyFactory, HTMLEffigy, HTMLEffigyFactory, HTMLViewerTableau, HTVQEncode, HuffmanBasic, HuffmanCoder, HuffmanDecoder, IDCT4x4dc, IDCT8x8, IFFT, IFFT, IIR, IIR, Image2D, ImageContrast, ImageDisplay, ImageDisplay, ImagePartition, ImageReader, ImageRotate, ImageSequence, ImageTableau, ImageToJAI, ImageToJMF, ImageToString, ImageUnpartition, Inhibit, InitModel, InitModelWithContainer, InputModel, InstantaneousDialogGenerator, InstantiableNamedObj, IntArrayToString, IntegerCounter, Integrator, Integrator, Integrator, InteractiveShell, InteractiveShell.ShellTableau, InterfaceAutomaton, InterfaceAutomaton, InterfaceAutomatonGraphTableau, InterfaceAutomatonGraphTableau, InterfaceTableau, Interpolator, Interpolator, IntToBits, InUnitsOf, IsPresent, IterateOverArray, IterateOverArray.IterateComposite, 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, JVMTableau, KeyInput3D, KeyInput3DProbe, KeyReader, KeyStoreActor, KeyWriter, KielerLayoutTableau, Lattice, LayoutTableau, LazyTypedCompositeActor, LEDMatrix, LempelZivCoder, LempelZivDecoder, LevelCrossingDetector, LevelCrossingDetector, LevinsonDurbin, LifeCycleManager, LimitedFiringSource, LimitedRangeChannel, Limiter, Line2D, LinearDifferenceEquationSystem, LinearDifferenceEquationSystem, LinearStateSpace, LinearStateSpace, LineCoder, LineReader, LineWriter, LinkVisualizer, ListDirectory, LiveSoundActor, LMSAdaptive, Locator, LogicalNot, LogicalNot, LogicFunction, LogicFunction, LongToDouble, LookupTable, MapFileStorage, MapWorker, Match, MatchResultTableau, MathFunction, MatrixJoin, MatrixSplit, MatrixToDouble, MatrixTokenTableau, MatrixToSequence, MatrixViewer, Maximum, MaxIndex, Memory, Merge, Merge, MicaCompositeActor, MicaLeds, Minimum, MirrorComposite, MirrorComposite.MirrorCompositeContents, MobileFunction, MobileModel, ModalController, ModalController, ModalModel, ModalModel, ModalModelMatcher, ModalRefinement, ModelCombine, ModelDirectory, ModelDisplay, ModelExecutor, ModelExecutor.Wrapper, ModelGenerator, ModelReference, ModelView, MoMLGenerator, MonitorImage, MonitorValue, MouseInput3D, MovableViewScreen3D, MovieReader, MovieWriter, MovingAverage, MovingMaximum, MultiCompositeActor, MultiInstanceComposite, Multiplexor, Multiplexor, Multiplexor, Multiplier, MultiplyDivide, NavigableActorGraphTableau, NavigableEffigy, NavigableEffigy.Factory, NavigableEffigy.FactoryWithoutNew, NCComponentBase, NCCompositeActor, NodeRandomizer, Noise, Noise, NondeterministicMerge, NondeterministicMerge.ChannelActor, NonInterruptibleTimer, NonStrictDelay, NonStrictDisplay, NonStrictLogicFunction, NonStrictTest, NonStrictThreeBitAdder, Occupants, Or, OrderedMerge, OrderedMerge, OrderedRecordAssembler, OutputModel, Pattern, PeriodicSampler, PetriNetActor, PhaseUnwrap, PhaseUnwrap, PID, Place, PlaySound, Plot, PlotEffigy, PlotEffigy.Factory, PlotTableau, Plotter, PlotterBase, PlotterBase.PlotWindowTableau, PoissonClock, PoissonClock, PolarToCartesian, PolarToComplex, PolyCylinder3D, PowerLossChannel, Pre, Previous, PrivateKeyReader, PSNR, PtalonActor, PtalonMatcher, PtalonMatcher.NestedPtalonActor, PteraController, PteraGraphTableau, PteraModalModel, PtinyOSCompositeActor, PtolemyEffigy, PtolemyEffigy.Factory, PtolemyEffigy.FactoryWithoutNew, PublicKeyReader, Publisher, PublisherNonStrictTest, PublisherTest, Pulse, Pulse, PythonScript, PythonShellEffigy, PythonShellEffigy.ShellFactory, PythonShellTableau, Quantizer, Queue, Queue, RaisedCosine, Ramp, Ramp, RandomSource, RandomSource, Reader, ReadModel, RealTimeComposite, RealTimePlotter, ReceiveInput, RecordAssembler, RecordDisassembler, Recorder, Recorder, RecordUpdater, Rectangle2D, RectangularFigure2D, RecursiveLattice, RecursiveLattice, ReduceWorker, Refinement, Refinement, Refinement, Region, Register, Register, RegisterSR, Remainder, RemoveNilTokens, Repeat, Replacement, Report, ResettableTimer, ResourcePool, ResourcePool, Rician, ROM, Room, Rotate2D, Rotate3D, Round, RunCompositeActor, RunTableau, SaltAndPepper, SampleDelay, Sampler, Sampler, Scale, Scale2D, Scale3D, Scrambler, SDFConverter, SDFTransformer, SecretKey, SecretKeyReader, Select, Select, Sequence, Sequence, SequencePlotter, Sequencer, Sequencer, SequenceScope, SequenceSource, SequenceToArray, SequenceToMatrix, SequentialClock, SequentialClock, SerialComm, Server, SetProperties, SetTableau, SetVariable, SharedQueue, SignatureActor, SignatureSigner, SignatureVerifier, Simulator, SingleEvent, SingleTokenCommutator, SingleTokenDistributor, SingleWindowConfiguration, SingleWindowHTMLViewerTableau, Sink, SketchedSource, Sleep, Sleep, Slice, Slicer, SliderSource, SMVLegacyCodeActor, SoundActor, SoundPlayer, Source, Sphere3D, SplitReader, SQLStatement, Starver, State, State, StateMatcher, Stop, 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, Tableau, TclShellEffigy, TclShellEffigy.ShellFactory, TclShellTableau, TDLActor, TDLController, TDLMode, TDLModule, TDLRefinement, TDLTask, TerrainProperty, Test, Test, TestActorPortDepth, TestExceptionHandler, TextEditorTableau, TextEffigy, TextEffigy.Factory, TextString3D, ThreadedComposite, ThresholdMonitor, ThrowException, ThrowModelError, TimeCompare, TimedDelay, TimeDelay, TimedPlotter, TimedScope, TimedSource, TimeGap, Timer, TMCompositeFacade, TokenEffigy, TokenEffigy.Factory, TokenTableau, TokenToExpression, TopLevelCurrentTime, Torus3D, Transform, Transform.EmbeddedConfigurer, TransformationRule, Transformer, TransitionRefinement, TransitionRefinement, Translate2D, Translate3D, TransmitPropertyTransformer, TreeTableau, 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, View, ViewScreen2D, ViewScreen3D, VisualModelReference, ViterbiDecoder, VQDecode, WaitingTime, WallClockTime, WelcomeWindowTableau, When, Wire, Wire, WiredToWireless, WirelessComposite, WirelessToWired, WriteModel, Writer, XMLInclusion, XSLTransformer, XYPlotter, XYScope, ZeroCrossingDetector, ZeroOrderHold, ZeroOrderHold
public interface Instantiable
- extends Derivable
This interface is for objects that can be instantiated. Such objects serve a
role similar to "classes" in Java and other object oriented languages.
They are Ptolemy II objects, but whose purpose is to serve as
a factory for instances that are (deep) clones of themselves. Normally,
they play no role in the execution of a model, and their ports cannot
be connected to other ports.
An object that implements this interface can be in one of two states.
Either it is a class definition (isClassDefinition()
returns true)
or it is not. Only objects that are class definitions can be instantiated.
Instantiation is done via the instantiate(NamedObj, String)
method. If an object
is instantiated from this object, then the new object is called the "child"
and this object is called the "parent." An instance of Instantiable can have
at most one parent (returned by the getParent()
method), but it
can have many children (returned by the getChildren()
method).
An object may be both a child and a parent.
A child is required to be a deep clone of its parent. That is, every
object deeply contained by the parent must have a corresponding object
deeply contained by the child. The object that is deeply contained
by the parent is called the "prototype" and the object deeply contained
by the child is called the "derived" object. A derived object has the
same name relative to the child as the prototype has relative to the
parent. Moreover, a derived object is an instance of the same Java
class as the prototype.
This correspondence between a parent and child is called the
"derivation invariant." Any correct implementation of this interface
must ensure that the derivation invariant is always satisfied, even
if the parent changes after the child was instantiated. If new objects
are added to the parent, then derived objects must be added to the
child.
- Since:
- Ptolemy II 4.0
- Version:
- $Id: Instantiable.java 57040 2010-01-27 20:52:32Z cxh $
- Author:
- Edward A. Lee
- Accepted Rating:
- Proposed Rating:
Method Summary |
java.util.List |
getChildren()
Return a list of weak references to instances of Instantiable
that are children of this object. |
Instantiable |
getParent()
Return the parent of this object, or null if there is none. |
Instantiable |
instantiate(NamedObj container,
java.lang.String name)
Create an instance by (deeply) cloning this object and then adjusting
the parent-child relationships between the clone and its parent. |
boolean |
isClassDefinition()
Return true if this object is a class definition, which means that
it can be instantiated. |
getChildren
java.util.List getChildren()
- Return a list of weak references to instances of Instantiable
that are children of this object. An implementor of this method
may return null or an empty list to indicate that there are
no children.
- Returns:
- An unmodifiable list of instances of
java.lang.ref.WeakReference that refer to
instances of Instantiable or null if this object
has no children.
getParent
Instantiable getParent()
- Return the parent of this object, or null if there is none.
- Returns:
- The parent of this object, or null if there is none.
instantiate
Instantiable instantiate(NamedObj container,
java.lang.String name)
throws java.lang.CloneNotSupportedException,
IllegalActionException,
NameDuplicationException
- Create an instance by (deeply) cloning this object and then adjusting
the parent-child relationships between the clone and its parent.
Specifically, the clone defers its definition to this object,
which becomes its "parent." The "child" inherits all the objects
contained by this object. If this object is a composite, then this
method must adjust any parent-child relationships that are entirely
contained within the child. That is, for any parent-child relationship
that is entirely contained within this object (i.e., both the parent
and the child are deeply contained by this object), a corresponding
parent-child relationship is created within the clone such that
both the parent and the child are entirely contained within
the clone.
The new object is not a class definition by default (it is an
"instance" rather than a "class"). That is, isClassDefinition()
returns false.
- Parameters:
container
- The container for the instance, or null
to instantiate it at the top level.name
- The name for the instance.
- Returns:
- A new instance that is a clone of this object
with adjusted deferral relationships.
- Throws:
java.lang.CloneNotSupportedException
- If this object
cannot be cloned.
IllegalActionException
- If this object is not a
class definition or the proposed container is not acceptable.
NameDuplicationException
- If the name collides with
an object already in the container.
isClassDefinition
boolean isClassDefinition()
- Return true if this object is a class definition, which means that
it can be instantiated.
- Returns:
- True if this object is a class definition.