ptolemy.moml.filter
Class PortClassChanges

java.lang.Object
  extended by ptolemy.moml.filter.PortClassChanges
All Implemented Interfaces:
MoMLFilter

public class PortClassChanges
extends java.lang.Object
implements MoMLFilter

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 actors that have had port class changes.

Since:
Ptolemy II 4.0
Version:
$Id: PortClassChanges.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Haiyang Zheng
Accepted Rating:
Red (hyzheng)
Proposed Rating:
Red (hyzheng)

Field Summary
private static java.util.HashMap _actorsWithPortClassChanges
           
private  java.util.HashMap _classMap
           
private  boolean _currentlyProcessingActorWithPortClassChanges
           
private  boolean _foundPort
           
private  java.lang.String _lastNameSeen
           
private  java.util.HashMap _portMap
           
private  java.lang.String _portName
           
 
Constructor Summary
PortClassChanges()
           
 
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 its port classes changed between releases, then substitute in the new port classes.
 void filterEndElement(NamedObj container, java.lang.String elementName, java.lang.StringBuffer currentCharData, java.lang.String xmlFile)
          Reset private variables.
 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

_actorsWithPortClassChanges

private static java.util.HashMap _actorsWithPortClassChanges

_classMap

private java.util.HashMap _classMap

_currentlyProcessingActorWithPortClassChanges

private boolean _currentlyProcessingActorWithPortClassChanges

_foundPort

private boolean _foundPort

_lastNameSeen

private java.lang.String _lastNameSeen

_portMap

private java.util.HashMap _portMap

_portName

private java.lang.String _portName
Constructor Detail

PortClassChanges

public PortClassChanges()
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 classes changed between releases, then substitute in the new port classes.

Specified by:
filterAttributeValue in interface MoMLFilter
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
Reset private variables.

Specified by:
filterEndElement in interface MoMLFilter
Parameters:
container - The object created by this element.
elementName - The element name.
currentCharData - The character data, which appears only in the doc and configure elements
xmlFile - The file currently being parsed.
Throws:
java.lang.Exception - if there is a problem substituting in the new value.

toString

public java.lang.String toString()
Return a string that describes what the filter does.

Specified by:
toString in interface MoMLFilter
Overrides:
toString in class java.lang.Object
Returns:
the description of the filter that ends with a newline.