Java Class RelativeAPI

package jekdev.study.ports;

import java.math.BigInteger;
import java.text.DecimalFormat;

/**
 * <p>Java code for the API of the port sampler example.</p>
 * <p>This class provides an API to statistics helpers.</p>
 *
 * @author Copyright 2012, XLOG Technologies GmbH, Switzerland
 * @version Jekejeke Prolog 0.9.2 (a fast and small prolog interpreter)
 */
public final class RelativeAPI {

    /**
     * <p>Retrieve the nano time.</p>
     * <p>Java method called from Prolog.</p>
     *
     * @return The nano time.
     */
    public static BigInteger nanoTime() {
        return BigInteger.valueOf(System.nanoTime());
    }

    /**
     * <p>Format a double value.</p>
     * <p>Java method called from Prolog.</p>
     *
     * @param p The format specification.
     * @param d The double value.
     * @return The formatted value.
     */
    public static String formatFloat(String p, Double d) {
        DecimalFormat df = new DecimalFormat(p);
        return df.format(d);
    }

}

Comments