package models.campaign;

import java.util.ArrayList;

/**
 * A static class for all objectives that are valid
 * 
 * Can only have one per level
 */
public class Objectives {
	/**
	 * Pick up the amount of bamboo specified in the level file
	 */
	public static final String PICKXBAMBOO = "pick up x bamboo";
	/**
	 * Must use at least one if statement 
	 */
	public static final String IFSTATEMENT = "use an if statement"; 
	/**
	 * Must use at least one if/else statement
	 */
	public static final String IFELSESTATEMENT = "use an if/else statement";
	/**
	 * Must use at least one while statement
	 */
	public static final String WHILESTATEMENT = "use a while statement";
	/**
	 * Must use at least one loop statement
	 */
	public static final String LOOP = "use a loop statement";
	/**
	 * Gets all the possible objectives that a level can have
	 * 
	 * @return  the list of all possible objectives
	 */
	public static ArrayList<String> getPossibleObjectives(){ 
		ArrayList<String> possibleObjectives = new ArrayList<String>(); 
		possibleObjectives.add(Objectives.PICKXBAMBOO); 
		possibleObjectives.add(Objectives.IFSTATEMENT);
		possibleObjectives.add(Objectives.IFELSESTATEMENT);
		possibleObjectives.add(Objectives.WHILESTATEMENT);
		possibleObjectives.add(Objectives.LOOP);
		return possibleObjectives; 
	}
	/**
	 * Checks to see if the objective is valid
	 * 
	 * @param objective  the objective to check 
	 * @return  true iff the objective is valid
	 */
	public static boolean validate(String objective){ 
		return Objectives.getPossibleObjectives().contains(objective); 
	}
}

@@ -46,16 +46,43 @@
 rayList;
+%0Aimport java.util.Iterator;
 %0A%0A/**%0A *
@@ -943,25 +943,24 @@
  static 
-ArrayList
+Iterator
 %3CString%3E
@@ -1331,16 +1331,27 @@
 jectives
+.iterator()
 ; %0A%09%7D%0A%09/
@@ -1552,19 +1552,36 @@
 ve)%7B
- 
 %0A%09%09
-return 
+Iterator%3CString%3E possible
 Obje
@@ -1586,17 +1586,19 @@
 jectives
-.
+ = 
 getPossi
@@ -1616,30 +1616,142 @@
 es()
-.contains(objective); 
+;%0A%09%09while(possibleObjectives.hasNext())%7B%0A%09%09%09if(possibleObjectives.next().equals(objective))%7B%0A%09%09%09%09return true;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09return false;
 %0A%09%7D%0A

Add Iterator to the Objectives