|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ca.spaz.cron.database.NutrientTable
public abstract class NutrientTable
A base class for a group of related nutrient values Provides common support for loading and updating the database. The nutrient table is expected to have field names that match the names and types of the corresponding database table. This greatly simplifies maintaining the database and generating UI forms through reflection.
Constructor Summary | |
---|---|
NutrientTable()
|
|
NutrientTable(Food f)
|
Method Summary | |
---|---|
void |
addFood(NutrientTable toAdd,
double weight)
Add the nutrients in the given table to our total |
protected abstract java.lang.String |
doGetTableName()
Subclasses must implement this in order to supply their table name. |
double |
getAmountByTag(java.lang.String tag)
Get the amount of a nutrient by the tag name |
java.lang.String |
getTableName()
Get the name of the table corresponding to this class. |
void |
setAmountByTag(java.lang.String tag,
double val)
Set the amount of a nutrient by the tag name |
void |
updateDatabase()
Update the existing food information |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NutrientTable()
public NutrientTable(Food f)
Method Detail |
---|
public java.lang.String getTableName()
protected abstract java.lang.String doGetTableName()
public void addFood(NutrientTable toAdd, double weight)
toAdd
- the nutrients ratios to addweight
- multiplier for the amount in the added nutrientspublic double getAmountByTag(java.lang.String tag)
tag
- the tag name of the nutrient
public void setAmountByTag(java.lang.String tag, double val)
tag
- the tag name of the nutrientval
- the amount of the nutrient, or 0 if none foundpublic void updateDatabase()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |