public class RemoveGraphicalClasses extends MoMLFilterSimple
This is very useful for running applets with out requiring files like diva.jar to be downloaded. It is also used by the nightly build to run tests when there is no graphical display present.
Red (cxh) |
Red (cxh) |
Constructor and Description |
---|
RemoveGraphicalClasses()
Construct a filter that removes graphical classes.
|
Modifier and Type | Method and Description |
---|---|
static void |
clear()
Clear the map of graphical classes to be removed.
|
java.lang.String |
filterAttributeValue(NamedObj container,
java.lang.String element,
java.lang.String attributeName,
java.lang.String attributeValue,
java.lang.String xmlFile)
Filter for graphical classes and return new values if
a graphical class is found.
|
void |
filterEndElement(NamedObj container,
java.lang.String elementName,
java.lang.StringBuffer currentCharData,
java.lang.String xmlFile)
In this class, do nothing.
|
static void |
initialize()
Initialize the set of classes to remove.
|
static void |
main(java.lang.String[] args)
Read in a MoML file, remove graphical classes and
write the results to standard out.
|
void |
put(java.lang.String className,
java.lang.String replacement)
Add a class to be filtered for and its replacement if the class
is found.
|
void |
remove(java.lang.String className)
Remove a class to be filtered.
|
void |
setRemoveGR(boolean removeGR)
Set to true if we should removed classes that start with
ptolemy.domains.gr.
|
java.lang.String |
toString()
Return a string that describes what the filter does.
|
filterAttributeValue, filterEndElement
public RemoveGraphicalClasses()
public static void clear()
public java.lang.String filterAttributeValue(NamedObj container, java.lang.String element, java.lang.String attributeName, java.lang.String attributeValue, java.lang.String xmlFile)
container
- The container for this attribute, ignored
in this method.element
- The XML element name.attributeName
- The name of the attribute, ignored
in this method.attributeValue
- The value of the attribute.xmlFile
- The file currently being parsed.public void filterEndElement(NamedObj container, java.lang.String elementName, java.lang.StringBuffer currentCharData, java.lang.String xmlFile) throws java.lang.Exception
container
- The object created by this element.elementName
- The element name.currentCharData
- The character data, which appears
only in the doc and configure elementsxmlFile
- The file currently being parsed.java.lang.Exception
- Not thrown in this base class.public static void initialize()
public static void main(java.lang.String[] args) throws java.lang.Exception
For example, to remove the graphical classes from
a file called RemoveGraphicalClasses.xml
java -classpath "$PTII" ptolemy.moml.filter.RemoveGraphicalClasses test/RemoveGraphicalClasses.xml > output.xml
args
- An array of one string
java.lang.Exception
- If there is a problem reading or writing
a file.public void remove(java.lang.String className)
className
- The name of the class to be filtered
out, for example "ptolemy.copernicus.kernel.GeneratorAttribute".put(String, String)
public void put(java.lang.String className, java.lang.String replacement)
remove(String)
,
calling 'new RemoveGraphicalClasses' will not remove a class
that was added with this method.className
- The name of the class to be filtered
out, for example "ptolemy.copernicus.kernel.GeneratorAttribute".replacement
- The name of the class to be used if
className is found. If this argument is null then the
rest of the attribute is skipped.remove(String)
public void setRemoveGR(boolean removeGR)
removeGR
- True if we should remove classes that start
with ptolemy.domains.gr.public java.lang.String toString()
toString
in interface MoMLFilter
toString
in class java.lang.Object