package questions;

import java.util.Collection;

/**
 *  The QuestionBank contains a collection of Questions with methods to add, delete, and edit questions
 *  within the bank.
 */
public abstract class QuestionBank {
	Collection<Question> bank;

	/**
	 * Adds a new question into the question bank
	 */
	/*@
	  requires
	  	//
	  	// The given question must not have a questionID equal to a question already in the question bank
	  	//
	   	!(\exists Question q ; bank.contains(q) ; 
	   		q.questionID == ques.questionID)
	   		
	   		&&
	   	
	   	//
	   	// The given question must have a question type
	   	//
	   	ques.qType != NULL;
	   
	  ensures
	  	//
	  	// The given question is in the question bank
	  	//
	   	bank.contains(ques);
	   	
	 @*/
	abstract public void add(Question ques);
	
	/**
	 * Removes the question with the questionID from the question bank
	 */
	/*@
	  requires
	  	
	  (* None *);
	  
	  ensures
	  	//
	  	// There is no question in the question bank that has the given questionID
	  	//
	  	(\forall Question q ; bank.contains(q) ;
	  	 	q.questionID != questionID);
	  
	 @*/
	abstract public void delete(int questionID);
	
	/**
	 * Changes the question with the questionID to the question specified by ques
	 */
	/*@
	  requires
	  	//
	  	// There is a question in the question bank that has the given questionID and the given changed 
	  	// question does not have a different question type than the original
	  	//
	  	(\exists Question q ; bank.contains(q) ;
	  	  	q.questionID == questionID && q.qType.equals(ques.qType));
	  	  	
	  
	  ensures
	  	//
	  	// The question in the question bank with the given questionID equals to the given question
	  	//
	  	(\exists Question q ; bank.contains(q) ; 
	  	   	q.questionID == questionID && q.equals(ques));
	  
	 @*/
	abstract public void edit(int questionID, Question ques);
	
	/**
	 * Filters the question bank for specific questions
	 */
	abstract public void filter();
	
}