Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangTuple


        }
    }

    private boolean isBadRpc(final OtpErlangObject result) {
        if (result instanceof OtpErlangTuple) {
            final OtpErlangTuple t = (OtpErlangTuple) result;
            if (t.elementAt(0) instanceof OtpErlangAtom) {
                final OtpErlangAtom a = (OtpErlangAtom) t.elementAt(0);
                return "badrpc".equals(a.atomValue());
            }
        }
        return false;
    }
View Full Code Here


                throw new RpcTimeoutException(msg);
            }
            if (!(res instanceof OtpErlangTuple)) {
                throw new RpcException(res.toString());
            }
            final OtpErlangTuple t = (OtpErlangTuple) res;
            if (t.arity() != 2) {
                throw new RpcException(res.toString());
            }
            res = t.elementAt(1);

        } catch (final OtpErlangExit e) {
            throw new RpcException(e);
        } catch (final OtpErlangDecodeException e) {
            throw new RpcException(e);
View Full Code Here

        return result;
    }

    private IErlRecordDef checkRecord(final OtpErlangObject o) {
        if (o instanceof OtpErlangTuple) {
            final OtpErlangTuple t = (OtpErlangTuple) o;
            final OtpErlangObject h = t.elementAt(0);
            if (h instanceof OtpErlangAtom) {
                final OtpErlangAtom a = (OtpErlangAtom) h;
                final ErlangDebugTarget target = getErlangDebugTarget();
                IErlPreprocessorDef pd;
                try {
                    pd = ErlangEngine
                            .getInstance()
                            .getModelFindService()
                            .findPreprocessorDef(getErlProjects(target.getProjects()),
                                    moduleName, a.atomValue(), ErlElementKind.RECORD_DEF);
                    if (pd instanceof IErlRecordDef) {
                        final IErlRecordDef r = (IErlRecordDef) pd;
                        if (r.hasChildren() && r.getChildCount() + 1 == t.arity()) {
                            return r;
                        }
                    }
                } catch (final CoreException e) {
                }
View Full Code Here

                final IErlRecordDef r = checkRecord(o);
                if (r != null) {
                    return getRecordValueString(r, o);
                }
            }
            final OtpErlangTuple t = (OtpErlangTuple) o;
            return getTupleValueString(t);
        } else if (o instanceof OtpErlangList) {
            final OtpErlangList l = (OtpErlangList) o;
            return getListValueString(l);
        } else {
View Full Code Here

        try {
            children = r.getChildren();
        } catch (final ErlModelException e) {
            children = EMPTY_LIST;
        }
        final OtpErlangTuple t = (OtpErlangTuple) o;
        b.append(t.elementAt(0)).append("#{");
        final int n = children.size();
        if (n > 0) {
            for (int i = 0; i < n; i++) {
                final IErlRecordField field = (IErlRecordField) children.get(i);
                b.append(field.getFieldName()).append('=')
                        .append(t.elementAt(i + 1).toString()).append(", ");
            }
            b.setLength(b.length() - 2);
        }
        b.append('}');
        return b.toString();
View Full Code Here

        return getArity() != -1;
    }

    protected OtpErlangObject getElementAt(final int index) {
        if (value instanceof OtpErlangTuple) {
            final OtpErlangTuple t = (OtpErlangTuple) value;
            final int ofs = record != null ? 1 : 0;
            return t.elementAt(index + ofs);
        } else if (value instanceof OtpErlangList) {
            final OtpErlangList l = (OtpErlangList) value;
            return l.elementAt(index);
        } else if (value instanceof OtpErlangBinary) {
            final OtpErlangBinary bs = (OtpErlangBinary) value;
View Full Code Here

        return null;
    }

    protected int getArity() {
        if (value instanceof OtpErlangTuple) {
            final OtpErlangTuple t = (OtpErlangTuple) value;
            return t.arity();
        } else if (value instanceof OtpErlangList) {
            final OtpErlangList l = (OtpErlangList) value;
            return l.arity();
        } else if (value instanceof OtpErlangBinary) {
            final OtpErlangBinary bs = (OtpErlangBinary) value;
View Full Code Here

    }

    @SuppressWarnings("boxing")
    public FunctionRef(final OtpErlangObject e) {
        if (e instanceof OtpErlangTuple) {
            final OtpErlangTuple t = (OtpErlangTuple) e;
            try {
                final Bindings bb = OtpErlang.match("{M:a, F:a, A:i}", t);
                final String m = bb.getAs("M", String.class);
                final String f = bb.getAs("F", String.class);
                final int a = bb.getAs("A", Integer.class);
View Full Code Here

        super(cmds);
    }

    @Override
    public void execute(final ErlangDebugTarget debugTarget) {
        final OtpErlangTuple t = (OtpErlangTuple) cmds[1];
        final OtpErlangPid pid = (OtpErlangPid) t.elementAt(0);
        final ErlangProcess erlangProcess = debugTarget.getOrCreateErlangProcess(pid);
        final OtpErlangAtom statusA = (OtpErlangAtom) t.elementAt(2);
        final String status = statusA.atomValue();
        erlangProcess.setStatus(status);
        final OtpErlangTuple initialCall = (OtpErlangTuple) t.elementAt(1);
        erlangProcess.setInitialCall(new ErlangFunctionCall(initialCall));
        erlangProcess.fireCreationEvent();
    }
View Full Code Here

    private ArrayList<IErlElement> processFunctionResult(final Shell shell,
            final RpcResult result) throws OtpErlangRangeException {
        final ArrayList<IErlElement> elements = new ArrayList<IErlElement>();
        final OtpErlangObject obj = result.getValue();
        final OtpErlangTuple restuple = (OtpErlangTuple) obj;
        final OtpErlangAtom resindicator = (OtpErlangAtom) restuple.elementAt(0);
        if (resindicator.atomValue().equals("ok")) {
            final OtpErlangList erlangFunctionList = (OtpErlangList) restuple
                    .elementAt(1);
            for (int i = 0; i < erlangFunctionList.arity(); ++i) {
                final OtpErlangTuple fTuple = (OtpErlangTuple) erlangFunctionList
                        .elementAt(i);
                IErlFunctionClause f;
                try {
                    f = extractFunction(fTuple);
                    elements.add(f);
View Full Code Here

TOP

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

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.