ptolemy.moml
Interface MoMLFilter

All Known Implementing Classes:
AddEditorFactory, AddIcon, ClassChanges, HideAnnotationNames, MultiportToSinglePort, ParameterNameChanges, PortClassChanges, PortNameChanges, PropertyClassChanges, RemoveEmptyProperties, RemoveGraphicalClasses

public interface MoMLFilter

This class filters MoML (modeling markup language) identifiers. It can be used to

  • Remove graphical classes for use in a non-graphical environment
  • Change the names of actors and ports for backward compatibility.

    Since:
    Ptolemy II 2.0
    Version:
    $Id: MoMLFilter.java,v 1.16 2004/04/13 03:46:48 cxh Exp $
    Author:
    Christopher Hylands, Edward A. Lee
    Accepted Rating:
    Red (cxh)
    Proposed Rating:
    Red (cxh)

    Method Summary
     java.lang.String filterAttributeValue(NamedObj container, java.lang.String attributeName, java.lang.String attributeValue)
              Given the container, attribute name and attribute value, return a new attribute value.
     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.
     

    Method Detail

    filterAttributeValue

    public java.lang.String filterAttributeValue(NamedObj container,
                                                 java.lang.String attributeName,
                                                 java.lang.String attributeValue)
    Given the container, attribute name and attribute value, return a new attribute value. Usually, the attribute value returned is the same as the attribute value passed in. However, it is possible to return a different attribute value, which results in renaming the attribute; or it is possible to return null, which will cause MoMLParser.attribute() to skip the rest of the current element.

    If this method is going to return a different attribute name, then it should call MoMLParser.setModified(true) which indicates that the model was modified so that the user can optionally save the modified model.

    Parameters:
    container - The container for this attribute, ignored in this method.
    attributeName - The name of the attribute, ignored in this method.
    attributeValue - The value of the attribute.
    Returns:
    the filtered attributeValue or null if we are to skip the current attribute.

    filterEndElement

    public java.lang.String filterEndElement(NamedObj container,
                                             java.lang.String elementName)
                                      throws java.lang.Exception
    Given the elementName, perform any filter operations that are appropriate for the MOMLParser.endElement() method.

    If this method is going to return a different attribute name, then it should call MoMLParser.setModified(true) which indicates that the model was modified so that the user can optionally save the modified model.

    Parameters:
    container - The container for this attribute. in this method.
    elementName - The element type name.
    Returns:
    the filtered element name, or null if MoMLParser.endElement() should immediately return.
    Throws:
    java.lang.Exception

    toString

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

    Returns:
    the description of the filter that ends with a new line.