Class ChangeFixedWidth1ToAuto

  • All Implemented Interfaces:
    MoMLFilter

    public class ChangeFixedWidth1ToAuto
    extends MoMLFilterSimple
    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 relations that have a fixed width of 1. The width value will be changed to AUto, which is the new default for width inference.
    Since:
    Ptolemy II 8.0
    Version:
    $Id$
    Author:
    Bert Rodiers
    Pt.AcceptedRating:
    Red (rodiers)
    Pt.ProposedRating:
    Red (rodiers)
    • Method Summary

      All Methods Static 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)
      This method doesn't do anything.
      void filterEndElement​(NamedObj container, java.lang.String elementName, java.lang.StringBuffer currentCharData, java.lang.String xmlFile)
      Filter relations widths and change 1 to "Auto" and make sure still value is not not stored (if not changed).
      static void main​(java.lang.String[] args)
      Main function.
      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

      • ChangeFixedWidth1ToAuto

        public ChangeFixedWidth1ToAuto()
    • 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)
        This method doesn't do anything.
        Parameters:
        container - The container for XML element.
        element - The XML element name.
        attributeName - The name of the attribute.
        attributeValue - The value of the attribute.
        xmlFile - The file currently being parsed.
        Returns:
        A new value for the attribute, or the same value to leave it unchanged, or null to cause the current element to be ignored (unless the attributeValue argument is null).
      • filterEndElement

        public void filterEndElement​(NamedObj container,
                                     java.lang.String elementName,
                                     java.lang.StringBuffer currentCharData,
                                     java.lang.String xmlFile)
                              throws java.lang.Exception
        Filter relations widths and change 1 to "Auto" and make sure still value is not not stored (if not changed).
        Parameters:
        container - The object defined by the element that this is the end of.
        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 modifying the specified container.
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Main function. Changes fixed relation width equal to 1 to "Auto" and save the model. The resulting width won't be saved in practice.
        Parameters:
        args - The arguments of the main function.
        Throws:
        java.lang.Exception - If the model can't be converted.
      • 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:
        A description of the filter (ending with a newline).