Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangList.elementAt()


      assertEquals(testArg[i], testResult[i]);
    }
    OtpErlangList received = (OtpErlangList) mboxListener.getMsg();
    assertEquals(testArg.length, received.arity());
    for (int i = 0; i < testArg.length; i++) {
      assertEquals(testArg[i], ((OtpErlangString) received.elementAt(i))
          .stringValue());
    }
  }

  /**
 
View Full Code Here


    OtpErlangList received = (OtpErlangList) mboxListener.getMsg();
    assertEquals(testArg.length, received.arity());
    for (int i = 0; i < testArg.length; i++) {
      for (int j = 0; j < testArg[i].length; j++) {
        assertEquals(testArg[i][j],
            (((OtpErlangString) ((OtpErlangList) received
                .elementAt(i)).elementAt(j)).stringValue()));
      }
    }
  }
View Full Code Here

        OtpErlangString oes = (OtpErlangString) i;
        OtpErlangList oel = new OtpErlangList(oes.stringValue());
        int n = oel.arity();
        OtpErlangObject l[] = new OtpErlangObject[n];
        for (int j = 0;  j < n;  j++) {
      OtpErlangLong c = (OtpErlangLong) oel.elementAt(j);
      l[j] = new OtpErlangInt(-c.intValue());
        }
        return new OtpErlangList(l);
    }
      } else if (atomValue.equals("hash_lookup")) {
View Full Code Here

        jlog.warning("The rpc call to " + this.mod + ":" + this.fun
            + " timed out. No results will be returned");
      } else if (response instanceof OtpErlangList) {
        OtpErlangList results = (OtpErlangList) response;
        for (int docid = 0; docid < docValues.length; docid++) {
          OtpErlangObject result = results.elementAt(docid);
          if (result instanceof OtpErlangDouble) {
            scores.put(docid + docBase,
                ((OtpErlangDouble) result).doubleValue());
            bits.set(docid);
          } else {
View Full Code Here

     */
    public <T> List<T> listValue(final ListElementConverter<T> converter) throws ClassCastException {
        final OtpErlangList list = otpObjectToOtpList(value);
        final ArrayList<T> result = new ArrayList<T>(list.arity());
        for (int i = 0; i < list.arity(); ++i) {
            result.add(converter.convert(i, new ErlangValue(list.elementAt(i))));
        }
        return result;
    }

    /**
 
View Full Code Here

            System.out
                    .println("    `writeObject(OtpErlangString, OtpErlangObject)`...");
            for (int i = 0; i < otpKeys.arity(); ++i) {
                final OtpErlangString otpKey = (OtpErlangString) otpKeys.elementAt(i);
                final OtpErlangString otpValue = (OtpErlangString) otpValues
                        .elementAt(i);
                try {
                    transaction.write(otpKey, otpValue);
                    System.out.println("      write(" + otpKey.stringValue()
                            + ", " + otpValue.stringValue() + ") succeeded");
View Full Code Here

                    new OtpErlangObject[] { ErlangValue.convertToErlang(max) });
        try {
            final OtpErlangList list = ErlangValue.otpObjectToOtpList(received_raw);
            final ArrayList<String> result = new ArrayList<String>(list.arity());
            for (int i = 0; i < list.arity(); ++i) {
                OtpErlangTuple connTuple = ((OtpErlangTuple) list.elementAt(i));
                if (connTuple.arity() != 4) {
                    throw new UnknownException(received_raw);
                }
                OtpErlangAtom name_otp = (OtpErlangAtom) connTuple.elementAt(i);
                result.add(name_otp.atomValue());
View Full Code Here

            final ListElementConverter<K> keyConv,
            final ListElementConverter<V> valConv) throws ClassCastException {
        final OtpErlangList list = ErlangValue.otpObjectToOtpList(object);
        final LinkedHashMap<K, V> result = new LinkedHashMap<K, V>(list.arity());
        for (int i = 0; i < list.arity(); ++i) {
            final OtpErlangTuple element = (OtpErlangTuple) list.elementAt(i);
            if (element.arity() != 2) {
                throw new ClassCastException("wrong tuple arity");
            }
            final K key = keyConv.convert(i, new ErlangValue(element.elementAt(0)));
            final V value = valConv.convert(i, new ErlangValue(element.elementAt(1)));
View Full Code Here

            System.out.println("done");

            System.out
                    .println("    `OtpErlangObject readObject(OtpErlangString)`...");
            for (int i = 0; i < otpKeys.arity(); ++i) {
                final OtpErlangString otpKey = (OtpErlangString) otpKeys.elementAt(i);
                try {
                    otpValue = (OtpErlangString) transaction.read(otpKey).value();
                    System.out.println("      read(" + otpKey.stringValue()
                            + ") == " + otpValue.stringValue());
                } catch (final ConnectionException e) {
View Full Code Here

                    new OtpErlangObject[] { ErlangValue.convertToErlang(max) });
        try {
            final OtpErlangList list = ErlangValue.otpObjectToOtpList(received_raw);
            final ArrayList<String> result = new ArrayList<String>(list.arity());
            for (int i = 0; i < list.arity(); ++i) {
                final OtpErlangTuple connTuple = ((OtpErlangTuple) list.elementAt(i));
                if (connTuple.arity() != 4) {
                    throw new UnknownException(received_raw);
                }
                final OtpErlangAtom name_otp = (OtpErlangAtom) connTuple.elementAt(i);
                result.add(name_otp.atomValue());
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.