Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangString.stringValue()


    }

    @Test
    public void string_1() throws TermParserException {
        final OtpErlangString r = (OtpErlangString) termParser.parse("\"Hello\"");
        Assert.assertEquals(r.stringValue(), "Hello");
    }

    @Test
    public void string_2() throws TermParserException {
        final OtpErlangString r = (OtpErlangString) termParser.parse("\"Hello world!\"");
View Full Code Here


    }

    @Test
    public void string_2() throws TermParserException {
        final OtpErlangString r = (OtpErlangString) termParser.parse("\"Hello world!\"");
        Assert.assertEquals(r.stringValue(), "Hello world!");
    }

    @Test
    public void placeholder_1() throws TermParserException {
        final OtpFormatPlaceholder r = (OtpFormatPlaceholder) termParser.parse("~hello");
View Full Code Here

    private void refreshDirs(final IProject project, final OtpErlangObject element) {
        final OtpErlangList list = (OtpErlangList) element;
        final Map<IPath, String> paths = Maps.newHashMap();
        for (final OtpErlangObject ebeam : list) {
            final OtpErlangString beam = (OtpErlangString) ebeam;
            final String sbeam = beam.stringValue();
            IPath p = new Path(sbeam);
            p = p.removeLastSegments(1);
            p = p.removeFirstSegments(project.getLocation().segmentCount());
            p = p.setDevice(null);
            paths.put(p, sbeam);
View Full Code Here

            final OtpErlangList resList = (OtpErlangList) res;
            for (final OtpErlangObject o : resList) {
                if (o instanceof OtpErlangString) {
                    final OtpErlangString s = (OtpErlangString) o;
                    final String suffix = includes ? "" : ":";
                    final String cpl = quoted(s.stringValue() + suffix, kind);
                    final int prefixLength = prefix.length();
                    result.add(new CompletionProposal(cpl, offset - prefixLength,
                            prefixLength, cpl.length()));
                }
            }
View Full Code Here

                .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];
View Full Code Here

            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

                .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];
View Full Code Here

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

            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

    }

    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

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.