Java BitSet filter(double[] data, BitSet mask)

Here you can find the source of filter(double[] data, BitSet mask)

Description

filter

License

Open Source License

Declaration

public static double[] filter(double[] data, BitSet mask) 

Method Source Code

//package com.java2s;
/*//w  w  w  .j ava 2 s  .  c  o m
 * ------------------------------------------------------------------------ Copyright 2016 by Aaron
 * Hart Email: Aaron.Hart@gmail.com
 *
 * This program is free software; you can redistribute it and/or modify it under the terms of the
 * GNU General Public License, Version 3, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program; if
 * not, see <http://www.gnu.org/licenses>.
 * ---------------------------------------------------------------------
 *
 * Created on December 14, 2016 by Aaron Hart
 */

import java.util.BitSet;

public class Main {
    public static double[] filter(double[] data, BitSet mask) {
        double[] result = new double[mask.cardinality()];
        int j = 0;
        for (int i = 0; i < data.length; i++) {
            if (mask.get(i)) {
                result[j] = data[i];
                j++;
            }
        }
        return result;
    }
}

Related

  1. ensureExclusivity(BitSet bs1, BitSet bs2)
  2. escape(String s, BitSet safeChars)
  3. expand(final BitSet bits, final BitSet add)
  4. extractLong(BitSet bitSet, int from, int to)
  5. extractSetBitsMsgFromTxSet(final BitSet txSet)
  6. filterByIndices(List list, BitSet filter)
  7. filtered(final Iterator iterator, final BitSet filter)
  8. findTrue(BitSet set)
  9. firstIndexOfChar(String sqlString, BitSet keys, int startindex)