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:
33
src/net/woodyfolsom/cs6601/p2/IngredientDivision.java
Normal file
33
src/net/woodyfolsom/cs6601/p2/IngredientDivision.java
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user