edu.toronto.cs.util
Class StringMacroManager

java.lang.Object
  extended by edu.toronto.cs.util.StringMacroManager

public class StringMacroManager
extends java.lang.Object

This class does some macro expansion on Strings. It also can perform some macro compression, but at a very simple-minded level.


Constructor Summary
StringMacroManager()
          Constructs a new macro expander.
 
Method Summary
 java.lang.String compressMacro(java.lang.String text)
          Compresses all the macroes it can find in the text.
 void defineMacro(java.lang.String name, java.lang.String expansion)
          Defines a new macro.
 java.lang.String expandMacro(java.lang.String text)
          Expands all the macroes present in the text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringMacroManager

public StringMacroManager()
Constructs a new macro expander.

Method Detail

defineMacro

public void defineMacro(java.lang.String name,
                        java.lang.String expansion)
Defines a new macro. If a macro with such a name already exists it gets overwritten. (There is no support for defining macroes containing other macroes, i.e. it may or may not work)


expandMacro

public java.lang.String expandMacro(java.lang.String text)
Expands all the macroes present in the text.

Returns:
-- text WITHOUT marcoes

compressMacro

public java.lang.String compressMacro(java.lang.String text)
Compresses all the macroes it can find in the text.

Returns:
-- text WITH macroes (if any were found)