Java.misc
Class Misc

java.lang.Object
  extended by Java.misc.Misc

public class Misc
extends java.lang.Object

Since:
1.0

Constructor Summary
Misc()
           
 
Method Summary
static double getDouble(java.lang.String s, int line_no)
          Reads a real number from a String in an input file on line line_no
static int getInteger(java.lang.String s, int line_no)
          returns index after underscore in string s if s ends with underscore, return -1
static int[] getIntegers(java.lang.String s, int line_no)
          returns 2 integer indeces after underscore in string s
static double Round(double d, int Ndec)
          Round to a double to Ndec decimals
static java.lang.String[] split(java.lang.String s, int line_no, int debug)
          Split an input String at spaces, return array of Strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Misc

public Misc()
Method Detail

Round

public static double Round(double d,
                           int Ndec)
Round to a double to Ndec decimals

Parameters:
d - the input real value
Ndec - number of decimals
Returns:
the rounded value having Ncec decimals

split

public static java.lang.String[] split(java.lang.String s,
                                       int line_no,
                                       int debug)
Split an input String at spaces, return array of Strings. If empty line, return null

Parameters:
s - the input String
line_no - row number in input file
debug - debug level, 0=no output, 1=average, 2=much
Returns:
an array of Strings

getInteger

public static int getInteger(java.lang.String s,
                             int line_no)
returns index after underscore in string s if s ends with underscore, return -1


getIntegers

public static int[] getIntegers(java.lang.String s,
                                int line_no)
returns 2 integer indeces after underscore in string s


getDouble

public static double getDouble(java.lang.String s,
                               int line_no)
Reads a real number from a String in an input file on line line_no

Parameters:
s - input String representing a double value
line_no - current row in input file
Returns:
a real number.