|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectptolemy.moml.filter.PropertyClassChanges
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 properties where the class name has changed.
For example, after Ptolemy II 2.0.1, the Expression actor changed in such a way that the expression property changed from being a Parameter to being a StringAttribute. To add this change to this filter, we add a code to the static section at the bottom of the file.
// Expression: After 2.0.1, expression
// property is now a StringAttribute
HashMap expressionClassChanges = new HashMap();
// Key = property name, Value = new class name
expressionClassChanges.put("expression",
"ptolemy.kernel.util.StringAttribute");
The expressionClassChange HashMap maps property names to the new
classname
_actorsWithPropertyClassChanges
.put("ptolemy.actor.lib.Expression",
expressionClassChanges);
The _actorsWithPropertyClassChanges HashMap contains all the classes
such as Expression that have changes and each class has a map
of the property 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 _actorsWithPropertyClassChanges. 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.
| Red (cxh) |
| Red (cxh) |
| Constructor Summary | |
PropertyClassChanges()
|
|
| Method Summary | |
java.lang.String |
filterAttributeValue(NamedObj container,
java.lang.String attributeName,
java.lang.String attributeValue)
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. |
java.lang.String |
filterEndElement(NamedObj container,
java.lang.String elementName)
Given the elementName, perform any filter operations that are appropriate for the MOMLParser.endElement() method. |
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 |
| Constructor Detail |
public PropertyClassChanges()
| Method Detail |
public java.lang.String filterAttributeValue(NamedObj container,
java.lang.String attributeName,
java.lang.String attributeValue)
filterAttributeValue in interface MoMLFiltercontainer - The container for this attribute.
in this method.attributeName - The name of the attribute.attributeValue - The value of the attribute.
public java.lang.String filterEndElement(NamedObj container,
java.lang.String elementName)
throws java.lang.Exception
filterEndElement in interface MoMLFiltercontainer - The container for this attribute.
in this method.elementName - The element type name.
java.lang.Exceptionpublic java.lang.String toString()
toString in interface MoMLFilter
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||