Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangList


            final OtpErlangObject o = b.get("Payload");
            if (o instanceof OtpErlangString) {
                message = ((OtpErlangString) o).stringValue();
            } else if (o instanceof OtpErlangList) {
                final OtpErlangList l = (OtpErlangList) o;
                if (l.arity() == 0) {
                    message = "";
                } else {
                    try {
                        message = l.stringValue();
                    } catch (final Exception e) {
                        message = o.toString();
                    }
                }
            } else {
View Full Code Here


                        .elementAt(0);

                final OtpErlangObject r = ErlangEngine.getInstance().getProclistService()
                        .getProcessInfo(getBackend().getOtpRpc(), pid);
                if (r instanceof OtpErlangList) {
                    final OtpErlangList l = (OtpErlangList) r;
                    final StringBuilder s = new StringBuilder();
                    for (int i = 0; i < l.arity(); i++) {
                        final OtpErlangTuple e = (OtpErlangTuple) l.elementAt(i);
                        s.append(' ').append(e.elementAt(0).toString()).append("\t= ")
                                .append(e.elementAt(1).toString()).append('\n');
                    }
                    showMessage(s.toString());
                } else {
View Full Code Here

            final IOtpRpc backend = getBackend().getOtpRpc();
            if (backend == null) {
                return new OtpErlangObject[] {};
            }

            final OtpErlangList r = ErlangEngine.getInstance().getProclistService()
                    .getProcessList(backend);
            if (r == null || r.arity() == 0) {
                return new OtpErlangObject[] {};
            }
            final OtpErlangObject[] ss = new OtpErlangObject[r.elements().length];

            for (int i = 0; i < r.elements().length; i++) {
                final OtpErlangTuple e = (OtpErlangTuple) r.elementAt(i);
                ss[i] = e;
            }

            return ss;
        }
View Full Code Here

                if (tracedNode.isEnabled()) {
                    nodeAtoms.add(new OtpErlangAtom(tracedNode.getNodeName()));
                }
            }

            final OtpErlangList nodesList = new OtpErlangList(
                    nodeAtoms.toArray(new OtpErlangAtom[nodeAtoms.size()]));
            final OtpErlangList procList = (OtpErlangList) backend.call(MODULE_NAME,
                    FUNCTION_NAME, "x", nodesList);
            final TracedProcess[] processes = new TracedProcess[procList.arity()];

            for (int i = 0; i < procList.arity(); i++) {
                final OtpErlangTuple tuple = (OtpErlangTuple) procList.elementAt(i);
                processes[i] = new TracedProcess(tuple);
            }
            return processes;
        } catch (final RpcException e) {
            ErlLogger.error(e);
View Full Code Here

                final OtpErlangAtom errorType = (OtpErlangAtom) tuple.elementAt(1);
                if (errorType.atomValue().equals("standard_info")) {
                    final OtpErlangTuple errorTuple = (OtpErlangTuple) tuple.elementAt(2);
                    final StringBuilder builder = new StringBuilder("Line ");
                    builder.append(errorTuple.elementAt(0)).append(": ");
                    final OtpErlangList errorList = (OtpErlangList) errorTuple
                            .elementAt(2);
                    builder.append(((OtpErlangString) errorList.elementAt(0))
                            .stringValue());
                    if (errorList.elementAt(1) instanceof OtpErlangString) {
                        builder.append(((OtpErlangString) errorList.elementAt(1))
                                .stringValue());
                    }
                    return builder.toString();
                } else if (errorType.atomValue().equals("not_fun")) {
                    return "Given expression is not a function";
View Full Code Here

            final OtpErlangObject arityOrArgs = functionTuple
                    .elementAt(INDEX_FUNCTION_ARGS);
            int arityValue = -1;
            if (arityOrArgs instanceof OtpErlangList) {
                // last element is a list of arguments
                final OtpErlangList arguments = (OtpErlangList) arityOrArgs;
                final StringBuilder builder = new StringBuilder("arguments: ");
                for (int i = 1; i < arguments.arity(); i++) {
                    builder.append(arguments.elementAt(i)).append(", ");
                }
                arityValue = arguments.arity() - 1;
                argsNode.setLabel(builder.substring(0, builder.length() - 2));
            } else {
                // last element is arity
                try {
                    if (functionTuple.elementAt(INDEX_FUNCTION_ARGS) instanceof OtpErlangInt) {
View Full Code Here

        final ITreeNode node = new TreeNode(createNodeLabel(labelBuilder.toString()),
                Activator.getImage(image));
        node.addChildren(processNode);

        final OtpErlangList list = (OtpErlangList) tuple.elementAt(INDEX_INFO);
        for (final OtpErlangObject otpErlangObject : list) {
            final OtpErlangTuple infoTuple = (OtpErlangTuple) otpErlangObject;
            final OtpErlangObject key = infoTuple.elementAt(0);
            final OtpErlangObject value = infoTuple.elementAt(1);
            final TreeNode treeNode = new TreeNode(key.toString() + ": "
View Full Code Here

        return false;
    }

    public static void reloadAllCode(final IOtpRpc backend) {
        try {
            final OtpErlangList loaded = (OtpErlangList) backend.call("code",
                    "all_loaded", "");
            final List<OtpErlangAtom> mine = new ArrayList<OtpErlangAtom>();
            for (final OtpErlangObject elem : loaded) {
                final OtpErlangTuple t = (OtpErlangTuple) elem;
                final OtpErlangAtom mod = (OtpErlangAtom) t.elementAt(0);
View Full Code Here

                                erlangObjects.add(new OtpErlangTuple(
                                        new OtpErlangObject[] { name, cookie }));
                                notActivatedNodes.add(tracedNode.getNodeName());
                            }
                        }
                        final OtpErlangList nodes = new OtpErlangList(
                                erlangObjects.toArray(new OtpErlangObject[erlangObjects
                                        .size()]));

                        // net tick time
                        final int tickTimeValue = Activator.getDefault()
View Full Code Here

        final OtpErlangTuple tuple = (OtpErlangTuple) callResult;
        if (((OtpErlangAtom) tuple.elementAt(0)).atomValue().equals("error")) {
            errorObject = tuple.elementAt(1);
            return TracingStatus.ERROR;
        }
        final OtpErlangList nodeNames = (OtpErlangList) tuple.elementAt(1);
        activatedNodes = new ArrayList<String>();
        for (final OtpErlangObject nodeName : nodeNames) {
            final String nodeNameString = ((OtpErlangAtom) nodeName).atomValue();
            activatedNodes.add(nodeNameString);
            notActivatedNodes.remove(nodeNameString);
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangList

Copyright © 2018 www.massapicom. 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.