Now with a 22-recipe survey_dataset.xml.

Unit test shows an example of checking that Honey cake contains gluten, eggs and spice but not red meat, shellfish or poultry.
This commit is contained in:
Woody Folsom
2012-03-09 21:04:45 -05:00
parent fc3709dda7
commit a021dc2fc0
6 changed files with 2978 additions and 10 deletions

View File

@@ -0,0 +1,33 @@
package net.woodyfolsom.cs6601.p2;
import java.util.List;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
@XStreamAlias("ing-div")
public class IngredientDivision {
@XStreamImplicit
private List<Ingredient> ingredients;
private String title;
public boolean contains(Ingredient.TYPE ingredientType) {
for (Ingredient ingredient : ingredients) {
if (ingredient.isType(ingredientType)) {
return true;
}
}
return false;
}
public Ingredient getIngredient(int index) {
return ingredients.get(index);
}
public int getIngredientsSize() {
return ingredients.size();
}
public String getTitle() {
return title;
}
}