Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangString


        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
                    .elementAt(1);
            final OtpErlangString fileName = (OtpErlangString) firstElement.elementAt(0);
            final OtpErlangLong startLine = (OtpErlangLong) firstElement.elementAt(1);
            final OtpErlangLong startCol = (OtpErlangLong) firstElement.elementAt(2);
            final OtpErlangLong endLine = (OtpErlangLong) secondElement.elementAt(1);
            final OtpErlangLong endCol = (OtpErlangLong) secondElement.elementAt(2);

            final String fileNameStr = fileName.stringValue();
            final IFile file = WranglerUtils.getFileFromPath(fileNameStr);
            final DuplicatedCodeInstanceElement instance = new DuplicatedCodeInstanceElement(
                    file, startLine.intValue(), startCol.intValue(), endLine.intValue(),
                    endCol.intValue() + 1);
            instance.setSuggestedCode(suggStr);
View Full Code Here


        RpcResult result;
        final String functionName = "sim_code_detection_eclipse";
        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(
View Full Code Here

        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 = "";
            final OtpErlangTuple checkable = (OtpErlangTuple) elementPair.elementAt(0);
            if (checkable.elementAt(0) instanceof OtpErlangTuple) {
                final OtpErlangString repFunStr = (OtpErlangString) elementPair
                        .elementAt(1);
                replicationFunction = repFunStr.stringValue();
                elementPair = checkable;

            }
            final OtpErlangTuple firstElement = (OtpErlangTuple) elementPair.elementAt(0);
            final OtpErlangTuple secondElement = (OtpErlangTuple) elementPair
                    .elementAt(1);
            final OtpErlangString fileName = (OtpErlangString) firstElement.elementAt(0);
            final OtpErlangLong startLine = (OtpErlangLong) firstElement.elementAt(1);
            final OtpErlangLong startCol = (OtpErlangLong) firstElement.elementAt(2);
            final OtpErlangLong endLine = (OtpErlangLong) secondElement.elementAt(1);
            final OtpErlangLong endCol = (OtpErlangLong) secondElement.elementAt(2);

            final String fileNameStr = fileName.stringValue();
            final IFile file = WranglerUtils.getFileFromPath(fileNameStr);
            final DuplicatedCodeInstanceElement instance = new DuplicatedCodeInstanceElement(
                    file, startLine.intValue(), startCol.intValue(), endLine.intValue(),
                    endCol.intValue() + 1);
            instance.setSuggestedCode(suggStr);
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

        final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters
                .getWranglerSelection();

        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(
View Full Code Here

    @Override
    public void send(final String string) {
        if (server != null) {
            backend.getOtpRpc().send(
                    server,
                    OtpErlang.mkTuple(new OtpErlangAtom("input"), new OtpErlangString(
                            string)));
        } else {
            try {
                backend.input(string);
            } catch (final IOException e) {
View Full Code Here

        list = checkList(value);
    }

    private OtpErlangList checkList(final OtpErlangObject theValue) {
        if (theValue instanceof OtpErlangString) {
            final OtpErlangString os = (OtpErlangString) theValue;
            final String s = os.stringValue();
            // TODO real encoding?
            final byte[] b = s.getBytes(Charsets.ISO_8859_1);
            if (!looksLikeAscii(b)) {
                return new OtpErlangList(s);
            }
View Full Code Here

                    elements.add(f);
                } catch (final ErlModelException e) {
                }
            }
        } else {
            final OtpErlangString s = (OtpErlangString) restuple.elementAt(1);
            MessageDialog.openError(shell, "Error", s.stringValue());
            return null;
        }
        return elements;
    }
View Full Code Here

                final OtpErlangList modList1 = (OtpErlangList) listtuple.elementAt(0);
                final OtpErlangList modList2 = (OtpErlangList) listtuple.elementAt(1);
                modules1 = createErlModuleList(modList1);
                modules2 = createErlModuleList(modList2);
            } else {
                final OtpErlangString s = (OtpErlangString) restuple.elementAt(1);
                MessageDialog.openError(shell, "Error", s.stringValue());
                return;
            }

            if (!modules1.isEmpty()) {
                CodeInspectionViewsManager.showErlElements(
View Full Code Here

    }

    private IErlModule extractModule(final OtpErlangObject m) throws ErlModelException {
        String name = "";
        if (m instanceof OtpErlangString) {
            final OtpErlangString element = (OtpErlangString) m;
            name = element.stringValue();
        } else if (m instanceof OtpErlangAtom) {
            final OtpErlangAtom atom = (OtpErlangAtom) m;
            name = atom.atomValue();
        }
        final String[] modNameParts = name.split("/");
View Full Code Here

TOP

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

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.