#ifndef PROJECT_H_
#define PROJECT_H_

#include <cstring>

class project
{
public:
	project();
	virtual ~project();
	
	void initialize();
	
	double attributes [40]; //0-24: attributes, 25-36: slopes, 37-39:A,B,Ksloc
	
	static const double pRSlope=0.043;
	static const double nRSlope=-0.076;
	static const double dfrRSlope=0.098;
	
	static const double pDSlope=0.063;
	static const double nDSlope=-0.08;
	static const double dfrDSlope=0.138;
	
	static const double pCSlope=0.063;
	static const double nCSlope=-0.083;
	static const double dfrCSlope=0.122;
	
	static const double SFSlope=-1.274;
	static const double posEMSlope=0.112;
	static const double negEMSlope=-0.099;
	
	//constants
	double A; //     is real 3.72 9.18
	double B; //     is real 0.85  1.09
	double ksloc; // is int 100 125
	
	//defect removal schemes
	int automated_analysis; //          is int 1 6 (0)
	int peer_reviews; //                is int 1 6 (1)
	int execution_testing_and_tools; // is int 1 6 (2)
	
	//scale factors
	int prec; //  is int 1 5 (3)
	int flex; //  is int 1 5 (4)
	int resl; //  is int 1 5 (5)
	int team; //  is int 1 5 (6)
	int pmat; //  is int 1 5 (7)
	
	//effort multipliers
	int time; //   is int 3 6 (8)
	int stor; //   is int 3 6 (9)
	int data; //   is int 2 5 (10)
	int pvol; //   is int 2 5 (11)
	int ruse; //   is int 2 6 (12)
	int rely; //   is int 1 5 (13)
	int docu; //   is int 1 5 (14)
	int acap; //   is int 1 5 (15)
	int pcap; //   is int 1 5 (16)
	int pcon; //   is int 1 5 (17)
	int apex; //   is int 1 5 (18)
	int plex; //   is int 1 5 (19)
	int ltex; //   is int 1 5 (20)
	int tool; //   is int 1 5 (21)
	int sced; //   is int 1 5 (22)
	int cplx; //   is int 1 6 (23)
	int site; //   is int 1 6 (24)
	
	//cocomoII tables/functions
	
	//functions returning the values of attributes according to the tuning tables
	double fprec ();
	double fflex ();
	double fresl ();
	double fteam ();
	double fpmat ();
	
	double ftime ();
	double fstor ();
	double fdata ();
	double fpvol ();
	double fruse ();
	double frely ();
	double fdocu ();
	double facap ();
	double fpcap ();
	double fpcon ();
	double fapex ();
	double fltex ();
	double ftool ();
	double fsced ();
	double fcplx ();
	double fsite ();
	double fplex ();
	
	double SFCocomoSlope;
	double posEMCocomoSlope;
	double negEMCocomoSlope;
	
	double SFCocomo(int rating);
	double posEMCocomo(int rating);
	double negEMCocomo(int rating);
	
	void setattnum (int attnum, double rating);
	
	int setatt (int rating, int min, int max);
	
	void sprec (int rating);
	void sflex (int rating);
	void sresl (int rating);
	void steam (int rating);
	void spmat (int rating);
	
	void stime (int rating);
	void sstor (int rating);
	void sdata (int rating);
	void spvol (int rating);
	void sruse (int rating);
	void srely (int rating);
	void sdocu (int rating);
	void sacap (int rating);
	void spcap (int rating);
	void spcon (int rating);
	void sapex (int rating);
	void sltex (int rating);
	void stool (int rating);
	void ssced (int rating);
	void scplx (int rating);
	void ssite (int rating);
	void splex (int rating);
	
	void sautomated_analysis (int rating);
	void speer_reviews (int rating);
	void sexecution_testing_and_tools (int rating);
	
	void spCoqualRSlope (double val);
	void snCoqualRSlope (double val);
	void sdfrCoqualRSlope (double val);
	
	void spCoqualDSlope (double val);
	void snCoqualDSlope (double val);
	void sdfrCoqualDSlope (double val);
	
	void spCoqualCSlope (double val);
	void snCoqualCSlope (double val);
	void sdfrCoqualCSlope (double val);
	
	void sSFCocomoSlope (double val);
	void sposEMCocomoSlope (double val);
	void snegEMCocomoSlope (double val);
	
