|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ca.spaz.cron.datasource.AbstractFoodDataSource ca.spaz.cron.datasource.www.AbstractWWWDatasource ca.spaz.cron.datasource.www.NutritionDataDatasource
public class NutritionDataDatasource
A datasource that is tied to the website http://www.nutritiondata.com/
Method Summary | |
---|---|
boolean |
containsFood(Food food)
Determine if this datasource contains the specified food. |
static NutritionDataDatasource |
createReadonlyFoodSource()
|
protected void |
doClose()
|
protected java.util.List |
doFindAllFoods()
Retrieve a list of all foods in this datasource. |
protected java.util.List |
doFindFoods(java.lang.String[] keys)
Retrieve a List of all foods in this particular Datasource. |
protected java.util.List |
doFindFoods(java.lang.String[] keys,
java.lang.String foodGroup,
java.lang.String source)
Retrieve a List of all foods in this particular Datasource having
the given food group and source. |
protected java.util.List |
doGetFoodGroups()
Retrieve a list of food groups for this data source. |
protected java.util.List |
doGetMeasuresFor(Food food)
Return a List of Measure objects for the provided food. |
protected void |
doGetNutrientsFor(Food food,
NutrientTable nutrients)
Fill the provided NutrientTable with the nutrients associated with the
Food . |
protected java.util.List |
doGetSources()
Retrieve a list of Sources available from this data source. |
boolean |
isAvailable()
Determines if the datasource is operable and available. |
static void |
main(java.lang.String[] args)
|
Methods inherited from class ca.spaz.cron.datasource.www.AbstractWWWDatasource |
---|
close, getFoodGroups, getFoodGroups, getSources, initialize, isListable, isSearchable, readURLAsString |
Methods inherited from class ca.spaz.cron.datasource.AbstractFoodDataSource |
---|
diffSource, findAllFoods, findFoods, findFoods, getLastError, getMeasuresFor, getName, getNutrientsFor, notNull, registerError, sameSource, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static final NutritionDataDatasource createReadonlyFoodSource()
protected java.util.List doFindAllFoods()
AbstractFoodDataSource
doFindAllFoods
in class AbstractWWWDatasource
Food
objects consisting of every food in the datasource.protected java.util.List doGetSources()
AbstractWWWDatasource
doGetSources
in class AbstractWWWDatasource
List
of sources for this datasource.protected java.util.List doGetFoodGroups()
AbstractWWWDatasource
doGetFoodGroups
in class AbstractWWWDatasource
List
of FoodGroup
implementations
containing all of the food groups in this data source.protected void doClose()
doClose
in class AbstractWWWDatasource
protected java.util.List doFindFoods(java.lang.String[] keys)
AbstractFoodDataSource
List
of all foods in this particular Datasource.
doFindFoods
in class AbstractWWWDatasource
keys
- the keys to search on. This searches with an AND relation.
Food
objects matching the criteria.protected java.util.List doFindFoods(java.lang.String[] keys, java.lang.String foodGroup, java.lang.String source)
AbstractFoodDataSource
List
of all foods in this particular Datasource having
the given food group and source.
doFindFoods
in class AbstractWWWDatasource
keys
- the keys to search on. This searches with an AND relation.foodGroup
- the food group to search for. null
to ignore.source
- the source of this food item. null
to ignore.
Food
objects matching the criteria.protected java.util.List doGetMeasuresFor(Food food)
AbstractFoodDataSource
List
of Measure
objects for the provided food.
doGetMeasuresFor
in class AbstractWWWDatasource
food
- a Food
object to find the measures for
List
that is guaranteed to contain only Measure
objects.protected void doGetNutrientsFor(Food food, NutrientTable nutrients)
AbstractFoodDataSource
NutrientTable
with the nutrients associated with the
Food
.
doGetNutrientsFor
in class AbstractWWWDatasource
food
- The food item to load fromnutrients
- the NutrientTable
to fill.public boolean isAvailable()
IFoodDatasource
true
if this datasource is functioning, false
otherwisepublic static void main(java.lang.String[] args)
public boolean containsFood(Food food)
IFoodDatasource
Food
in this datasource, the Food's SourceUID
is equal
to that of the food on the command line.
food
- The food to test for
true
if there is a Food
in this datasource matching the
provided one.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |