Package r.data

Examples of r.data.RAny


            super(other);
        }

        @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhs) {
            try {
                RAny lhs;
                if (!(lhsParam instanceof ComplexImpl) || !(rhs instanceof IntImpl) || lhsParam.isShared()) { throw new SpecializationException(null); }
                if (!Configuration.ARRAY_UPDATE_DO_NOT_COPY_LHS_WHEN_NO_ALIAS_IN_DIRECT_SPECIALIZATIONS) {
                    lhs = ValueCopy.COMPLEX_TO_COMPLEX_DIRECT.copy(lhs);
                } else {
                    lhs = lhsParam;
View Full Code Here


            super(other);
        }

        @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhs) {
            try {
                RAny lhs;
                if (!(lhsParam instanceof ComplexImpl) || !(rhs instanceof DoubleImpl) || lhsParam.isShared()) { throw new SpecializationException(null); }
                if (!Configuration.ARRAY_UPDATE_DO_NOT_COPY_LHS_WHEN_NO_ALIAS_IN_DIRECT_SPECIALIZATIONS) {
                    lhs = ValueCopy.COMPLEX_TO_COMPLEX_DIRECT.copy(lhs);
                } else {
                    lhs = lhsParam;
View Full Code Here

            super(other);
        }

        @Override public RAny execute(Frame frame, RAny lhsParam, RAny rhs) {
            try {
                RAny lhs;
                if (!(lhsParam instanceof ComplexImpl) || !(rhs instanceof ComplexImpl) || lhsParam.isShared()) { throw new SpecializationException(null); }
                if (!Configuration.ARRAY_UPDATE_DO_NOT_COPY_LHS_WHEN_NO_ALIAS_IN_DIRECT_SPECIALIZATIONS || (lhsParam == rhs)) {
                    lhs = ValueCopy.COMPLEX_TO_COMPLEX_DIRECT.copy(lhsParam);
                } else {
                    lhs = lhsParam;
View Full Code Here

            this.index = index;
        }

        @Override public Object execute(Frame frame) {
            assert Utils.check(getNewNode() == null);
            RAny base = (RAny) lhs.execute(frame);
            if (getNewNode() != null) {
                return ((ReadVector.SimpleConstantScalarIntSelection)getNewNode()).executeWithBase(frame, base);
            }
            return executeWithBase(frame, base);
        }
View Full Code Here

            this.c = c;
        }

        @Override public Object execute(Frame frame) {
            assert Utils.check(getNewNode() == null);
            RAny base = (RAny) lhs.execute(frame); // note: order is important
            if (getNewNode() != null) {
                return ((ReadVector.LogicalEqualitySelection) getNewNode()).executeWithBase(frame, base);
            }
            return executeWithBase(frame,base);
        }
View Full Code Here

            }
            return executeWithBase(frame,base);
        }

        public Object executeWithBase(Frame frame, RAny base) {
            RAny x = (RAny) xExpr.execute(frame);
            if (getNewNode() != null) {
                return ((ReadVector.LogicalEqualitySelection) getNewNode()).executeWithBase(frame, base);
            }
            return execute(base, x);
        }
View Full Code Here

        // note: subscript does not preserve names in the base, so no name handling (of base) is needed here
        public static RAny executeSubscript(RInt index, RArray base, ASTNode ast) {
            final int isize = index.size();
            if (isize == 0) { throw RError.getSelectLessThanOne(ast); }
            int i = 0;
            RAny b = base;

            if (isize > 1) {
                // the upper levels of recursive indexes have to be treated differently from the lowest level (the error semantics is different)
                // also, we know that the upper levels must be lists
                for (; i < isize - 1; i++) {
                    if (!(b instanceof RList)) {
                        if (base instanceof RList) {
                            throw RError.getRecursiveIndexingFailed(ast, i + 1);
                        } else {
                            throw RError.getSelectMoreThanOne(ast);
                        }
                    }
                    RList l = (RList) b;
                    int indexv = index.getInt(i);
                    int bsize = l.size();
                    int isel = convertDereferencingIndex(indexv, i, bsize, ast);
                    b = l.getRAny(isel);
                }
            }
            // selection at the last level
            int indexv = index.getInt(i);
            if (!(b instanceof RArray)) {
                // TODO: support language objects
                if (indexv == 1) { throw RError.getInvalidTypeLength(ast, b.typeOf(), 1); // FIXME: a very obscure error message but what GNU-R returns
                }
                if (indexv > 1) { throw RError.getSubscriptBounds(ast); }
                throw RError.getSelectLessThanOne(ast);
            }
            RArray a = (RArray) b;
View Full Code Here

        public static RAny executeSubscript(RString index, RArray base, ASTNode ast) {
            final int isize = index.size();
            if (isize == 0) { throw RError.getSelectLessThanOne(ast); }
            int i = 0;
            RAny b = base;

            if (isize > 1) {
                // the upper levels of recursive indexes have to be treated differently from the lowest level (the error semantics is different)
                // also, we know that the upper levels must be lists
                for (; i < isize - 1; i++) {
View Full Code Here

            this.index = index;
        }

        @Override public Object execute(Frame frame) {
            assert Utils.check(getNewNode() == null);
            RAny base = (RAny) lhs.execute(frame);
            if (getNewNode() != null) {
                return ((ReadVector.FieldSelection)getNewNode()).execute(base);
            }
            return execute(base);
        }
View Full Code Here

        if (getNewNode() != null) {
            System.err.println("Shit...\n");
        }

        assert Utils.check(getNewNode() == null);
        RAny base = (RAny) lhs.execute(frame); // note: order is important
        if (getNewNode() != null) {
            return ((ReadVector)getNewNode()).executeWithBase(frame, base);
        }
        return executeWithBase(frame, base);
    }
View Full Code Here

TOP

Related Classes of r.data.RAny

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.