Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangList$Itr


            final OtpErlangPid meta) {
        try {
            final OtpErlangObject res = backend.call(ERLIDE_DEBUG,
                    "all_modules_on_stack", "x", meta);
            if (res instanceof OtpErlangList) {
                final OtpErlangList modules = (OtpErlangList) res;
                final List<String> result = new ArrayList<String>(modules.arity());
                for (final OtpErlangObject module : modules) {
                    final OtpErlangAtom moduleA = (OtpErlangAtom) module;
                    result.add(moduleA.atomValue());
                }
                return result;
View Full Code Here


                return;
            }

            final OtpErlangTuple result = (OtpErlangTuple) res.elementAt(1);

            if (result.elementAt(0).equals(new OtpErlangList())) {
                setUnSuccessful("No more instances found!");
                return;
            }

            final DuplicatedCodeElement dup = parseDuplicates(result);
View Full Code Here

    // { [{ {filename(), integer(), integer()} , {filename(), integer(),
    // integer()} }], integer(), integer(), string()}
    protected DuplicatedCodeElement parseDuplicates(final OtpErlangObject object)
            throws OtpErlangRangeException {
        final OtpErlangTuple listElementTuple = (OtpErlangTuple) object;
        final OtpErlangList duplicateCodeList = (OtpErlangList) listElementTuple
                .elementAt(0);
        final LinkedHashMap<IFile, List<DuplicatedCodeInstanceElement>> values = new LinkedHashMap<IFile, List<DuplicatedCodeInstanceElement>>();

        final OtpErlangString suggestion = (OtpErlangString) listElementTuple
                .elementAt(1);
        final String suggStr = suggestion.stringValue();

        final OtpErlangObject[] elements = duplicateCodeList.elements();

        for (int i = 0; i < elements.length; ++i) {
            final OtpErlangTuple elementPair = (OtpErlangTuple) elements[i];
            final OtpErlangTuple firstElement = (OtpErlangTuple) elementPair.elementAt(0);
            final OtpErlangTuple secondElement = (OtpErlangTuple) elementPair
View Full Code Here

        if (onlyInFile) {

            final OtpErlangString fp = new OtpErlangString(sel.getFilePath());
            final OtpErlangString[] fpa = new OtpErlangString[1];
            fpa[0] = fp;
            final OtpErlangList fpl = new OtpErlangList(fpa);

            result = backend.callWithoutParser(
                    WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName,
                    "xiiiidxi", fpl, minLen, minToks, minFreq, maxNewVars, simScore,
                    sel.getSearchPath(), GlobalParameters.getTabWidth());
View Full Code Here

                final OtpErlangTuple objectTuple = (OtpErlangTuple) object;
                setUnSuccessful(((OtpErlangString) objectTuple.elementAt(1))
                        .stringValue());

            } else {
                final OtpErlangList resultList = (OtpErlangList) object;
                if (resultList.arity() == 0) {
                    setUnSuccessful(emptyErrorMessage);
                    return;
                }

                duplicates = new ArrayList<DuplicatedCodeElement>();
                for (int i = 0; i < resultList.arity(); ++i) {
                    duplicates.add(parseDuplicates(resultList.elementAt(i)));
                }
                isSuccessful = true;
            }
        } catch (final Exception e) {
            setUnSuccessful(e.getMessage());
View Full Code Here

    // { [{ {filename(), integer(), integer()} , {filename(), integer(),
    // integer()} }], integer(), integer(), string()}
    protected DuplicatedCodeElement parseDuplicates(final OtpErlangObject object)
            throws OtpErlangRangeException {
        final OtpErlangTuple listElementTuple = (OtpErlangTuple) object;
        final OtpErlangList duplicateCodeList = (OtpErlangList) listElementTuple
                .elementAt(0);
        final LinkedHashMap<IFile, List<DuplicatedCodeInstanceElement>> values = new LinkedHashMap<IFile, List<DuplicatedCodeInstanceElement>>();

        final OtpErlangString suggestion = (OtpErlangString) listElementTuple
                .elementAt(3);
        final String suggStr = suggestion.stringValue();

        final OtpErlangObject[] elements = duplicateCodeList.elements();

        for (int i = 0; i < elements.length; ++i) {
            OtpErlangTuple elementPair = (OtpErlangTuple) elements[i];

            String replicationFunction = "";
View Full Code Here

            if (!res.elementAt(0).toString().equals("ok")) {
                setUnSuccessful(((OtpErlangString) res.elementAt(1)).stringValue());
                return;
            }
            if (res.elementAt(1).equals(new OtpErlangList())) {
                setUnSuccessful("No more instances found!");
                return;
            }

            final OtpErlangList posList = (OtpErlangList) res.elementAt(1);
            OtpErlangTuple actPos;
            OtpErlangLong startLine, startColumn, endLine, endColumn;

            final ArrayList<DuplicatedCodeInstanceElement> instances = new ArrayList<DuplicatedCodeInstanceElement>();

            final Iterator<OtpErlangObject> it = posList.iterator();
            while (it.hasNext()) {
                actPos = (OtpErlangTuple) it.next();
                startLine = (OtpErlangLong) ((OtpErlangTuple) actPos.elementAt(0))
                        .elementAt(0);
                startColumn = (OtpErlangLong) ((OtpErlangTuple) actPos.elementAt(0))
View Full Code Here

        String path = path0;
        try {
            // workaround for bug in code:del_path
            try {
                final OtpErlangObject rr = backend.call("filename", "join", "x",
                        new OtpErlangList(new OtpErlangString(path)));
                path = ((OtpErlangString) rr).stringValue();
            } catch (final Exception e) {
                // ignore
            }
            backend.call(CODE, "del_path", "s", path);
View Full Code Here

        if (onlyInfile) {
            functionName = "duplicated_code_eclipse";
            final OtpErlangString fp = new OtpErlangString(sel.getFilePath());
            final OtpErlangString[] fpa = new OtpErlangString[1];
            fpa[0] = fp;
            final OtpErlangList fpl = new OtpErlangList(fpa);

            result = backend.callWithoutParser(
                    WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, "xiiis",
                    fpl, minToks, minClones, GlobalParameters.getTabWidth(), suffixPath);
        } else {
View Full Code Here

    private OtpErlangObject buildRpcCall(final OtpErlangPid pid,
            final OtpErlangObject gleader, final String module, final String fun,
            final OtpErlangObject[] args) {
        final OtpErlangObject m = new OtpErlangAtom(module);
        final OtpErlangObject f = new OtpErlangAtom(fun);
        final OtpErlangObject a = new OtpErlangList(args);
        return OtpErlang.mkTuple(pid,
                OtpErlang.mkTuple(new OtpErlangAtom("call"), m, f, a, gleader));
    }
View Full Code Here

TOP

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

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.