Example usage for org.apache.commons.lang3 ArrayUtils toPrimitive

List of usage examples for org.apache.commons.lang3 ArrayUtils toPrimitive

Introduction

In this page you can find the example usage for org.apache.commons.lang3 ArrayUtils toPrimitive.

Prototype

public static boolean[] toPrimitive(final Boolean[] array) 

Source Link

Document

Converts an array of object Booleans to primitives.

This method returns null for a null input array.

Usage

From source file:de.hsheilbronn.mi.domain.SvmMetaInformationImpl.java

@Override
public void setRhoConstants(List<Double> rhoConstants) {
    svmModel.rho = (ArrayUtils.toPrimitive(rhoConstants.toArray(new Double[rhoConstants.size()])));
}

From source file:com.orange.ocara.ui.activity.BaseActivityManagingAudit.java

public void launchAuditObjectsTest(AuditObject... auditObjects) {
    Long[] selectedAuditObjectIds = buildSelectedAuditObjectsList(new ArrayList<Long>(), auditObjects)
            .toArray(new Long[] {});
    long[] selectedObjects = ArrayUtils.toPrimitive(selectedAuditObjectIds);

    switch (audit.getLevel()) {

    case BEGINNER:
        AuditObjectsNoviceModeActivity_.intent(this).auditId(auditId).selectedObjects(selectedObjects).start();
        break;// w  w  w .  j  av  a  2 s  . c om

    case EXPERT:
    default:

        AuditObjectsExpertModeActivity_.intent(this).auditId(auditId).selectedObjects(selectedObjects).start();
        break;
    }
}

From source file:de.biomedical_imaging.traJ.DiffusionCoefficientEstimator.RegressionDiffusionCoefficientEstimator.java

/**
 * @return [0] = diffusion coefficent, [1] = slope, [2] = Intercept, [3] Goodness
 */// ww w .  j a v  a 2  s  . c  o m

public double[] getDiffusionCoefficient(Trajectory t, double fps) {
    if (t.size() == 1) {
        return null;
    }
    ArrayList<Double> xDataList = new ArrayList<Double>();
    ArrayList<Double> yDataList = new ArrayList<Double>();
    double msdhelp = 0;
    if (lagMin == lagMax) {
        xDataList.add(0.0);
        yDataList.add(0.0);
    }
    msdevaluator.setTrajectory(t);
    msdevaluator.setTimelag(lagMin);

    for (int i = lagMin; i < lagMax + 1; i++) {
        msdevaluator.setTimelag(i);
        double[] res = msdevaluator.evaluate();
        msdhelp = res[0];
        int N = (int) res[2];
        for (int j = 0; j < N; j++) {
            xDataList.add(i * 1.0 / fps);
            yDataList.add(msdhelp);
        }
    }
    double[] xdata = ArrayUtils.toPrimitive(xDataList.toArray(new Double[0]));
    double[] ydata = ArrayUtils.toPrimitive(yDataList.toArray(new Double[0]));
    StraightLineFit fdf = new StraightLineFit();
    fdf.doFit(xdata, ydata);

    result = new double[] { fdf.getB() / (2.0 * t.getDimension()), fdf.getB() * 2.0 * t.getDimension(),
            fdf.getA(), fdf.getGoodness() };
    return result;
}

From source file:de.romankreisel.faktotum.beans.BundesbruderBean.java

public BufferedImage getImageFromByteArray(Byte[] array) throws IOException {
    byte[] primitiveArray = ArrayUtils.toPrimitive(array);
    return this.getImageFromByteArray(primitiveArray);
}

From source file:net.sf.sessionAnalysis.SessionVisitorArrivalAndCompletionRate.java

public void handleEOF() {
    arrivalTimestampsSorted = ArrayUtils.toPrimitive(arrivalTimestamps.toArray(new Long[] {}));
    Arrays.sort(arrivalTimestampsSorted);
    completionTimestampsSorted = ArrayUtils.toPrimitive(completionTimestamps.toArray(new Long[] {}));
    Arrays.sort(completionTimestampsSorted);
    this.computeRates();
    this.computeNumConcurrentSessionsOverTime();
    this.computeMaxSessionsPerInterval();
}

From source file:de.hsheilbronn.mi.domain.SvmMetaInformationImpl.java

@Override
public void setLabelForEachClass(List<Integer> labelForEachClass) {
    svmModel.label = (ArrayUtils.toPrimitive(labelForEachClass.toArray(new Integer[labelForEachClass.size()])));
}

From source file:jat.examples.ephemeris.DE405PropagatePlot.java

double[][] getXYforPlot(ArrayList<Double> xsol, ArrayList<Double> ysol) {
    int arraySize = xsol.size();
    double[] xsolArray = ArrayUtils.toPrimitive(xsol.toArray(new Double[arraySize]));
    double[] ysolArray = ArrayUtils.toPrimitive(ysol.toArray(new Double[arraySize]));
    double[][] XY = new double[arraySize][2];
    for (int i = 0; i < arraySize; i++) {
        XY[i][0] = xsolArray[i];//  w w w  .j a va 2  s.c  om
        XY[i][1] = ysolArray[i];
    }

    return XY;
}

From source file:net.larry1123.elec.util.test.config.AbstractConfigTest.java

public void ByteArrayTest(String fieldName, Field testField) {
    try {//  w w  w .  jav a 2s . c o  m
        byte[] testFieldValue = ArrayUtils.toPrimitive((Byte[]) testField.get(getConfigBase()));
        Assert.assertTrue(ArrayUtils.isEquals(getPropertiesFile().getByteArray(fieldName), testFieldValue));
    } catch (IllegalAccessException e) {
        assertFailFieldError(fieldName);
    }
}

From source file:com.moto.miletus.application.ble.neardevice.NearDeviceHolder.java

/**
 * whoWins/*from w w w .  j a v a  2s  .c  o  m*/
 */
private void whoWins() {
    if (list.isEmpty() || list.size() == 1) {
        broadcastDeviceRoom(null);
        setNearDevice(null);
        return;
    }

    Set<BluetoothDevice> devices = new HashSet<>();
    for (Pair<BluetoothDevice, Double> pair : list) {
        devices.add(pair.first);
    }

    Set<Pair<BluetoothDevice, Double>> medians = new HashSet<>(devices.size());
    for (BluetoothDevice device : devices) {
        List<Double> rssi = new ArrayList<>();
        for (Pair<BluetoothDevice, Double> pair : list) {
            if (pair.first.equals(device)) {
                rssi.add(pair.second);
            }
        }

        Median median = new Median();
        median.setData(ArrayUtils.toPrimitive(rssi.toArray(new Double[rssi.size()])));
        medians.add(new Pair<>(device, median.evaluate()));
    }

    Pair<BluetoothDevice, Double> winner = new Pair<>(null, -999999d);
    for (Pair<BluetoothDevice, Double> median : medians) {
        if (median.second > winner.second) {
            winner = median;
        }
    }

    broadcastDeviceRoom(winner.first);
    setNearDevice(winner.first);
}

From source file:de.hsheilbronn.mi.domain.SvmMetaInformationImpl.java

@Override
public void setProbabilityA(List<Double> probabilityA) {
    svmModel.probA = (ArrayUtils.toPrimitive(probabilityA.toArray(new Double[probabilityA.size()])));
}