/** * 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(); } }
/** @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; }