|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ptolemy.moml.filter.ParameterNameChanges
public class ParameterNameChanges
When this class is registered with the MoMLParser.setMoMLFilter() method, it will cause MoMLParser to filter so that models from earlier releases will run in the current release.
This class will filter for classes with Parameters where the parameter name has changed.
For example, after Ptolemy II 2.2, the PNDirector changed in such a way that the 'Initial_queue_capacity' parameter is now 'initialQueueCapacity'.
To add this change to this filter, we add a code to the static section at the bottom of the file.
// PNDirectory: After 2.2, 'Initial_queue_capacity' // property is now 'initialQueueCapacity' HashMap pnDirectorChanges = new HashMap(); // Key = property name, Value = new class name pnDirectorChanges.put("Initial_queue_capacity", "initialQueueCapacity");The pnDirectorChange HashMap maps property names to the new name
_classesWithParameterNameChanges .put("ptolemy.domains.pn.PNDirectory", pnDirectorChanges);The _classesWithParameterNameChanges HashMap contains all the classes such as PNDirector that have changes and each class has a map of the Parameter changes that are to be made.
Conceptually, how the code works is that when we see a class while parsing, we check to see if the class is in _classesWithParameterNameChanges. If the class was present in the HashMap, then as we go through the code, we look for property names that need to have their classes changed.
NOTE: This class and PortNameChange might conflict if a port and parameter have the same name.
Red (cxh) |
Red (cxh) |
Field Summary | |
---|---|
private static java.util.HashMap |
_classesWithParameterNameChanges
|
private java.lang.String |
_currentActorFullName
|
private boolean |
_currentlyProcessingActorWithParameterNameChanges
|
private java.lang.String |
_lastNameSeen
|
private java.lang.String |
_newName
|
private static java.util.HashMap |
_propertyMap
|
Constructor Summary | |
---|---|
ParameterNameChanges()
|
Method Summary | |
---|---|
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 a Parameter names changed between releases, then substitute in the new Parameter 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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static java.util.HashMap _classesWithParameterNameChanges
private java.lang.String _currentActorFullName
private boolean _currentlyProcessingActorWithParameterNameChanges
private java.lang.String _lastNameSeen
private java.lang.String _newName
private static java.util.HashMap _propertyMap
Constructor Detail |
---|
public ParameterNameChanges()
Method Detail |
---|
public java.lang.String filterAttributeValue(NamedObj container, java.lang.String element, java.lang.String attributeName, java.lang.String attributeValue, java.lang.String xmlFile)
filterAttributeValue
in interface MoMLFilter
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.
public void filterEndElement(NamedObj container, java.lang.String elementName, java.lang.StringBuffer currentCharData, java.lang.String xmlFile) throws java.lang.Exception
filterEndElement
in interface MoMLFilter
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.
java.lang.Exception
- Not thrown in this base class.public java.lang.String toString()
toString
in interface MoMLFilter
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |