metab
Class NMSubject

java.lang.Object
  extended bymetab.NMSubject
All Implemented Interfaces:
java.io.Serializable

public class NMSubject
extends java.lang.Object
implements java.io.Serializable

The NMSubject class handles the bulk of the computations for the compartmental model. An instance of the class is representative of one human subject. The subject contains exactly one Stomach, Intestine, and LeanBodyMass compartment. See the constructor for the information required for using this class. Values for the bitFlag argurment need to be or'd ( | ) together, with one option set for each category. The categories are food present in the stomach, drinking history, and units of measurement. When _METRIC is selected as the units of measurement, cm and kg should be used for the height and weight arguments, and when _IMPERIAL is selected, in and lbs should be used. When returning the bitFlag, the user should check to see if the _ERROR bit is checked. If so, then the user constructed the object incorrectly and should re-initialize it appropriately. This class keeps track of BAC during each minute time interval and final BAC should be determined from the array determined by the getBAC method.

Version:
1.29
Author:
Levi Blackstone, Matthew Woller
See Also:
Stomach, Intestine, LeanBodyMass, Subject, Drink, DrinkTime, TDSubject, Serialized Form

Field Summary
static int _AVERAGE_MEAL
          Standard value representing an average meal was eaten recently.
static int _ERROR
          Standard value representing that an error occured while retrieving info.
static int _HEAVY_DRINKER
          Standard value representing that the subject is a heavy drinker.
static int _IMPERIAL
          Standard value representing that input units are in Imperial units.
static int _LARGE_MEAL
          Standard value representing a large meal was eaten recently.
static int _LIGHT_DRINKER
          Standard value representing that the subject is a light drinker.
static int _LIGHT_MEAL
          Standard value representing a light meal was eaten recently.
static int _METRIC
          Standard value representing that input units are in metric units.
static int _MODERATE_DRINKER
          Standard value representing that the subject is a moderate drinker.
static int _NO_MEAL
          Standard value representing no meal was eaten recently.
private static double absorbVolume
          Amount of liquid exiting the intestine through the villi (L/min).
private  int age
          Age in years.
private  double[] BACvalues
          Array of the value for the BAC at every time interval.
private  int bitFlag
          Bitflag representing all set switches.
private  LeanBodyMass body
          Represents the subject's non-fatty body mass.
private  Drink[] drinks
          Array of all the drinks consumed by the subject.
private  DrinkTime end
          Represents the time that the subject stopped consuming their drinks.
private  char gender
          Represents the gender of the subject ('M' or 'F').
private  double height
          Height (cm).
private  Intestine intestine
          Represents the subject's small intestine.
private static double newFluid
          Amount of gastric fluid being produced in the stomach (L/min).
private  double passingEthanol
          Represents the amount of ethanol to be introduced each cycle (g/min).
private  double passingVolume
          Represents the amount of liquid to be introduced each cycle (L/min).
private  double peakBAC
          Represents the highest BAC achieved during the time interval.
private static double squirtVolume
          Amount of liquid exiting the stomach through pyloric sphincter (L/min).
private  DrinkTime start
          Represents the time that the subject started consuming their drinks.
private  Stomach stomach
          Represents the subject's stomach.
private  java.lang.String subjectName
          Represents the name and/or description of the subject.
private  double TBW
          Represents the total water content of the body (L).
private  int timeForZeroEthanol
          Represents number of minutes after the specified amount at which point the BAC would become zero.
private  double totalEthanol
          Represents the total amount of ethanol to be introduced (g).
private  int totalMinutes
          Total number of minutes in drinking interval.
private  double totalVolume
          Represents the total amount of liquid to be introduced (L).
private  double weight
          Weight (kg).
 
Constructor Summary
(package private) NMSubject(int age, double height, char gender, double weight, Drink[] drinks, DrinkTime start, DrinkTime end, java.lang.String subjectName, int bitFlag)
          Constructor for the New Model subject class.
 
Method Summary
 int getAge()
          Retrieves the age of the subject.
 double[] getBAC()
          Retrieves the list of BACvalues recorded while the model was running.
 int getBitF()
          Retrieves the options set in the subject's bit flag.
 Drink[] getDrinks()
          Retrieves the list of drinks consumed by the subject.
 DrinkTime getEndTime()
          Retrieves the time when the subject stopped drinking.
 char getGender()
          Retrieves the gender of the subject.
 double getHeight()
          Retrieves the height of the subject depending on the system of measurement selected.
 int getMinutes()
          Retrieves the total number of minutes for the drinking time.
 java.lang.String getName()
          Retrieves the name and description of the subject.
 double getPeakBAC()
          Retrieves the peak BAC achieved during the drinking period.
 DrinkTime getStartTime()
          Retrieves the time when the subject stopped drinking.
 double getTBW()
          Retrieves the Total Body Water (TBW) for the subject.
 double getWeight()
          Retrieves the weight of the subject depending on the system of measurement selected.
private  void peakBAC()
          Checks to see if a new peak BAC has been reached.
 boolean runModel()
          Runs the compartmental model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_LIGHT_MEAL

public static final int _LIGHT_MEAL
Standard value representing a light meal was eaten recently.

See Also:
Constant Field Values

_AVERAGE_MEAL

public static final int _AVERAGE_MEAL
Standard value representing an average meal was eaten recently.

See Also:
Constant Field Values

_LARGE_MEAL

public static final int _LARGE_MEAL
Standard value representing a large meal was eaten recently.

See Also:
Constant Field Values

_NO_MEAL

public static final int _NO_MEAL
Standard value representing no meal was eaten recently.

See Also:
Constant Field Values

