/** @return the type of this variable */
 @Override
 public String getType() {
   if (value == null) {
     return "undefined";
   }
   return value.getType();
 }
 /**
  * Return the text which is used to build a text program from a program tree
  *
  * @return
  */
 public String getExpertProgramDecl() {
   if (value == null) {
     return "{ type: " + this.getType() + ", id: " + this.id + "}";
   } else {
     return value.getJSONDescription().toString();
   }
 }
  @Override
  public String getTypeSpec() {
    if (isUndefined()) {
      return "var -> " + this.id + " (UNDEF)";

    } else {
      return "var " + this.id + "[" + getType() + "]: " + value.toString();
    }
  }
 @Override
 public String getValue() {
   if (isUndefined()) {
     LOGGER.error("trying to access a non defined variable");
     return null;
   }
   if (!isVar()) {
     return value.getValue();
   }
   LOGGER.trace("We found a reference");
   String varName = value.getValue();
   NodeVariableDefinition element = getVariableByName(varName);
   if (element == null) {
     LOGGER.error("Var not found");
     return null;
   }
   if (element.value.getValue().equals(varName)) {
     LOGGER.error("Found a circular reference");
   }
   return element.getValue();
 }
  /** @return the json description of the variable */
  @Override
  public JSONObject getJSONDescription() {
    JSONObject o = super.getJSONDescription();
    try {
      o.put("type", "variableDefinition");
      o.put("var_name", id);
      if (!isUndefined()) {
        o.put("value", value.getJSONDescription());
      }

    } catch (JSONException ex) {
      // Do nothing since 'JSONObject.put(key,val)' would raise an exception
      // only if the key is null, which will never be the case
    }
    return o;
  }