Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangLong


    void addOffsetsAndLengths(final OtpErlangList parOffsets,
            final int replacementOffset, final List<Point> result) {
        for (final OtpErlangObject i : parOffsets) {
            final OtpErlangTuple t = (OtpErlangTuple) i;
            final OtpErlangLong offset = (OtpErlangLong) t.elementAt(0);
            final OtpErlangLong length = (OtpErlangLong) t.elementAt(1);
            try {
                result.add(new Point(offset.intValue() + replacementOffset, length
                        .intValue()));
            } catch (final OtpErlangRangeException e) {
            }
        }
    }
View Full Code Here


        final List<String> warnings = ErlideDialyze.formatWarnings(backend, result);
        for (int i = 0; i < warnings.size(); i++) {
            final OtpErlangTuple t = (OtpErlangTuple) result.elementAt(i);
            final OtpErlangTuple fileLine = (OtpErlangTuple) t.elementAt(1);
            final String filename = Util.stringValue(fileLine.elementAt(0));
            final OtpErlangLong lineL = (OtpErlangLong) fileLine.elementAt(1);
            if (!filename.isEmpty()) {
                int line = 1;
                try {
                    line = lineL.intValue();
                } catch (final OtpErlangRangeException e) {
                    ErlLogger.error(e);
                }
                if (line <= 0) {
                    line = 1;
View Full Code Here

        if (result instanceof OtpErlangTuple) {
            final OtpErlangTuple t = (OtpErlangTuple) result;
            if (t.arity() > 0) {
                final OtpErlangObject element = t.elementAt(0);
                if (element instanceof OtpErlangLong) {
                    final OtpErlangLong l = (OtpErlangLong) element;
                    try {
                        final int d = l.intValue();
                        if (d == 0 || d == 1 || d == 2) {
                            return;
                        }
                    } catch (final OtpErlangRangeException e) {
                    }
View Full Code Here

            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);
            if (values.containsKey(file)) {
                values.get(file).add(instance);
            } else {
                final ArrayList<DuplicatedCodeInstanceElement> dupList = new ArrayList<DuplicatedCodeInstanceElement>();
View Full Code Here

            }
            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);
            instance.setReplicationFunction(replicationFunction);
            if (values.containsKey(file)) {
                values.get(file).add(instance);
            } else {
View Full Code Here

                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))
                        .elementAt(1);
                endLine = (OtpErlangLong) ((OtpErlangTuple) actPos.elementAt(1))
                        .elementAt(0);
                endColumn = (OtpErlangLong) ((OtpErlangTuple) actPos.elementAt(1))
                        .elementAt(1);

                final IErlSelection sel = GlobalParameters.getWranglerSelection();
                instances.add(new DuplicatedCodeInstanceElement((IFile) sel
                        .getErlElement().getResource(), startLine.intValue(), startColumn
                        .intValue(), endLine.intValue(), endColumn.intValue() + 1));
            }

            final DuplicatedCodeInstanceElement defaultInstance = instances.get(0);
View Full Code Here

    @Test
    public void parse_1() {
        final String input = "a. 1. [c].";
        final List<OtpErlangObject> expected = Lists.newArrayList(new OtpErlangAtom("a"),
                new OtpErlangLong(1), new OtpErlangList(new OtpErlangAtom("c")));
        final List<OtpErlangObject> actual = parser.parse(input);
        assertThat(actual, contains(expected.toArray()));
    }
View Full Code Here

            final OtpErlangBinary bs = (OtpErlangBinary) value;
            int j = bs.binaryValue()[index];
            if (j < 0) {
                j += 256;
            }
            return new OtpErlangLong(j);
        } else if (list != null) {
            return list.elementAt(index);
        }
        return null;
    }
View Full Code Here

                    break;
                case 1:
                    final OtpErlangTuple ieval = (OtpErlangTuple) t2.elementAt(0);
                    final OtpErlangAtom mod = (OtpErlangAtom) ieval.elementAt(3);
                    final String module = mod.atomValue();
                    final OtpErlangLong lin = (OtpErlangLong) ieval.elementAt(2);
                    s = module;
                    try {
                        final int line = lin.intValue();
                        s += ":" + line; //$NON-NLS-1$
                    } catch (final OtpErlangRangeException e) {
                    }
                    break;
                case 2:
View Full Code Here

                        .getProject(preprocessorDef), project);
    }

    private OtpErlangTuple makeTuple2(final String functionName, final int arity) {
        return new OtpErlangTuple(new OtpErlangObject[] {
                new OtpErlangAtom(functionName), new OtpErlangLong(arity) });
    }
View Full Code Here

TOP

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

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.