public String format_using(OutputFormat format) {
    if (format.isJavaFamily()) return format_java_family(format);

    if (format == OutputFormat.DAIKON) return format_daikon();
    if (format == OutputFormat.ESCJAVA) return format_esc();
    if (format == OutputFormat.SIMPLIFY) return format_simplify();

    return format_unimplemented(format);
  }
Example #2
0
  /*@SideEffectFree*/ public String format_using(OutputFormat format) {
    String name = var().name_using(format);

    if (format == OutputFormat.DAIKON) {
      return var().name() + " == " + remainder + "  (mod " + modulus + ")";
    }

    if (format.isJavaFamily()) {
      name = var().name_using(format);
      if (var().type.isFloat()) {
        return "daikon.Quant.fuzzy.eq(" + name + " % " + modulus + ", " + remainder + ")";
      } else {
        return name + " % " + modulus + " == " + remainder;
      }
    }

    if (format == OutputFormat.CSHARPCONTRACT) {
      return var().csharp_name() + " % " + modulus + " == " + remainder;
    }

    //   if (format == OutputFormat.JAVA
    //     || format == OutputFormat.JML) {
    //   return var().name.name() + " % " + modulus + " == " + remainder;
    //  }

    if (format == OutputFormat.SIMPLIFY) {
      if (modulus > 0) {
        return "(EQ (MOD "
            + var().simplify_name()
            + " "
            + simplify_format_long(modulus)
            + ") "
            + simplify_format_long(remainder)
            + ")";
      } else {
        return format_too_few_samples(format, null);
      }
    }

    if (format == OutputFormat.SMTLIBV2) {
      if (modulus > 0) {
        return "decl: (declare-const "
            + var().smtlibv2_name()
            + " Int) inv: (= (mod "
            + var().smtlibv2_name()
            + " "
            + modulus
            + ") "
            + remainder
            + ")";
      } else {
        return format_too_few_samples(format, null);
      }
    }

    return format_unimplemented(format);
  }
  public String format_using(OutputFormat format) {
    if (format == OutputFormat.DAIKON) return format_daikon();
    if (format == OutputFormat.IOA) return format_ioa();
    if (format == OutputFormat.SIMPLIFY) return format_simplify();
    if (format.isJavaFamily()) {
      return format_unimplemented(format);
    }

    return format_unimplemented(format);
  }