	void sA (double val);
	void sB (double val);
	void sKsloc (double val);	
	
	char* displayAttName (int attnum);
	void displayAtt (int attnum);
	
	void dispprec ();
	void dispflex ();
	void dispresl ();
	void dispteam ();
	void disppmat ();
	
	void disptime ();
	void dispstor ();
	void dispdata ();
	void disppvol ();
	void dispruse ();
	void disprely ();
	void dispdocu ();
	void dispacap ();
	void disppcap ();
	void disppcon ();
	void dispapex ();
	void displtex ();
	void disptool ();
	void dispsced ();
	void dispcplx ();
	void dispsite ();
	void dispplex ();
	
	void dispautomated_analysis ();
	void disppeer_reviews ();
	void dispexecution_testing_and_tools ();
	
	void disppCoqualRSlope (); 
	void dispnCoqualRSlope ();
	void dispdfrCoqualRSlope ();
	void disppCoqualDSlope ();
	void dispnCoqualDSlope ();
	void dispdfrCoqualDSlope ();
	void disppCoqualCSlope ();
	void dispnCoqualCSlope ();
	void dispdfrCoqualCSlope ();
	void dispSFCocomoSlope ();
	void dispposEMCocomoSlope ();
	void dispnegEMCocomoSlope ();
	void dispA (); 
	void dispB (); 
	void dispKsloc (); 
	
	double effort();
	
	//threat model
	
	//threat tables
	static int t1[5][5];
	static int t2[5][6];
	static int t3[5][5]; 
	static int t4[5][5];
	static int t5[5][5];
	static int t6[6][5];
	static int t7[5][5];
	static int t8[6][5];
	
	double threat();
	
	int sched_threat();
	int prod_threat();
	int pers_threat();
	int proc_threat();
	int plat_threat();
	int reuse_threat(); 
	
	//Coqualmo
	//Coqualmo Tables
	
	double pCoqualRSlope;
	double nCoqualRSlope;
	double dfrCoqualRSlope;
	
	double pCoqualDSlope;
	double nCoqualDSlope;
	double dfrCoqualDSlope;
	
	double pCoqualCSlope;
	double nCoqualCSlope;
	double dfrCoqualCSlope;
	
	double posCoqualR(int rating);
	double negCoqualR(int rating);
	double dfrCoqualR(int rating);
	
	double posCoqualD(int rating);
	double negCoqualD(int rating);
	double dfrCoqualD(int rating);
	
	double posCoqualC(int rating);
	double negCoqualC(int rating);
	double dfrCoqualC(int rating);	
	
	double flexR();
	double pcapR();
	
	double ruseR();
	double cplxR();
	double timeR();
	double storR();
	double pvolR();
	double dataR();
	
	double acapR();
	double pconR();
	double apexR();
	double plexR();
	double ltexR();
	double toolR();
	double siteR();
	double scedR();
	double relyR();
	double docuR();
	double reslR();
	double teamR();
	double pmatR();
	double precR();
	
	double flexD();
		
	double ruseD();
	double cplxD();
	double timeD();
	double storD();
	double pvolD();
	double dataD();
	
	double acapD();
	double pconD();
	double apexD();
	double plexD();
	double ltexD();
	double toolD();
	double siteD();
	double scedD();
	double relyD();
	double docuD();
	double reslD();
	double teamD();
	double pmatD();
	double precD();
	double pcapD();
	
	double flexC();
		
	double ruseC();
	double cplxC();
	double timeC();
	double storC();
	double pvolC();
	double dataC();
	
	double acapC();
	double pconC();
	double apexC();
	double plexC();
	double ltexC();
	double toolC();
	double siteC();
	double scedC();
	double relyC();
	double docuC();
	double reslC();
	double teamC();
	double pmatC();
	double precC();
	double pcapC();
	
	double automated_analysisR();
	double peer_reviewsR();
	double execution_testing_and_toolsR();
	
	double automated_analysisD();
	double peer_reviewsD();
	double execution_testing_and_toolsD();
	
	double automated_analysisC();
	double peer_reviewsC();
	double execution_testing_and_toolsC();
	
	double defectsIntroR();
	double defectsIntroD();
	double defectsIntroC();
	
	double defectsRemR();
	double defectsRemD();
	double defectsRemC();
	
	double defects();
};

#endif /*PROJECT_H_*/