_LIGHT_DRINKER

public static final int _LIGHT_DRINKER
Standard value representing that the subject is a light drinker.

See Also:
Constant Field Values

_MODERATE_DRINKER

public static final int _MODERATE_DRINKER
Standard value representing that the subject is a moderate drinker.

See Also:
Constant Field Values

_HEAVY_DRINKER

public static final int _HEAVY_DRINKER
Standard value representing that the subject is a heavy drinker.

See Also:
Constant Field Values

_METRIC

public static final int _METRIC
Standard value representing that input units are in metric units.

See Also:
Constant Field Values

_IMPERIAL

public static final int _IMPERIAL
Standard value representing that input units are in Imperial units.

See Also:
Constant Field Values

_ERROR

public static final int _ERROR
Standard value representing that an error occured while retrieving info.

See Also:
Constant Field Values

squirtVolume

private static final double squirtVolume
Amount of liquid exiting the stomach through pyloric sphincter (L/min).

See Also:
Constant Field Values

absorbVolume

private static final double absorbVolume
Amount of liquid exiting the intestine through the villi (L/min).

See Also:
Constant Field Values

newFluid

private static final double newFluid
Amount of gastric fluid being produced in the stomach (L/min).

See Also:
Constant Field Values

bitFlag

private int bitFlag
Bitflag representing all set switches.


age

private int age
Age in years.


timeForZeroEthanol

private int timeForZeroEthanol
Represents number of minutes after the specified amount at which point the BAC would become zero.


totalMinutes

private int totalMinutes
Total number of minutes in drinking interval.


BACvalues

private double[] BACvalues
Array of the value for the BAC at every time interval.


height

private double height
Height (cm).


weight

private double weight
Weight (kg).


peakBAC

private double peakBAC
Represents the highest BAC achieved during the time interval.


totalEthanol

private double totalEthanol
Represents the total amount of ethanol to be introduced (g).


totalVolume

private double totalVolume
Represents the total amount of liquid to be introduced (L).


TBW

private double TBW
Represents the total water content of the body (L).


passingEthanol

private double passingEthanol
Represents the amount of ethanol to be introduced each cycle (g/min).


passingVolume

private double passingVolume
Represents the amount of liquid to be introduced each cycle (L/min).


gender

private char gender
Represents the gender of the subject ('M' or 'F').


subjectName

private java.lang.String subjectName
Represents the name and/or description of the subject.


drinks

private Drink[] drinks
Array of all the drinks consumed by the subject.


start

private DrinkTime start
Represents the time that the subject started consuming their drinks.


end

private DrinkTime end
Represents the time that the subject stopped consuming their drinks.


stomach

private Stomach stomach
Represents the subject's stomach.


intestine

private Intestine intestine
Represents the subject's small intestine.


body

private LeanBodyMass body
Represents the subject's non-fatty body mass.

Constructor Detail

NMSubject

NMSubject(int age,
          double height,
          char gender,
          double weight,
          Drink[] drinks,
          DrinkTime start,
          DrinkTime end,
          java.lang.String subjectName,
          int bitFlag)
Constructor for the New Model subject class.

Parameters:
age - int representing the age of the subject in years.
height - double representing the height of the subject.
gender - char representing the gender of the subject.
weight - double representing the weight of the subject.
drinks - Drink array representing all the drinks drank by the subject.
start - DrinkTime representing the time that the subject started drinking.
end - DrinkTime representing the time that the subject stopped drinking.
subjectName - String representing the subjects name and / or description.
bitFlag - int representing all set switches.
Method Detail

getAge

public int getAge()
Retrieves the age of the subject.

Returns:
int representing the subject's age (yrs).

getBAC

public double[] getBAC()
Retrieves the list of BACvalues recorded while the model was running. One value will have been recorded for each minute the subject was drinking.

Returns:
Array of doubles containing the chronological list of BAC values.

getBitF

public int getBitF()
Retrieves the options set in the subject's bit flag.

Returns:
int representing the bit flag.

getDrinks

public Drink[] getDrinks()
Retrieves the list of drinks consumed by the subject.

Returns:
Array of Drinks containing the drink objects.

getEndTime

public DrinkTime getEndTime()
Retrieves the time when the subject stopped drinking.

Returns:
DrinkTime representing the end time.

getHeight

public double getHeight()
Retrieves the height of the subject depending on the system of measurement selected.

Returns:
double representing the height (cm or in).

getGender

public char getGender()
Retrieves the gender of the subject.

Returns:
char representing gender ('M' or 'F').

getMinutes

public int getMinutes()
Retrieves the total number of minutes for the drinking time.

Returns:
int representing the total number of minutes.

getName

public java.lang.String getName()
Retrieves the name and description of the subject.

Returns:
String containing the subject name.

getPeakBAC

public double getPeakBAC()
Retrieves the peak BAC achieved during the drinking period.

Returns:
double representing the peak BAC.

getStartTime

public DrinkTime getStartTime()
Retrieves the time when the subject stopped drinking.

Returns:
DrinkTime representing the end time.

getTBW

public double getTBW()
Retrieves the Total Body Water (TBW) for the subject.

Returns:
double representing the TBW.

getWeight

public double getWeight()
Retrieves the weight of the subject depending on the system of measurement selected.

Returns:
double representing the weight (kg or lb).

peakBAC

private void peakBAC()
Checks to see if a new peak BAC has been reached.


runModel

public boolean runModel()
Runs the compartmental model. This method should only be run if all values have already been declared and initialized, otherwise, unexpected results may occur.

Returns:
boolean value that represents whether the method executed successfully. true if successful, otherwise, unsuccessful.