Package r.data.RArray

Examples of r.data.RArray.Names.map()


            boolean[] remove = new boolean[bsize];
            int nremove = 0;

            for (int i = 0; i < isize; i++) {
                RSymbol s = RSymbol.getSymbol(index.getString(i));
                int v = bnames.map(s);
                if (v != -1) {
                    if (!remove[v]) {
                        remove[v] = true;
                        nremove++;
                    }
View Full Code Here


                    if (!(b instanceof RList)) { throw RError.getSelectMoreThanOne(ast); }
                    RList l = (RList) b;
                    Names names = l.names();
                    if (names == null) { throw RError.getNoSuchIndexAtLevel(ast, i + 1); }
                    RSymbol s = RSymbol.getSymbol(index.getString(i));
                    int indexv = names.map(s);
                    if (indexv == -1) { throw RError.getNoSuchIndexAtLevel(ast, i + 1); }
                    int bsize = l.size();
                    RAny[] content = new RAny[bsize];
                    // TODO: add optimization like in the case with integer index (above)
                    int k = 0;
View Full Code Here

                if (!(vector instanceof RArray)) { throw new SpecializationException(Failure.NOT_ARRAY_BASE); }
                RArray vrarr = (RArray) vector;
                Names names = vrarr.names();
                if (names == null) { throw new SpecializationException(Failure.UNSPECIFIED); }
                RSymbol symbol = RSymbol.getSymbol(irstr.getString(0));
                int i = names.map(symbol);
                if (i == -1) { throw new SpecializationException(Failure.UNSPECIFIED); }
                return getWithName(vrarr, i, subset);
            } catch (SpecializationException e) {
                Failure f = (Failure) e.getResult();
                if (DEBUG_SEL) Utils.debug("selection - SimpleScalarStringSelection failed: " + f);
View Full Code Here

                }
            } else if (index instanceof RString) {
                RSymbol name = RSymbol.getSymbol(((RString) index).getString(0));
                Names bnames = base.names();
                if (bnames == null) { return Utils.getBoxedNA(base); }
                i = bnames.map(name);
                if (i != -1) {
                    return getWithName(base, i, subset);
                } else {
                    return Utils.getNamedNA(base);
                }
View Full Code Here

            if (baseNames == null) { return Utils.createNAArray(base, isize); }
            RSymbol[] symbols = new RSymbol[isize];
            RArray res = Utils.createArray(base, isize, true);
            for (int i = 0; i < isize; i++) {
                RSymbol symbol = RSymbol.getSymbol(index.getString(i));
                int v = baseNames.map(symbol);
                if (v != -1) {
                    res.set(i, base.get(v));
                    symbols[i] = symbol;
                } else {
                    Utils.setNA(res, i);
View Full Code Here

                    if (!(b instanceof RList)) { throw RError.getSelectMoreThanOne(ast); }
                    RList l = (RList) b;
                    Names names = l.names();
                    if (names == null) { throw RError.getNoSuchIndexAtLevel(ast, i + 1); }
                    RSymbol s = RSymbol.getSymbol(index.getString(i));
                    int indexv = names.map(s);
                    if (indexv == -1) { throw RError.getNoSuchIndexAtLevel(ast, i + 1); }
                    b = l.getRAny(indexv);
                }
            }
            // selection at the last level
View Full Code Here

            RArray a = (RArray) b;
            Names names = a.names();
            int indexv = -1;
            if (names != null) {
                RSymbol s = RSymbol.getSymbol(index.getString(i));
                indexv = names.map(s);
            }
            boolean isList = a instanceof RList;
            if (indexv != -1) {
                if (isList) {
                    return ((RList) a).getRAny(indexv);
View Full Code Here

            }
            int bsize = base.size();
            int pos = -1;
            RSymbol symbol = RSymbol.getSymbol(index);
            if (names != null) {
                pos = names.map(symbol);
            }
            if (pos != -1) {
                // updating
                if (base == typedBase && !base.isShared()) {
                    base.set(pos, rawValue);
View Full Code Here

        public static RAny deleteElement(RList base, String index) {
            Names names = base.names();
            int deleteIndex = -1;
            if (names != null) {
                deleteIndex = names.map(RSymbol.getSymbol(index));
            }
            if (deleteIndex != -1) {
                return deleteElement(base, deleteIndex);
            } else {
                return Utils.dropDimensions(base);
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.