Пример #1
0
 /**
  * Builds and returns an Eval Conditional Element
  *
  * @param context The current build context
  * @param utils The current build utils instance
  * @param patternBuilder not used by EvalBuilder
  * @param descr The Eval Descriptor to build the eval conditional element from
  * @return the Eval Conditional Element
  */
 public RuleConditionElement build(
     final RuleBuildContext context, final BaseDescr descr, final Pattern prefixPattern) {
   Appendable builder = new StringBuilderAppendable();
   EvalDescr edescr = (EvalDescr) descr;
   FunctionHandlers.dump((LispForm) edescr.getContent(), builder, true);
   edescr.setContent(builder.toString());
   return super.build(context, descr, prefixPattern);
 }
  public void dump(LispForm lispForm, Appendable appendable) {
    LispForm form = (LispForm) lispForm.getSExpressions()[1];

    String type = ((LispAtom) form.getSExpressions()[0]).getValue();

    appendable.append("insert( with ( new " + type + "() ) {");

    for (int i = 1, length = form.getSExpressions().length; i < length; i++) {
      LispForm slot = (LispForm) form.getSExpressions()[i];

      appendable.append(((LispAtom) slot.getSExpressions()[0]).getValue());

      appendable.append(" = ");

      FunctionHandlers.dump(slot.getSExpressions()[1], appendable);

      if (i != length - 1) {
        appendable.append(",");
      }
    }
    appendable.append("} );\n");
  }