/*
* GenericPhaseQueue.cs
* Authors: August Zinsser, Sriharsha Matta
*
* Copyright Matthew Belmonte 2007
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace tAC_Engine
{
///
/// All phases that a minigame may use
///
public abstract class GenericPhases
{
protected static List mList = new List();
///
/// mList must be defined within this body for each specific class due to the fact that C# does not support function overloading
///
///
///
public abstract bool Contains(string phaseName);
}
///
/// Used to hold the order of phases
///
public class GenericTest
{
public string PhaseName; // Name of this test
public int Trials; // Trials for this test
public List SpecificParameters; // Parsed by specific minigames
protected GenericPhases mPhases = null; // Must be assigned to a specific phase set in each derived class
///
/// Assign all generic variables and store specific variables as strings to be decoded by derivatives of this class
///
/// Name of this test
/// Number of trials for this test
/// Parameters passed to a specific test that inherits from this generic template
public GenericTest(string phaseName, int trials, List specificParameters)
{
PhaseName = phaseName;
Trials = trials;
SpecificParameters = specificParameters;
if (SpecificParameters == null)
SpecificParameters = new List();
}
}
///
/// Provides a template for minigames with phases to control the phase flow
///
public class GenericPhaseQueue
{
protected Queue mTestQueue; // Holds all trials for the minigame
public int Count { get { return mTestQueue.Count; } }
///
/// Default constructor
///
public GenericPhaseQueue()
{
mTestQueue = new Queue();
}
///
/// Copy constructor
///
public GenericPhaseQueue(GenericPhaseQueue pq)
{
mTestQueue = new Queue();
GenericTest[] testArray = new GenericTest[pq.mTestQueue.Count];
pq.mTestQueue.CopyTo(testArray, 0);
for (int i = 0; i < pq.mTestQueue.Count; i++)
{
mTestQueue.Enqueue(testArray[i]);
}
}
///
/// Add a testing phase
///
///
public void Enqueue(GenericTest testPhase)
{
mTestQueue.Enqueue(testPhase);
}
///
/// Removes the oldest testing phase from the list and returns it
///
///
public GenericTest Dequeue()
{
return mTestQueue.Dequeue();
}
}
}