Files
cs6601p2/src/net/woodyfolsom/cs6601/p2/IngredientDivision.java
Woody Folsom a021dc2fc0 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.
2012-03-09 21:04:45 -05:00

34 lines
717 B
Java

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;
}
}