ptolemy.moml.filter
Class NamedObjClassesSeen

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

public class NamedObjClassesSeen
extends java.lang.Object
implements MoMLFilter

Create a Set of classes that extend NamedObj that are in the MoML parsed thus far. This filter does not modify the model.

Since:
Ptolemy II 5.2
Version:
$Id: NamedObjClassesSeen.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Christopher Brooks, Edward A. Lee
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Field Summary
private  java.util.Set _classesSeen
          Set of classes seen the far.
private  java.util.HashMap _classesToBeIndexed
          A HashMap, where the key is a fully qualified dot separated String naming the class; and the key is a Set where each element is a String that is a relative path that refres to the model.
(package private)  java.lang.String _modelPath
          The relative path to the model we are parsing.
private static java.lang.Class _namedObjClass
           
 
Constructor Summary
NamedObjClassesSeen(java.util.HashMap classesToBeIndexed)
          Create a filter that looks for classes that extend NamedObj.
 
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 the attributeValue extends NamedObj, then add the attributeValue to the set of classes we are interested in.
 void filterEndElement(NamedObj container, java.lang.String elementName, java.lang.StringBuffer currentCharData, java.lang.String xmlFile)
          In this class, do nothing.
 void reset(java.lang.String modelPath)
          Reset the filter.
 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

_classesSeen

private java.util.Set _classesSeen
Set of classes seen the far. Each element is a String that is a dot separated fully qualified class name.


_classesToBeIndexed

private java.util.HashMap _classesToBeIndexed
A HashMap, where the key is a fully qualified dot separated String naming the class; and the key is a Set where each element is a String that is a relative path that refres to the model.


_modelPath

java.lang.String _modelPath
The relative path to the model we are parsing.


_namedObjClass

private static java.lang.Class _namedObjClass
Constructor Detail

NamedObjClassesSeen

public NamedObjClassesSeen(java.util.HashMap classesToBeIndexed)
Create a filter that looks for classes that extend NamedObj.

Parameters:
classesToBeIndexed - A HashMap, where the key is a fully qualified dot separated String naming the class; and the key is a Set where each element is a String that is a relative path that refres to the model.
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 the attributeValue extends NamedObj, then add the attributeValue to the set of classes we are interested in.

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
In this class, do nothing.

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 - Not thrown in this base class.

reset

public void reset(java.lang.String modelPath)
Reset the filter.

Parameters:
modelPath - The new model path.

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.