
#ifndef GUARD_Parameters
#define GUARD_Parameters

// Parameters.h header file
#using <mscorlib.dll>
#using <System.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>
#using <System.Data.dll>

#include <iostream>
#include <istream>
#include <fstream>

using namespace std;
using namespace System;
using namespace System::IO;
using namespace System::Drawing;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Globalization;

[Serializable]
public __gc class Parameters {
typedef double param;
private:

	bool initialized;

	ArrayList* codesList;
	ArrayList* completeCodesList;       // Codes selected modified with ',Adult' or ',Juvenile' suffixes.
    Hashtable* codeHash;

	ArrayList* preyCompositionList;

	Hashtable* growthRateHash;
	Hashtable* initialBiomassHash;
	Hashtable* efficiencyHash;
	Hashtable* clearanceRateHash;
	Hashtable* svarHash;

	Hashtable* codeCategoryHash;
	ArrayList* codeCategoryList;

	bool preyCompositionListSet;

	String* parameterFileName;

	String* outputType;

	bool modelValid;            // The model can only be run if there is at least one predator selected

public:
	Parameters() {

		this->outputType = S"All";
		this->initialized = false;
        this->modelValid = false;

		this->codesList = new ArrayList();
		this->completeCodesList = new ArrayList();
		this->preyCompositionList = new ArrayList();
        this->preyCompositionListSet = false;

        this->codeHash = new Hashtable();

		this->growthRateHash = new Hashtable();
		this->initialBiomassHash = new Hashtable();
		this->efficiencyHash = new Hashtable();
		this->clearanceRateHash = new Hashtable();
		this->svarHash = new Hashtable();

		this->codeCategoryHash = new Hashtable();
		this->codeCategoryList = new ArrayList();

		this->initializeCodeCategories();
	}


	String* getOutputType() {
		return this->outputType;
	}


	void setOutputType(String* sentOutputType) {
		this->outputType = sentOutputType;
	}

    
	ArrayList* setOutputOrder() {
		StreamReader* readStream = File::OpenText(S"atlantis_output_order.txt");

		String* line = readStream->ReadLine();

        ArrayList* outputOrderList = new ArrayList();
		while (!line->Equals(S"DONE")) {
			outputOrderList->Add(line);
			line = readStream->ReadLine();
		}
		return outputOrderList;
	}


	void initializeCodeCategories() {

   		StreamReader* readStream = File::OpenText(S"codegroups.txt");

		String* line = readStream->ReadLine();
 
		String* delimiterString = S",";

		Char delimiter[];
		delimiter = delimiterString->ToCharArray();
		
		String* splitLine[] = line->Split(delimiter);

		String* speciesCode;
		String* speciesCategories;

		while (!(splitLine[1]->Equals(S""))) {

        	speciesCode = splitLine[0];
			speciesCategories = splitLine[1];

			// Update the code category hash

			this->codeCategoryHash->Add(speciesCode, speciesCategories);
			this->codeCategoryList->Add(speciesCode);

			line = readStream->ReadLine();
			splitLine = line->Split(delimiter);
    	}		

		readStream->Close();

	}


	bool isInitialized() {
		return this->initialized;
	}


	void setInitialized() {
		this->initialized = true;
	}


	void initializePreyCompositionList() {

	    IEnumerator* codesListEnumerator = this->codesList->GetEnumerator();

		if (!(this->preyCompositionListSet)) {

			this->modelValid = false;
			int numCodes = this->codeCategoryList->get_Count() * 2;
			this->preyCompositionList->Clear();
            this->completeCodesList->Clear();
    		String* trimDelim = S" ";

		    while (codesListEnumerator->MoveNext()) {
				String* codesListString = static_cast<String*>(codesListEnumerator->Current);
                String* codeCategory = static_cast<String*>(this->codeCategoryHash->get_Item(codesListString));
				codeCategory = codeCategory->Trim(trimDelim->ToCharArray());                       
				if (!codeCategory->Equals(S"3")) {    // A Predator is in the system
                    this->modelValid = true;
				}
			    ArrayList* newCompositionListJuvenile = new ArrayList();

				String* juvenileCodeString = System::String::Concat(codesListString, S",Juvenile");
			    for (int codesIndex = 0; codesIndex <= numCodes; codesIndex++) {
				    if (codesIndex == 0) {
			    		newCompositionListJuvenile->Add(juvenileCodeString);
						if (codeCategory->Equals(S"0") || codeCategory->Equals(S"1")) {
						    this->completeCodesList->Add(juvenileCodeString);
						}
				    } else {
				        newCompositionListJuvenile->Add(S"0");
			    	}
		    	}
                this->preyCompositionList->Add(newCompositionListJuvenile);

			    ArrayList* newCompositionListAdult = new ArrayList();

				String* adultCodeString = System::String::Concat(codesListString, S",Adult");
				for (int codesIndex = 0; codesIndex <= numCodes; codesIndex++) {
					if (codesIndex == 0) {
						newCompositionListAdult->Add(adultCodeString);
						if (codeCategory->Equals(S"0") || codeCategory->Equals(S"2") || codeCategory->Equals(S"3")) {
						    this->completeCodesList->Add(adultCodeString);
						}
					} else {
						newCompositionListAdult->Add(S"0");
					}
				}
    			this->preyCompositionList->Add(newCompositionListAdult);
	    	}
			this->preyCompositionListSet = true;
		}
	}


	bool isPreyCompositionListSet() {
		return this->preyCompositionListSet;
	}


	void reInitialize() {
		this->preyCompositionListSet = false;
		this->growthRateHash->Clear();
		this->clearanceRateHash->Clear();
		this->initialBiomassHash->Clear();
		this->efficiencyHash->Clear();
		this->svarHash->Clear();
	}


	ArrayList* getCodesList() {
		return this->codesList;
	}


	ArrayList* getCompleteCodesList() {
		return this->completeCodesList;
	}


	Hashtable* getCodeCategoryHash() {
		return this->codeCategoryHash;
	}


	ArrayList* getCodeCategoryList() {
		return this->codeCategoryList;
	}

	String* getCategoryCode(String* speciesCode) {

		String* trimDelim = S" ";
		String* categoryString = static_cast<String*>(this->codeCategoryHash->get_Item(speciesCode));
		categoryString = categoryString->Trim(trimDelim->ToCharArray());
		return categoryString;
	}

	Hashtable* getGrowthRateHash() {
		return this->growthRateHash;
	}

	void setGrowthRateHash(Hashtable* growthRate_hash) {
		this->growthRateHash = growthRate_hash;
	}


	Hashtable* getInitialBiomassHash() {
		return this->initialBiomassHash;
	}

	void setInitialBiomassHash(Hashtable* initialBiomass_hash) {
		this->initialBiomassHash = initialBiomass_hash;
	}


	Hashtable* getEfficiencyHash() {
		return this->efficiencyHash;
	}


	void setEfficiencyHash(Hashtable* efficiency_hash) {
		this->efficiencyHash = efficiency_hash;
	}

	Hashtable* getClearanceRateHash() {
		return this->clearanceRateHash;
	}

	void setClearanceRateHash(Hashtable* clearanceRate_hash) {
		this->clearanceRateHash = clearanceRate_hash;
	}

	Hashtable* getSvarHash() {
		return this->svarHash;
	}

	void setSvarHash(Hashtable* svar_hash) {
		this->svarHash = svar_hash;
	}

	void printList(ArrayList* toPrintList) {
		IEnumerator* toPrintListEnum = toPrintList->GetEnumerator();
		while (toPrintListEnum->MoveNext()) {
			String* toPrintListString = static_cast<String*>(toPrintListEnum->Current);
//			System::Console::WriteLine(toPrintListString);
		}
	}

	void setCodesList(ArrayList* codes_list) {
		this->codesList = codes_list;
 	}

	Hashtable* getCodeHash() {
		return this->codeHash;
	}

	void setCodeHash(Hashtable* code_hash) {
		this->codeHash = code_hash;
	}

	String* getTaxa(String* code) {

        IDictionaryEnumerator* codeHashEnum = this->codeHash->GetEnumerator();

		String* codeKey;
		ArrayList* identifierList = new ArrayList();
		while (codeHashEnum->MoveNext()) {
			codeKey = static_cast<String*>(codeHashEnum->Key);
			if (codeKey->Equals(code)) {
				identifierList = static_cast<ArrayList*>(codeHashEnum->Value);
				String* taxa = static_cast<String*>(identifierList->Item[0]);
				if (taxa->Equals(S"")) {
					taxa = static_cast<String*>(identifierList->Item[1]);
					if (taxa->Equals(S"")) {
						taxa = static_cast<String*>(identifierList->Item[2]);
					}
				}
			    return taxa;
			}
		}
		return S"";
	}


	void setTaxa(String* code, String* newTaxa) {

		IDictionaryEnumerator* codeHashEnum = this->codeHash->GetEnumerator();

		String* codeKey;
		ArrayList* identifierList = new ArrayList();
		while (codeHashEnum->MoveNext()) {
			codeKey = static_cast<String*>(codeHashEnum->Key);
			if (codeKey->Equals(code)) {
				identifierList = static_cast<ArrayList*>(codeHashEnum->Value);
				identifierList->Item[0] = newTaxa;
			}
		}
	}

	ArrayList* getPreyCompositionList() {
		return this->preyCompositionList;
	}

	void setPreyCompositionList(ArrayList* preyComp_list) {
		this->preyCompositionList = preyComp_list;
	}


	void runModel() {

	    if (!(this->initialized)) {
    		String* message = S"All parameters have not been entered.  Open each screen to check the data.";
	   		String* caption = S"ERROR: Missing Parameters";
	    	MessageBoxButtons buttons = MessageBoxButtons::OK;
		    System::Windows::Forms::DialogResult result;
	   		result = MessageBox::Show(message, caption, buttons);
            return;
		}

		if (!(this->modelValid)) {
   			String* message = S"No predators have been selected.  Select at least one predator before continuing.";
    		String* caption = S"ERROR: No Predators in the System.";
	    	MessageBoxButtons buttons = MessageBoxButtons::OK;
		    System::Windows::Forms::DialogResult result;
    		result = MessageBox::Show(message, caption, buttons);
            return;
	    }

		SaveFileDialog *outputFileDialog = new SaveFileDialog();

        outputFileDialog->Filter = "parameter files (*.prm)|*.prm"  ;
        outputFileDialog->FilterIndex = 1 ;
        outputFileDialog->RestoreDirectory = true ;
		outputFileDialog->Title = S"Save Output File";

	    if (!(outputFileDialog->ShowDialog() == DialogResult::OK)) {
			return;
		}
		String *outputFileName = outputFileDialog->get_FileName();

		String* predator;
		StreamWriter* sr = File::CreateText(outputFileName);

		if (this->outputType->Equals(S"All")) {

			ArrayList* atlantisOrderedOutputList = new ArrayList();
			atlantisOrderedOutputList = this->setOutputOrder();

            IEnumerator* predatorEnum = atlantisOrderedOutputList->GetEnumerator();

	    	while (predatorEnum->MoveNext()) {
		    	predator = static_cast<String*>(predatorEnum->Current);
                String* predatorCategory = this->getCategoryCode(predator);
    			String* juvPredator = System::String::Concat(predator, S",Juvenile");
	    		String* adultPredator = System::String::Concat(predator, S",Adult");
		    	if (predatorCategory->Equals(S"0")) {
			    	this->calculateAvailabilityTerms(juvPredator, sr);
				    this->calculateAvailabilityTerms(adultPredator, sr);
    			} else {
	    			if (predatorCategory->Equals(S"1")) {
		    			this->calculateAvailabilityTerms(juvPredator, sr);
			    	} else {
				    	if (predatorCategory->Equals(S"2")) {
					    	this->calculateAvailabilityTerms(adultPredator, sr);
					    }
    				}
	    		}
		    }
		} else {

    		IEnumerator* predatorEnum = this->completeCodesList->GetEnumerator();

    		while (predatorEnum->MoveNext()) {
   			    predator = static_cast<String*>(predatorEnum->Current);

				String* commaDelimString=S",";
                Char commaDelim[];

		        commaDelim = commaDelimString->ToCharArray();
         	    String* predatorCodeArray[] = predator->Split(commaDelim);
                String* predatorCode = predatorCodeArray[0];

				String* predatorCategory = this->getCategoryCode(predatorCode);
				if (!predatorCategory->Equals(S"3")) {
	    		    this->calculateAvailabilityTerms(predator, sr);
				}

			}
		}

		sr->Close();
		String* message = S"Availability Parameters Calculation Done";
		String* caption = S"DONE";
		MessageBoxButtons buttons = MessageBoxButtons::OK;
		System::Windows::Forms::DialogResult result;
		result = MessageBox::Show(message, caption, buttons);
	}


	String* getPredatorString(String* predator) {

   		String* predatorCodeDelimiterString = S",";
        Char predatorCodeDelimiter[];

		predatorCodeDelimiter = predatorCodeDelimiterString->ToCharArray();
     	String* predatorCodeArray[] = predator->Split(predatorCodeDelimiter);
        String* predatorString = predatorCodeArray[0];
		String* category = predatorCodeArray[1];

        String* trimDelim = S" ";
		String* predatorCategoryString = static_cast<String*>(this->codeCategoryHash->get_Item(predatorString));
		predatorCategoryString = predatorCategoryString->Trim(trimDelim->ToCharArray());                       
		
		predatorString = createPredatorString(predatorString, predatorCategoryString, category);

		return predatorString;
	}

	String* createPredatorString(String* predatorString, String* predatorCategoryString, String* category) {

		// Base Case
		if (predatorCategoryString->Equals(S"0")) {
    		if (category->Equals(S"Juvenile")) {
	    		predatorString = System::String::Concat(predatorString, S"1");
		    } else if (category->Equals(S"Adult")) {
			    predatorString = System::String::Concat(predatorString, S"2");
		    }
		} else {  
			// All except prawns and squid have only one category of prey... prawn and cephalopods are dealt with here
			if ((predatorString->Equals(S"CEP")) || (predatorString->Equals(S"PWN"))) {  // The adults
				predatorString = System::String::Concat(predatorString, S"2");
			} else {
				// The juveniles
				if (predatorString->Equals(S"CEPj")) {  
					predatorString = S"CEP1";
				} else {
					if (predatorString->Equals(S"PWNj")) {
						predatorString = S"PWN1";
					}
				}
			}
		}

		return predatorString;
	}


	String* getNumberOfPrey() {

		String* numberOfPrey = System::Convert::ToString(this->codeCategoryList->get_Count());
        return numberOfPrey;
	}


	void calculateAvailabilityTerms(String* predator, StreamWriter* sr) {

		System::Console::WriteLine(predator);
		IEnumerator* preyEnum = this->codeCategoryList->GetEnumerator();
		String* prey;
         
		// get predator specific terms and calculate derived terms
        double Cj = this->getPredatorClearanceRate(predator);
        double Ej = this->getPredatorEfficiencyRate(predator);
		double Gj = this->getPredatorGrowthRate(predator);
        double Sj = this->getPredatorSvar(predator);

    	double Pij, Bi, Aij;

		String* availabilityOutputString1 = S"";
		String* availabilityOutputString2 = S"";

		while (preyEnum->MoveNext()) {
			prey = static_cast<String*>(preyEnum->Current);

			String* preyCategoryString = this->getCategoryCode(prey);

			if (preyCategoryString->Equals(S"0")) {			
		    	Aij = 0.0;             // The default.  If Pij is 0.0 then Aij will remain 0.0
                
				if (this->completeCodesList->Contains(predator)) {
    				String* preyModString = System::String::Concat(prey, S",Juvenile");
                    Pij = this->getPreyProportion(predator, prey, 1);

		    	    if (Pij > 0.0) {
    		    	    Bi = this->getBiomass(preyModString);
    			    	if (Bi > 0.0) {
         					Aij = calculateAlpha(Pij, Sj, Bi, Cj, Ej, Gj);
						}
    			    }
				}

				if (predator->Equals(S"BC,Adult") && prey->Equals(S"FPL")) {
					System::Console::WriteLine(System::Convert::ToString(Aij));
				}
    			String* availabilityString = S"";
	    		System::Decimal dAij = Aij;
		    	System::Decimal finalAij = System::Decimal::Round(dAij, 10);
			    availabilityString = System::Convert::ToString(finalAij);
			
      			availabilityOutputString1 = System::String::Concat(availabilityOutputString1, availabilityString);
        		availabilityOutputString1 = System::String::Concat(availabilityOutputString1, S" ");
		    	// Calculate for the adult category of the prey
   				Aij = 0.0;             // The default.  If Pij is 0.0 then Aij will remain 0.0
				if (this->completeCodesList->Contains(predator)) {
	    		    String* preyModString = System::String::Concat(prey, S",Adult");
                    Pij = this->getPreyProportion(predator, prey, 2);
		        	if (Pij > 0.0) {
    		        	Bi = this->getBiomass(preyModString);
				        if (Bi > 0.0) {
            				Aij = calculateAlpha(Pij, Sj, Bi, Cj, Ej, Gj);
		    	    	}
			        }
				}

				if (predator->Equals(S"BC,Adult") && prey->Equals(S"FPL")) {
					System::Console::WriteLine(System::Convert::ToString(Aij));
				}
    			availabilityString = S"";
	    		dAij = Aij;
		    	finalAij = System::Decimal::Round(dAij, 10);
			    availabilityString = System::Convert::ToString(finalAij);
			
      			availabilityOutputString2 = System::String::Concat(availabilityOutputString2, availabilityString);
        		availabilityOutputString2 = System::String::Concat(availabilityOutputString2, S" ");
	    	}

			if (preyCategoryString->Equals(S"1")) {			
   				Aij = 0.0;             // The default.  If Pij is 0.0 then Aij will remain 0.0
				if (this->completeCodesList->Contains(predator)) {
        			String* preyModString = System::String::Concat(prey, S",Juvenile");
					Pij = this->getPreyProportion(predator, prey, 1);

    			    if (Pij > 0.0) {
        			    Bi = this->getBiomass(preyModString);
    	    			if (Bi > 0.0) {
        					Aij = calculateAlpha(Pij, Sj, Bi, Cj, Ej, Gj);
		    		    }
    		    	}
				}
				if (predator->Equals(S"BC,Adult") && prey->Equals(S"FPL")) {
					System::Console::WriteLine(System::Convert::ToString(Aij));
				}
    			String* availabilityString = S"";
	    		System::Decimal dAij = Aij;
		    	System::Decimal finalAij = System::Decimal::Round(dAij, 10);
			    availabilityString = System::Convert::ToString(finalAij);
			
      			availabilityOutputString1 = System::String::Concat(availabilityOutputString1, availabilityString);
        		availabilityOutputString1 = System::String::Concat(availabilityOutputString1, S" ");

      			availabilityOutputString2 = System::String::Concat(availabilityOutputString2, availabilityString);
        		availabilityOutputString2 = System::String::Concat(availabilityOutputString2, S" ");
	    	}

			if (preyCategoryString->Equals(S"2") || preyCategoryString->Equals(S"3")) {			
	    		Aij = 0.0;             // The default.  If Pij is 0.0 then Aij will remain 0.0
				if (this->completeCodesList->Contains(predator)) {
    				// Calculate for the adult category of the prey
	    		    String* preyModString = System::String::Concat(prey, S",Adult");
                    Pij = this->getPreyProportion(predator, prey, 2);

		        	if (Pij > 0.0) {
    		        	Bi = this->getBiomass(preyModString);
				        if (Bi > 0.0) {
            				Aij = calculateAlpha(Pij, Sj, Bi, Cj, Ej, Gj);
		        		}
			        }
				}
				if (predator->Equals(S"BC,Adult") && prey->Equals(S"FPL")) {
					System::Console::WriteLine(System::Convert::ToString(Aij));
				}
    			String* availabilityString = S"";
	    		System::Decimal dAij = Aij;
		    	System::Decimal finalAij = System::Decimal::Round(dAij, 10);
			    availabilityString = System::Convert::ToString(finalAij);
			
      			availabilityOutputString1 = System::String::Concat(availabilityOutputString1, availabilityString);
        		availabilityOutputString1 = System::String::Concat(availabilityOutputString1, S" ");

      			availabilityOutputString2 = System::String::Concat(availabilityOutputString2, availabilityString);
        		availabilityOutputString2 = System::String::Concat(availabilityOutputString2, S" ");
	    	}

		}

		String* initPredatorString = this->getPredatorString(predator);

		String* numberOfPrey = this->getNumberOfPrey();
		String* predatorString = System::String::Concat(initPredatorString, S" ");
		predatorString = System::String::Concat(predatorString, numberOfPrey);

   		String* predatorCodeDelimiterString = S",";
        Char predatorCodeDelimiter[];

		predatorCodeDelimiter = predatorCodeDelimiterString->ToCharArray();
     	String* predatorCodeArray[] = predator->Split(predatorCodeDelimiter);
        String* predatorCode = predatorCodeArray[0];
		String* category = predatorCodeArray[1];

        String* trimDelim = S" ";
		String* predatorCategoryString = static_cast<String*>(this->codeCategoryHash->get_Item(predatorCode));
		predatorCategoryString = predatorCategoryString->Trim(trimDelim->ToCharArray());  

		// If the predator can be both juvenile and adult, it has two prey categories
		if (predatorCategoryString->Equals(S"0")) {
    		String* headerString1 = System::String::Concat(S"pPREY1", predatorString);
	    	sr->WriteLine(headerString1);
		    sr->WriteLine(availabilityOutputString1);
    		sr->WriteLine();
	    	String* headerString2 = System::String::Concat(S"pPREY2", predatorString);
		    sr->WriteLine(headerString2);
    		sr->WriteLine(availabilityOutputString2);
	    	sr->WriteLine();
		} else {
			// The predator has only one prey category (juveniles)
			String* headerString = System::String::Concat(S"pPREY", predatorString);
			sr->WriteLine(headerString);
			if (initPredatorString->Equals(S"PWN1") || initPredatorString->Equals(S"PWN2") || initPredatorString->Equals(S"CEP1") || initPredatorString->Equals(S"CEP2")) {
				sr->WriteLine(availabilityOutputString1);
			} else {
			    sr->WriteLine(availabilityOutputString2);
			}
			sr->WriteLine();
		}
	}

	double calculateAlpha(double Pij, double Sj, double Bi, double Cj, double Ej, double Gj) {

		double Aij;
        double denominator =(Bi * Cj) * (1 - ((Ej * Sj) / Gj));
		if (denominator == 0) {
            Aij = 0;
			return Aij;
		}

		Aij = Pij * Sj / denominator;
        return Aij;
	}

	double getPreyProportion(String* predator, String* prey, int category) {

        int preyIndex = 0;
		IEnumerator* codeCategoryListEnum = this->codeCategoryList->GetEnumerator();
		bool preyNotFound = true;
		String* currentPrey;

		while (codeCategoryListEnum->MoveNext() && preyNotFound) {
			currentPrey = static_cast<String*>(codeCategoryListEnum->Current);
			if (currentPrey->Equals(prey)) {
				preyNotFound = false;
			}
			preyIndex++;
		}

		if (category == 2) {
			int numPrey = this->codeCategoryList->get_Count();
			preyIndex = preyIndex + numPrey;
		}

		IEnumerator* preyCompositionListEnum = this->preyCompositionList->GetEnumerator();
		bool predatorNotFound = true;
		ArrayList* currentPreyList;
        String* currentPredator;
		while (preyCompositionListEnum->MoveNext() && predatorNotFound) {
			currentPreyList = static_cast<ArrayList*>(preyCompositionListEnum->Current);
            currentPredator = static_cast<String*>(currentPreyList->Item[0]);
			if (currentPredator->Equals(predator)) {
                predatorNotFound = false;
			}
		}

		double compositionValue;
   		compositionValue = System::Convert::ToDouble(currentPreyList->Item[preyIndex]);

		return compositionValue;
	}


	double getPredatorGrowthRate(String* predator) {

		double predatorGrowthRate = this->getHashValue(this->growthRateHash, predator);
		return predatorGrowthRate;
	}


	double getBiomass(String* species) {

		double speciesBiomass = this->getHashValue(this->initialBiomassHash, species);
		return speciesBiomass;
	}


	double getPredatorClearanceRate(String* predator) {

		double predatorClearanceRate = this->getHashValue(this->clearanceRateHash, predator);
		return predatorClearanceRate;
	}


	double getPredatorEfficiencyRate(String* predator) {

		double predatorEfficiencyRate = this->getHashValue(this->efficiencyHash, predator);
		return predatorEfficiencyRate;
	}


	double getPredatorSvar(String* predator) {

		double predatorSvar = this->getHashValue(this->svarHash, predator);
		return predatorSvar;

//		return 1.0;
	}


	double getHashValue(Hashtable* selectedHash, String* keyString) {

		String* valueString;
    	if (selectedHash->ContainsKey(keyString)) {
			valueString = System::Convert::ToString(selectedHash->get_Item(keyString));
		} else {
			valueString = S"0";
		}   

		double value = System::Convert::ToDouble(valueString);
		return value;
	}


	void setParameterFileName(String* fileName) {
		this->parameterFileName = fileName;
	}


};

#endif

