DragMath Documentation - Adding a function/operator

## Adding a function/operator

The code can be easily modified and recompiled to add additional operators and functions.

However, they must adhere to the standard display layout shown below:

Operator:

Function:

The steps to adding one:

1. A new element in the CompConfig.xml, which is located in the Display package. The element must be given a unique name as the name of the object. A unique ID number, by simply choosing the next available ID number. A group number as follows:
   N-ary operator - 1
   Binary Operator - 2
   Function - 3
   The name of the GIF file that holds a transparent image of the object, of size 16x16, 24x24 or 32x32 pixels.
   The text of the element should hold the characters that represent the object.
2. A new JButton placed on one of the tabs, in the MainApplet.java file. This button can have Text or an Icon to inform the user what it is. The JButton must have the name field set to 'ID-Name' e.g. for Addition this is '2-Add'.
3. A new element in the language file you intend to use, with the same element name as in the CompConfig.xml file. The text of the element should be a description of the object for use in the status bar of the program.
4. The array ‘inputComponents’ should be initialised to the size of the highest ID number now in CompConfig.xml. This line of code is found near the start of the init() method in the MainApplet.java file, in the Display package.
5. The Precedence.java file in the Tree package should be adjusted, so the ‘value’ array is initialised to the size of the highest ID number now in CompConfig.xml, and the precedence of the new object should be set if required.
6. An entry in each format XML file will be required for the new object. For details on how to do this see here.