@NonNull
    public String addVariable(@Nullable final String var, @Nullable final String formula, final int ppos) {
        int pos = Math.min(variableList.size(), Math.max(0, ppos));
        final String varname = var == null ? variableMap.createNonContainedKey("" + INVISIBLE_VAR_PREFIX) : var;
        if (variablesSet.containsKey(varname)) {
            final int removeIdx = removeVariable(varname);

            if (removeIdx >= 0 && removeIdx < pos) {
                pos--;
            }
        }
        variableMap.put(varname, formula);
        variableList.add(pos, varname);
        variablesSet.put(varname, null);
        wasModified = true;
        return varname;
    }
puts a new variable into the cache. If same var already exists it is overridden.
If varname given is 'null', a nonvisible var name (starting with NONVISIBLE_PREFIX) is created and returned
main/src/main/java/cgeo/geocaching/utils/formulas/VariableList.java