Example usage for org.apache.commons.math3.distribution RealDistribution toString

List of usage examples for org.apache.commons.math3.distribution RealDistribution toString

Introduction

In this page you can find the example usage for org.apache.commons.math3.distribution RealDistribution toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.wormsim.utils.Utils.java

/**
 * Returns a string representation of the provided distribution. TODO: Make
 * this complete TODO: Make this compatible with custom distributions (or just
 * more complex ones).//from w ww.  j  a va 2  s  .  c o m
 *
 * @param dist The distribution to translate
 *
 * @return The distribution as a string.
 */
public static String realDistributionToString(RealDistribution dist) {
    if (dist instanceof ConstantRealDistribution) {
        return Double.toString(dist.getNumericalMean());
    } else if (dist instanceof UniformRealDistribution) {
        return "Uniform(" + dist.getSupportLowerBound() + "," + dist.getSupportUpperBound() + ")";
    } else if (dist instanceof NormalDistribution) {
        NormalDistribution dist2 = (NormalDistribution) dist;
        return "Normal(" + dist2.getMean() + "," + dist2.getStandardDeviation() + ")";
    } else {
        return dist.toString();
    }
}