jInfer

cz.cuni.mff.ksi.jinfer.iss.utils
Class Utils

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.iss.utils.Utils

public final class Utils
extends Object

Attribute statistics module utils.


Field Summary
static Format FORMAT
          Formatter that formats numbers to a maximum of 5 fraction digits.
static String NA
           
 
Method Summary
static
<T> List<T>
append(List<T> list, T element)
          Returns a new list, constructed from the provided list with the provided element appended at the end.
static String boolToString(boolean b)
          Converts a boolean to String in form yes/no.
static long delta(long from)
          Returns the number of milliseconds passed since the specified time (again in milliseconds).
static Pair<IdSet,Quality> getBest(Experiment experiment, List<IdSet> solutions)
          Returns the best solution from the provided pool in the context of the provided experiment.
static int getIterations()
          Gets the number of iterations from NB options.
static IdSet getWorst(Experiment experiment, List<IdSet> solutions)
          Returns the worst solution from the provided pool in the context of the provided experiment.
static long time()
          Returns the current time in milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FORMAT

public static final Format FORMAT
Formatter that formats numbers to a maximum of 5 fraction digits.


NA

public static final String NA
See Also:
Constant Field Values
Method Detail

boolToString

public static String boolToString(boolean b)
Converts a boolean to String in form yes/no.

Parameters:
b - Boolean to be converted.
Returns:
"yes" or "no".

getBest

public static Pair<IdSet,Quality> getBest(Experiment experiment,
                                          List<IdSet> solutions)
Returns the best solution from the provided pool in the context of the provided experiment.

Parameters:
experiment - Experiment, in context of which to find the best solution.
solutions - List of solutions among which to find the best one.
Returns:
Best solution along with its quality.

getWorst

public static IdSet getWorst(Experiment experiment,
                             List<IdSet> solutions)
Returns the worst solution from the provided pool in the context of the provided experiment.

Parameters:
experiment - Experiment, in context of which to find the worst solution.
solutions - List of solutions among which to find the worst one.
Returns:
Worst solution.

append

public static <T> List<T> append(List<T> list,
                                 T element)
Returns a new list, constructed from the provided list with the provided element appended at the end.

Type Parameters:
T - Type parameter.
Parameters:
list - List to append to.
element - Element to be appended.
Returns:
New appended list.

time

public static long time()
Returns the current time in milliseconds. Useless in absolute context, only in relative, when measuring time spent in some operation.

Returns:
Current time in milliseconds.

delta

public static long delta(long from)
Returns the number of milliseconds passed since the specified time (again in milliseconds).

Parameters:
from - Time from which to calculate the difference.
Returns:
How many milliseconds have passed since the specified time.

getIterations

public static int getIterations()
Gets the number of iterations from NB options.


jInfer

Generated on Fri Dec 9 00:01:25 CET 2011