code: public void setVariable(String variableName, String variableValue, boolean isOptional)
              throws VariableNotDefinedException {
          int varNo = mtp.lookupVariableName(variableName);
          if (varNo == -1) {
              if (isOptional) {
                  return;
              }
              throw new VariableNotDefinedException(variableName);
          }
          varValuesTab[varNo] = variableValue;
      }
docs: Sets a template variable.
  <p>
  For variables that are used in blocks, the variable value must be set before <code>addBlock()</code> is called.
  
  @param variableName the name of the variable to be set. Case-insensitive.
  @param variableValue the new value of the variable. May be <code>null</code>.
  @param isOptional specifies whether an exception should be thrown when the variable does not exist in the
  template. If <code>isOptional</code> is <code>false</code> and the variable does not exist, an
  exception is thrown.
  @throws VariableNotDefinedException when no variable with the specified name exists in the template and
  <code>isOptional</code> is <code>false</code>.