@MJI
 public int substring__I__Ljava_lang_String_2(
     MJIEnv env, int objRef, int beginIndex, FeatureExpr ctx) {
   Integer aref = env.getReferenceField(ctx, objRef, "value").getValue();
   char[] buf = env.getCharArrayObject(aref).getValue();
   String obj = new String(buf);
   String result = obj.substring(beginIndex);
   return env.newString(ctx, result);
 }
 public static int toString____Ljava_lang_String_2(MJIEnv env, int objRef) {
   StringBuilder sb = new StringBuilder();
   FieldInfo fi = getFieldInfo(env, objRef);
   sb.append(Modifier.toString(fi.getModifiers()));
   sb.append(' ');
   sb.append(fi.getType());
   sb.append(' ');
   sb.append(fi.getFullName());
   int sref = env.newString(sb.toString());
   return sref;
 }
  public static int getName____Ljava_lang_String_2(MJIEnv env, int objRef) {
    FieldInfo fi = getFieldInfo(env, objRef);

    int nameRef = env.getReferenceField(objRef, "name");
    if (nameRef == -1) {
      nameRef = env.newString(fi.getName());
      env.setReferenceField(objRef, "name", nameRef);
    }

    return nameRef;
  }
  @MJI
  public int getName____Ljava_lang_String_2(MJIEnv env, int objRef, FeatureExpr ctx) {
    FieldInfo fi = getFieldInfo(ctx, env, objRef);

    int nameRef = env.getReferenceField(ctx, objRef, "name").getValue();
    if (nameRef == MJIEnv.NULL) {
      nameRef = env.newString(ctx, fi.getName());
      env.setReferenceField(ctx, objRef, "name", nameRef);
    }

    return nameRef;
  }
  @MJI
  public int substring__II__Ljava_lang_String_2(
      MJIEnv env,
      int objRef,
      final Conditional<Integer> beginIndex,
      final Conditional<Integer> endIndex,
      FeatureExpr ctx) {
    Integer aref = env.getReferenceField(ctx, objRef, "value").getValue();
    Conditional<char[]> buf = env.getCharArrayObject(aref);
    Conditional<String> result =
        buf.mapf(
            ctx,
            new BiFunction<FeatureExpr, char[], Conditional<String>>() {

              @Override
              public Conditional<String> apply(FeatureExpr ctx, char[] buf) {
                String obj = new String(buf);
                return new One<>(obj.substring(beginIndex.getValue(), endIndex.getValue()));
              }
            });
    return env.newString(ctx, result);
  }
  @MJI
  public int toString____Ljava_lang_String_2(final MJIEnv env, final int objref, FeatureExpr ctx) {

    Conditional<Integer> aref = env.getReferenceField(ctx, objref, "value");
    Conditional<String> s =
        aref.mapf(
                ctx,
                new BiFunction<FeatureExpr, Integer, Conditional<String>>() {

                  @Override
                  public Conditional<String> apply(FeatureExpr ctx, Integer aref) {
                    Conditional<char[]> buf = env.getCharArrayObject(aref).simplify(ctx);
                    return buf.mapf(
                        ctx,
                        new BiFunction<FeatureExpr, char[], Conditional<String>>() {

                          @Override
                          public Conditional<String> apply(FeatureExpr ctx, final char[] buf) {
                            final Conditional<Integer> count =
                                env.getIntField(objref, "count").simplify(ctx);
                            return count.mapf(
                                ctx,
                                new BiFunction<FeatureExpr, Integer, Conditional<String>>() {

                                  @Override
                                  public Conditional<String> apply(FeatureExpr ctx, Integer count) {
                                    return new One<>(new String(buf, 0, count));
                                  }
                                });
                          }
                        });
                  }
                })
            .simplify();

    return env.newString(ctx, s);
  }
예제 #7
0
 @MJI
 public int toString__S__Ljava_lang_String_2(MJIEnv env, int objref, short val, FeatureExpr ctx) {
   return env.newString(ctx, Short.toString(val));
 }
예제 #8
0
 @MJI
 public int toString__II__Ljava_lang_String_2(
     MJIEnv env, int objref, int val, int radix, FeatureExpr ctx) {
   return env.newString(ctx, Integer.toString(val, radix));
 }
예제 #9
0
 @MJI
 public int toOctalString__I__Ljava_lang_String_2(
     MJIEnv env, int objref, int val, FeatureExpr ctx) {
   return env.newString(ctx, Integer.toOctalString(val));
 }