cox.jmatt.java.MathTools.util
Interface MathToolsAccessory


public interface MathToolsAccessory

This is a generic interface for a MathTools accessory class. A MathToolsAccessory is an add-on or plugin class usable from within the MathTools packages. CapCom has methods for creating accessories, reflected in MathEngine. Exactly what these classes are depends on what they are. That is to say this interface, much like GraphKeys, provides a way to generically instantiate and make available classes completely outside the MathTools packages.

Accessories are created via CapCom.createAccessory and require the fully-qualified class name. The Math ClassLoader is used automatically and transparently so the accessory class MUST be visible to it. MathEngine access means that any script, even one from MTApplet, so the accessory must be written accordingly. Accessories can be globally disabled (default) or enabled via the CapCom.allowAccessories field but this is all or nothing. ScriptPanel automatically enables them but custom applications using MathTools must do this manually.

So why not just use The Shelf?

Accessories provide a way to 'pull in' arbitrary classes without requiring an entire re-write of ScriptPanel or a totally new custom application just to include one or two extra classes. That's not to say it can't be done, just that it doesn't have to be done. The Shelf is specifically for use with custom MathTools-using Java applications. Accessories simply provide a simpler route.

Other Requirements

Other than implementing this interface an accessory only needs a zero-argument constructor. CapCom creates accessories using the Class.newInstance() method so no parameters are passed in. There is also no intiialization performed other than that, so construction must handle any such.


Method Summary
 java.lang.Object processCommand(java.lang.String pCommand, java.lang.Object... pArgs)
          This is the only method mandated by this interface.
 

Method Detail

processCommand

java.lang.Object processCommand(java.lang.String pCommand,
                                java.lang.Object... pArgs)

This is the only method mandated by this interface. Much like the MathPrinter processMathObject() method this one makes no requirement other than existence. It is as broad and general as possible to allow for maximum flexibiity in scripting or Java applications where only the interface methods are available.

The String command key should be used to select what actions are performed and the results of those actions should be well-documented. The Object... argument, if used, should also be well-explained as should the return values to expect.

Parameters:
pCommand - The String command to process.
pArgs - The arguments required for processing.
Returns:
Whatever is appropriate or necessary.