Package erjang

Examples of erjang.ETuple.arity()


    ESmall i = idx.testSmall();
    ETuple t = tup.testTuple();
    if (i == null || t == null) {
      return null;
    }
    if (i.value > t.arity())
      return null;

    return t.elm(i.value);
  }
View Full Code Here


  @BIF
  static public EObject element(EObject idx, EObject tup) {
    ESmall i = idx.testSmall();
    ETuple t = tup.testTuple();
    if (i == null || t == null || i.value < 1 || i.value > t.arity()) {
      throw ERT.badarg(idx, tup);
    }

    return t.elm(i.asInt());
  }
View Full Code Here

  }

  @BIF
  static public EObject element(int idx, EObject obj) {
    ETuple tup;
    if ((tup = obj.testTuple()) != null && tup.arity() >= idx) {
      return tup.elm(idx);
    }
    throw ERT.badarg(new ESmall(idx), obj);
  }
View Full Code Here

      if ((b = o.testBinary()) == null)
        throw ERT.badarg(o);
     
      return ERT.box(b.byteSize());
    }
    return ERT.box(t.arity());
  }

  @BIF
  public static final ESmall size(ETuple t) {
    return ERT.box(t.arity());
View Full Code Here

  @BIF(type = Type.GUARD, name = "size")
  public static final ESmall size$g(EObject o) {
    ETuple t;
    if ((t = o.testTuple()) != null)
      return ERT.box(t.arity());

    EBinary b;
    if ((b = o.testBinary()) != null)
      return ERT.box(b.byteSize());
   
View Full Code Here

    @BIF(type=Type.GUARD, name="is_record")
            public static EAtom is_record$g(EObject term, EObject tag) {
                EAtom atag = tag.testAtom();
                ETuple tup = term.testTuple();
                boolean ok = ( (atag != null) && (tup != null)
                                && (tup.arity() > 0)
                                && (tup.elm(1) == atag) );
                if (ok) return ERT.TRUE;
                else return null;
  }
View Full Code Here

            public static EAtom is_record$g(EObject term, EObject tag, EObject size) {
                EAtom atag = tag.testAtom();
                ETuple tup = term.testTuple();
                ESmall siz = size.testSmall();
                boolean ok = ( (atag != null) && (tup != null) && (siz != null)
                                && (tup.arity() == siz.value)
                                && (tup.elm(1) == atag) );
                if (ok) return ERT.TRUE;
                else return null;
  }
View Full Code Here

  @BIF
  public static ESmall tuple_size(EObject tup) {
    ETuple t;
    if ((t = tup.testTuple()) == null)
      throw ERT.badarg(tup);
    return ERT.box(t.arity());
  }

  @BIF(type = Type.GUARD, name = "tuple_size")
  public static ESmall tuple_size_guard(EObject tup) {
    ETuple t;
View Full Code Here

  @BIF(type = Type.GUARD, name = "tuple_size")
  public static ESmall tuple_size_guard(EObject tup) {
    ETuple t;
    if ((t = tup.testTuple()) == null)
      return null;
    return ERT.box(t.arity());
  }

  @BIF
  public static ESmall byte_size(EObject o) {
    EBitString bin = o.testBitString();
View Full Code Here

      ETuple tup;
      if (((tup=term.testTuple()) != null || term.testCons() != null
          && term != ERT.NIL
          && !type.equals(ESTRING_TYPE)
          && !( tup != null && tup.arity()==5 && tup.elm(1) == ETuple.am_Elixir_Regex)
          ) {
        EBinary bin = ErlConvert.term_to_binary(term, EList.make(ErlConvert.am_compressed));
        bin.emit_const(mv);
       
        mv.visitMethodInsn(INVOKESTATIC,
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.