mmp.engine
Class MacroRegistry

java.lang.Object
  extended by mmp.engine.MacroRegistry

public class MacroRegistry
extends java.lang.Object

The macroRegistry holds stacks of macros identified by name.

The macroRegistry is a container for builtin and user defined macros. The container for the active macros is organized as a collection of stacks of macros.
Builtin macros are furthermore stored in a second registry. If a builtin macro gets undefined, it can nevertheless by called by the 'builtin' macro.

Author:
Burkhardt Renz

Constructor Summary
MacroRegistry()
           
 
Method Summary
 Macro getBuiltin(java.lang.String name)
          Gets the builtin macro named 'name', even if it has been undefined.
 Macro getMacro(java.lang.String name)
          Get macro named 'name'.
 java.util.Set<java.lang.String> getMacroNames()
          Get the set of all names of currently defined macros.
 void popMacro(java.lang.String name)
          The macro named 'name' is popped from the stack of macros.
 void pushMacro(java.lang.String name, Macro macro)
          Pushes macro object on the top of an already defined macro with the same name.
 void registerMacro(java.lang.String name, Macro macro)
          Register macro object as macro 'name'.
 void unregisterMacro(java.lang.String name)
          The macro named 'name' is unregistered.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MacroRegistry

public MacroRegistry()
Method Detail

getBuiltin

public final Macro getBuiltin(java.lang.String name)
Gets the builtin macro named 'name', even if it has been undefined.

Parameters:
name - name of builtin to find
Returns:
builtin macro object

getMacro

public final Macro getMacro(java.lang.String name)
Get macro named 'name'. The result is the top macro if there are several definitions with the same name.

Parameters:
name - name of macro to be found.
Returns:
macro object, null if not found.

getMacroNames

public final java.util.Set<java.lang.String> getMacroNames()
Get the set of all names of currently defined macros.

Returns:
the set of names of macros.

popMacro

public final void popMacro(java.lang.String name)
The macro named 'name' is popped from the stack of macros.

Parameters:
name - name of the macro to be popped.

pushMacro

public final void pushMacro(java.lang.String name,
                            Macro macro)
Pushes macro object on the top of an already defined macro with the same name.
If there is no macro with the given name, the macro object is registered.

Parameters:
name - name of macro
macro - macro object

registerMacro

public final void registerMacro(java.lang.String name,
                                Macro macro)
Register macro object as macro 'name'.
If there is already a macro with this name, the top definition is replaced.

Parameters:
name - name of macro.
macro - macro object.

unregisterMacro

public final void unregisterMacro(java.lang.String name)
The macro named 'name' is unregistered. If there are several macros on the stack with this name, they are all deleted from the registry.

Parameters:
name - the name of the macro to unregister.