All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ngmf.util.cosu.Sample Maven / Gradle / Ivy

There is a newer version: 0.8.1
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ngmf.util.cosu;

/**
 *
 * @author od
 */
class Sample {

    double[] x;
    double fx;

    Sample() {
    }

    Sample(double[] x, double fx) {
        this.fx = fx;
        if (x == null) {
            return;
        }
        this.x = new double[x.length];
        for (int i = 0; i < x.length; i++) {
            this.x[i] = x[i];
        }
    }

    @Override
    public Sample clone() {
        Sample cpy = new Sample();
        cpy.x = new double[x.length];
        for (int i = 0; i < x.length; i++) {
            cpy.x[i] = x[i];
        }
        cpy.fx = fx;
        return cpy;
    }

    @Override
    public String toString() {
        String s = "";
        for (int i = 0; i < x.length; i++) {
            s += x[i] + "\t";
        }
        return s += fx;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy