03.08.2013 Views

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

PTOLEMY II - CiteSeerX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

MoML<br />

model.<br />

The EntityLibrary class takes particular advantage of MoML. This class extends CompositeEntity,<br />

and is designed to contain a library of entities. But it is carefully designed to avoid instantiating those<br />

entities until there is some request for them. Instead, it maintains a MoML representation of the library.<br />

This allows for arbitrarily large libraries without the overhead of instantiating components in the<br />

library that might not be needed.<br />

Incremental parsing is when a MoML parser is used to modify a pre-existing model (see section<br />

7.4). A MoML parser that was used to create the pre-existing model can be used to modify it. If there is<br />

no such parser, then it is necessary to call the setToplevel() method of MoMLParser to associate<br />

the parser with the pre-existing model.<br />

Incremental parsing should (usually) be done using a change request. A change request is an active<br />

object that makes a modification to a Ptolemy model. They are queued with a composite entity con-<br />

com.microstar.xml.HanderBase<br />

+attribute(name : String, value : String, isSpecified : boolean)<br />

+charData(data : char[], start : int, length : int)<br />

+doctypeDecl(name : String, publicID : String, systemID : String)<br />

+endDocument()<br />

+endElement(name : String)<br />

+endExternalEntity(systemID : String)<br />

+error(message : String, systemID : String, line : int, column : int)<br />

+ignorableWhitespace(data : char[], start : int, length : int)<br />

+processingInstruction(target : String, data : String)<br />

+resolveEntity(publicID : String, systemID : String)<br />

+startDocument()<br />

+startElement(name : String)<br />

+startExternalEntity(systemID : String)<br />

com.microstar.xml.XmlParser<br />

CompositeEntity<br />

EntityLibrary<br />

Configurable<br />

uses<br />

1..1<br />

0..n<br />

uses<br />

-_parser : MoMLParser<br />

+EntityLibrary()<br />

+EntityLibrary(workspace : Workspace)<br />

+EntityLibrary(container : CompositeEntity, name : String)<br />

+populate()<br />

+MoML_DTD_1 : String<br />

-_base : URL<br />

-_current : Object<br />

-_currentElement : String<br />

-_handler : ErrorHandler<br />

-_manager : Manager<br />

-_panel : Container<br />

-_parser : XmlParser<br />

-_toplevel : NamedObj<br />

-_workspace : Workspace<br />

FIGURE 7.9. Classes supporting MoML parsing in the moml package.<br />

1..1<br />

0..n<br />

MoMLParser<br />

MoMLChangeRequest<br />

«Interface»<br />

ErrorHandler<br />

+CANCEL : int<br />

+CONTINUE : int<br />

+RETHROW : int<br />

+enableErrorSkipping(enable : boolean)<br />

+handleError(element : String, context : NamedObj, exception : Exception)<br />

ChangeRequest<br />

+execute()<br />

-_base : URL<br />

-_context : NamedObj<br />

-_parser : MoMLParser<br />

-_propagating : boolean<br />

+MoMLChangeRequest(originator : Object, request : String)<br />

+MoMLChangeRequest(originator : Object, context : NamedObj, request : String)<br />

+MoMLChangeRequest(originator : Object, context : NamedObj, request : String, base : URL)<br />

+getDeferredToParent(object : NamedObj) : NamedObj<br />

Heterogeneous Concurrent Modeling and Design 219<br />

0..1<br />

+MoMLParser()<br />

+MoMLParser(w : Workspace)<br />

+MoMLParser(w : Workspace, loader : ClassLoader)<br />

+getTopLevel() : NamedObj<br />

+isModified() : boolean<br />

+parse(base : URL, input : URL)<br />

+parse(base : URL, input : InputStream) : NamedObj<br />

+parse(base : URL, reader : Reader) : NamedObj<br />

+parse(input : String) : NamedObj<br />

+parse(base : URL, text : String)<br />

+parseFile(filename : String)<br />

+reset()<br />

+searchForClass(name : String, source : String) : ComponentEntity<br />

+setContext(context : NamedObj)<br />

+setErrorHandler(handler : ErrorHandler)<br />

+setModified(modified : boolean)<br />

+setToplevel(toplevel : NamedObj)<br />

#_currentExternalEntity() : String<br />

StreamErrorHandler<br />

+StreamErrorHandler()<br />

+StreamErrorHandler(out : OutputStream)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!