View Javadoc

1   /*
2    *******************************************************************************
3    * Copyright (c) 2005 Chris Rose and AIMedia
4    * All rights reserved. USDANutrientInfo and the accompanying materials
5    * are made available under the terms of the Common Public License v1.0
6    * which accompanies this distribution, and is available at
7    * http://www.eclipse.org/legal/cpl-v10.html
8    * 
9    * Contributors:
10   *     Chris Rose
11   *******************************************************************************/
12  package ca.spaz.cron.datasource.sql.USDAsr17;
13  
14  import java.util.HashMap;
15  
16  public class USDANutrientInfo {
17     
18     private static HashMap nutrientMap;
19     
20     public USDANutrientInfo() {}
21  
22     public String table;
23  
24     public String tag;
25     
26     private static void makeNutrientMap() {
27        addNutrient("AminoAcids", "TRP", "501");
28        addNutrient("AminoAcids", "THR", "502");
29        addNutrient("AminoAcids", "ILE", "503");
30        addNutrient("AminoAcids", "LEU", "504");
31        addNutrient("AminoAcids", "LYS", "505");
32        addNutrient("AminoAcids", "MET", "506");
33        addNutrient("AminoAcids", "CYS", "507");
34        addNutrient("AminoAcids", "PHE", "508");
35        addNutrient("AminoAcids", "TYR", "509");
36        addNutrient("AminoAcids", "VAL", "510");
37        addNutrient("AminoAcids", "ARG", "511");
38        addNutrient("AminoAcids", "HIS", "512");
39        addNutrient("AminoAcids", "ALA", "513");
40        addNutrient("AminoAcids", "ASP", "514");
41        addNutrient("AminoAcids", "GLU", "515");
42        addNutrient("AminoAcids", "GLY", "516");
43        addNutrient("AminoAcids", "PRO", "517");
44        addNutrient("AminoAcids", "SER", "518");
45        addNutrient("AminoAcids", "HYP", "521");
46     
47        addNutrient("Minerals", "calcium", "301");
48        addNutrient("Minerals", "copper", "312");
49        addNutrient("Minerals", "iron", "303");
50        addNutrient("Minerals", "magnesium", "304");
51        addNutrient("Minerals", "manganese", "315");
52        addNutrient("Minerals", "phosphorus", "305");
53        addNutrient("Minerals", "potassium", "306");
54        addNutrient("Minerals", "selenium", "317");
55        addNutrient("Minerals", "sodium", "307");
56        addNutrient("Minerals", "zinc", "309");
57     
58        addNutrient("MacroNutrients", "kcals", "208");
59        addNutrient("MacroNutrients", "protein", "203");
60        addNutrient("MacroNutrients", "lipid", "204");
61        addNutrient("MacroNutrients", "carbs", "205");
62        addNutrient("MacroNutrients", "ash", "207");
63        addNutrient("MacroNutrients", "starch", "209");
64        addNutrient("MacroNutrients", "water", "255");
65        addNutrient("MacroNutrients", "kj", "268");
66        addNutrient("MacroNutrients", "sugar", "269");
67        addNutrient("MacroNutrients", "fiber", "291");
68        
69        addNutrient("Vitamins", "vit_a", "318");
70        addNutrient("Vitamins", "retinol", "319");
71        addNutrient("Vitamins", "alpha_carotene", "322");
72        addNutrient("Vitamins", "beta_carotene", "321");
73        addNutrient("Vitamins", "beta_cryptoxanthin", "334");
74        addNutrient("Vitamins", "lycopene", "337");
75        addNutrient("Vitamins", "lutein", "338");
76        addNutrient("Vitamins", "vit_b6", "415");
77        addNutrient("Vitamins", "vit_b12", "418");
78        addNutrient("Vitamins", "vit_c", "401");
79        addNutrient("Vitamins", "vit_d", "324");
80        addNutrient("Vitamins", "vit_e", "323");
81        addNutrient("Vitamins", "beta_tocopherol", "341");
82        addNutrient("Vitamins", "delta_tocopherol", "343");
83        addNutrient("Vitamins", "gamma_tocopherol", "342");
84        addNutrient("Vitamins", "vit_k", "430");
85        addNutrient("Vitamins", "thiamin", "404");
86        addNutrient("Vitamins", "riboflavin", "405");
87        addNutrient("Vitamins", "niacin", "406");
88        addNutrient("Vitamins", "panto_acid", "410");
89        addNutrient("Vitamins", "folate", "417");
90              
91        addNutrient("Lipids", "saturated", "606");
92        addNutrient("Lipids", "monounsaturated", "645");
93        addNutrient("Lipids", "polyunsaturated", "646");
94        addNutrient("Lipids", "transfats", "605");
95        addNutrient("Lipids", "cholesterol", "601");
96        addNutrient("Lipids", "phytosterol", "636");
97        
98        addNutrient("Lipids", "omega3", "621");
99        addNutrient("Lipids", "omega3", "629");
100       addNutrient("Lipids", "omega3", "631");
101       addNutrient("Lipids", "omega3", "851");
102       
103       addNutrient("Lipids", "omega6", "672");
104       addNutrient("Lipids", "omega6", "675");
105       addNutrient("Lipids", "omega6", "685");
106    }
107    
108    private static void addNutrient(String table, String tag, String nid) {
109       USDANutrientInfo ni = new USDANutrientInfo();
110       ni.table = table;
111       ni.tag = tag;
112       getNutrientMap().put(nid, ni);
113    }
114    
115    public static HashMap getNutrientMap() {
116       if (nutrientMap == null) {
117          nutrientMap = new HashMap();
118          makeNutrientMap();
119       }
120       return nutrientMap;
121    }
122 }