Class MultiportToSinglePort
- java.lang.Object
-
- ptolemy.moml.filter.MoMLFilterSimple
-
- ptolemy.moml.filter.MultiportToSinglePort
-
- All Implemented Interfaces:
MoMLFilter
public class MultiportToSinglePort extends MoMLFilterSimple
A filter to convert specific multiports of specific actors to a single ports.When this class is registered with the MoMLParser.setMoMLFilter() method, it will cause will cause MoMLParser to filter so that models from earlier releases will run in the current release.
The Autocorrelation actor changed between PtolemyII 2.x and 3.x such that the output port is no longer a multiport.
// Autocorrelation _actorsWithMultiPortToSinglePortChanges .put("ptolemy.actor.lib.Autocorrelation, "output")
The _actorsWithMultiPortToSinglePortChanges HashMap contains Strings that name classes such as Autocorrelation that have multiports that should be single ports. The HashMap maps classnames to port names.
Conceptually, how the code works is that when we see a class while parsing, we check to see if the class is in _actorsWithMultiPortToSinglePortChanges. If the class was present in the HashMap, then as we go through the code, we look for the named port and remove the multiport declaration
- Since:
- Ptolemy II 4.0
- Version:
- $Id$
- Author:
- Christopher Hylands Brooks, Contributor: Edward A. Lee
- Pt.AcceptedRating:
- Red (cxh)
- Pt.ProposedRating:
- Red (cxh)
-
-
Constructor Summary
Constructors Constructor Description MultiportToSinglePort()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
filterAttributeValue(NamedObj container, java.lang.String element, java.lang.String attributeName, java.lang.String attributeValue, java.lang.String xmlFile)
If the attributeName is "class" and attributeValue names a class that has had its port names changed between releases, then substitute in the new port names.void
filterEndElement(NamedObj container, java.lang.String elementName, java.lang.StringBuffer currentCharData, java.lang.String xmlFile)
In this class, do nothing.java.lang.String
toString()
Return a string that describes what the filter does.-
Methods inherited from class ptolemy.moml.filter.MoMLFilterSimple
filterAttributeValue, filterEndElement
-
-
-
-
Method Detail
-
filterAttributeValue
public java.lang.String filterAttributeValue(NamedObj container, java.lang.String element, java.lang.String attributeName, java.lang.String attributeValue, java.lang.String xmlFile)
If the attributeName is "class" and attributeValue names a class that has had its port names changed between releases, then substitute in the new port names.- Parameters:
container
- The container for this attribute. in this method.element
- The XML element name.attributeName
- The name of the attribute.attributeValue
- The value of the attribute.xmlFile
- The file currently being parsed.- Returns:
- the value of the attributeValue argument.
-
filterEndElement
public void filterEndElement(NamedObj container, java.lang.String elementName, java.lang.StringBuffer currentCharData, java.lang.String xmlFile) throws java.lang.Exception
In this class, do nothing.- Parameters:
container
- The object created by this element.elementName
- The element name.currentCharData
- The character data, which appears only in the doc and configure elementsxmlFile
- The file currently being parsed.- Throws:
java.lang.Exception
- Not thrown in this base class.
-
toString
public java.lang.String toString()
Return a string that describes what the filter does.- Specified by:
toString
in interfaceMoMLFilter
- Overrides:
toString
in classjava.lang.Object
- Returns:
- the description of the filter that ends with a newline.
-
-