misc.rr.diabetes.be.calculator
Class CalculateIU

java.lang.Object
  extended by misc.rr.diabetes.be.calculator.CalculateIU
All Implemented Interfaces:
DiabetesInterface

public class CalculateIU
extends Object
implements DiabetesInterface

The class doing all the calculation. Can also be run standalone form the command-line.

Author:
Reinhold Rumberger

Field Summary
 
Fields inherited from interface misc.rr.diabetes.DiabetesInterface
stable, UNSTABLE_WARNING
 
Constructor Summary
CalculateIU()
           
 
Method Summary
static void main(String[] args)
           
static void printErr(String error)
          Print the passed error message to the currently selected output or System.err.
static void printMsg(String message)
          Print the passed message to the currently selected output or System.out.
static void printStdError()
          Prints a standard error message to the selected output.
static float rechnung(float BEFaktor, float BEs, float FreieBEs)
          Do the calculation for eating only.
static float rechnung(float zielWert, float KorrekturRegel, float Blutzucker, boolean Aceton)
          Do the calculation for correction only.
static float rechnung(float BEFaktor, float Zielwert, float KorrekturRegel, float BlutZucker, float BEs, float FreieBEs, boolean Aceton)
          Do the whole calculation.
static void resetErr()
          Reset the stderr to System.err.
static void resetOut()
          Reset the stdout to System.out.
static void resetRoundTo()
          Reset roundtonearest to 1
static float round(float f)
          Round to the nearest roundtonearest as set by setRoundTo(float).
static void setErr(PrintStream errPSTS)
          Set the current stderr to this PrintStream.
static void setErr(PrintWriter errPWTS)
          Set the current stderr to this PrintWriter.
static void setOut(PrintStream outPSTS)
          Set the current stdout to this PrintStream.
static void setOut(PrintWriter outPWTS)
          Set the current stdout to this PrintWriter.
static void setRoundTo(float roundToNearestTS)
          The nearest float to round to.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CalculateIU

public CalculateIU()
Method Detail

main

public static void main(String[] args)
                 throws IOException,
                        NumberFormatException
Throws:
IOException
NumberFormatException

printErr

public static void printErr(String error)
Print the passed error message to the currently selected output or System.err.


printMsg

public static void printMsg(String message)
Print the passed message to the currently selected output or System.out.


printStdError

public static void printStdError()
Prints a standard error message to the selected output.


rechnung

public static float rechnung(float BEFaktor,
                             float BEs,
                             float FreieBEs)
Do the calculation for eating only.

Parameters:
BEFaktor - BU ratio
BEs - BUs
FreieBEs - free BUs
Returns:
number of IUs to be injected.

rechnung

public static float rechnung(float zielWert,
                             float KorrekturRegel,
                             float Blutzucker,
                             boolean Aceton)
Do the calculation for correction only.

Parameters:
zielWert - target value
KorrekturRegel -
Blutzucker - BG
Aceton - ketones
Returns:
number of IUs to be injected.

rechnung

public static float rechnung(float BEFaktor,
                             float Zielwert,
                             float KorrekturRegel,
                             float BlutZucker,
                             float BEs,
                             float FreieBEs,
                             boolean Aceton)
Do the whole calculation.

Parameters:
BEFaktor - BU ratio
Zielwert - target value
KorrekturRegel -
BlutZucker - BG
BEs - BUsfloat
FreieBEs - free BUs
Aceton - ketones
Returns:
number of IUs to be injected.

resetErr

public static void resetErr()
Reset the stderr to System.err.


resetOut

public static void resetOut()
Reset the stdout to System.out.


resetRoundTo

public static void resetRoundTo()
Reset roundtonearest to 1


round

public static float round(float f)
Round to the nearest roundtonearest as set by setRoundTo(float).
Examples:

        
          f=0.1  setRoundTo(1)   => 0.0
          f=0.5  setRoundTo(1)   => 1.0
          f=0.1  setRoundTo(0.1) => 0.1
          f=0.15 setRoundTo(0.1) => 0.2
         
 

Parameters:
f - number to be rounded
Returns:
rounded value

setErr

public static void setErr(PrintStream errPSTS)
Set the current stderr to this PrintStream.


setErr

public static void setErr(PrintWriter errPWTS)
Set the current stderr to this PrintWriter.


setOut

public static void setOut(PrintStream outPSTS)
Set the current stdout to this PrintStream.


setOut

public static void setOut(PrintWriter outPWTS)
Set the current stdout to this PrintWriter.


setRoundTo

public static void setRoundTo(float roundToNearestTS)
The nearest float to round to.