[kepler-dev] Ports in Kepler (XML)
Christopher Brooks
cxh at eecs.berkeley.edu
Wed Apr 14 08:28:26 PDT 2010
Hi Ivens,
The MoML representation does include information about whether a
port is an input or an output. To get that information, you need
to consult the definition of the object that has the port.
The reason is that the object that has the port may change at run time.
An entity that has ports may be a Java class, an actor oriented class
or another CompositeEntity that is defined elsewhere using MoML.
At runtime, the ports of the entity may change, so we need to
look at the instance of the entity and see what the ports actually are.
That said, we could, in theory, create a preparsed representation
of a model that included all the information, including port input/output
status and type information. However, we have no plans to that
at this time.
If you want to get port information, then try parsing the MoML, then
getting all the atomic entities and checking their ports.
See the main() method of
ptolemy/moml/filter/RemoveGraphicalClasses.java
for how to load a MoML file and remove the graphical classes.
RemoveGraphicalClasses contains:
NamedObj topLevel = parser.parseFile(args[0]);
If you cast that to a CompositeEntity, then you can call CompositeEntity.deepGetEntities(),
iterate over the entities and get their ports
See the other deep* methods:
bash-3.2$ grep deep ~/ptII/ptolemy/kernel/*.java | grep public
/Users/cxh/ptII/ptolemy/kernel/ComponentPort.java: public List deepConnectedPortList() {
/Users/cxh/ptII/ptolemy/kernel/ComponentPort.java: public Enumeration deepConnectedPorts() {
/Users/cxh/ptII/ptolemy/kernel/ComponentPort.java: public List deepInsidePortList() {
/Users/cxh/ptII/ptolemy/kernel/ComponentPort.java: public Enumeration deepInsidePorts() {
/Users/cxh/ptII/ptolemy/kernel/ComponentRelation.java: public List deepLinkedPortList() {
/Users/cxh/ptII/ptolemy/kernel/ComponentRelation.java: public Enumeration deepLinkedPorts() {
/Users/cxh/ptII/ptolemy/kernel/CompositeEntity.java: public List deepOpaqueEntityList() {
/Users/cxh/ptII/ptolemy/kernel/CompositeEntity.java: public List deepEntityList() {
/Users/cxh/ptII/ptolemy/kernel/CompositeEntity.java: public Set<ComponentRelation> deepRelationSet() {
/Users/cxh/ptII/ptolemy/kernel/CompositeEntity.java: public Enumeration deepGetEntities() {
See also Chapter 7 of
http://www.eecs.berkeley.edu/Pubs/TechRpts/2008/EECS-2008-28.html
See also the kernel chapter of the above.
_Christopher
On 4/14/10 7:49 AM, Ivens wrote:
> Hi,
>
> I would like to know if there is a way to discover if an Actor's Port is
> an input or output port just by looking the XML file generated by kepler.
>
> Thanks,
> Ivens
>
>
>
> _______________________________________________
> Kepler-dev mailing list
> Kepler-dev at kepler-project.org
> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-dev
--
Christopher Brooks, PMP University of California
CHESS Executive Director US Mail: 337 Cory Hall
Programmer/Analyst CHESS/Ptolemy/Trust Berkeley, CA 94720-1774
ph: 510.643.9841 fax:510.642.2718 (Office: 545Q Cory)
home: (F-Tu) 707.665.0131 cell: 707.332.0670
More information about the Kepler-dev
mailing list