mulan.core
Class Util

java.lang.Object
  extended by mulan.core.Util

public class Util
extends Object

Class which provides various utility methods.

Author:
Jozef Vilcek

Constructor Summary
Util()
           
 
Method Summary
static String getNewLineSeparator()
          Returns a correct new line separator string for the underlying operating system.
static int RandomIndexOfMax(double[] array, Random rand)
          Procedure to find index of maximum value in the specified array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

RandomIndexOfMax

public static int RandomIndexOfMax(double[] array,
                                   Random rand)
Procedure to find index of maximum value in the specified array. If there is only one unique maximum, the index of this maximum is returned. If there are more values equal to the maximum, one of these values is randomly selected and its index is returned.

Parameters:
array - the array in which the maximum value should be find
rand - random instance used to select the value if more values equal to the maximum are present in the array
Returns:
the index of find maximum value

getNewLineSeparator

public static String getNewLineSeparator()
Returns a correct new line separator string for the underlying operating system.

Returns:
the new line separator string