package lt.ktu.gmj.tasks;

public class ModelValues
{
	public ModelValues() {};
	public ModelValues(ModelValues values) 
	{
		SetValues(values);
	}
	
	public double B1 = -1;
	public double B2 = -1;
	public double B11 = -1;
	public double B22 = -1;
	public double B12 = -1;
	public double B21 = -1;
	public double C0 = -1;
	public double Z01 = -1;
	public double Z11 = -1;
	public double Z12 = -1;
	public double Z02 = -1;
	public double Z21 = -1;
	public double Z22 = -1;
	public double Precision = -1;
	public double Precision_Analyzer = -1;
	public double A = -1;
	public double Reg = -1; 
	
	public double SellableResourceStepFor1stServer = 0.;
	public double SellableResourceStepFor2ndServer = 0.;
	
	public double p1Min = -1;
	public double p1Mid = -1;
	public double p1Max = -1;
	public double p2Min = -1;
	public double p2Mid = -1;
	public double p2Max = -1;
	public double y1Min = -1;
	public double y1Mid = -1;
	public double y1Max = -1;
	public double y2Min = -1;
	public double y2Mid = -1;
	public double y2Max = -1;
	
	public double StepY1 = 0.;
	public double StepY2 = 0.;
	public double StepP1 = 0.;
	public double StepP2 = 0.;
	
	public boolean Changed(WalrasModel model)
	{
		return !(B1 == model.B1 &&
			     B2 == model.B2 &&
			     B11 == model.B11 &&
			     B22 == model.B22 &&
			     B12 == model.B12 &&
			     B21 == model.B21 &&
			     C0 == model.C0 &&
			     Z01 == model.Z01 &&
			     Z11 == model.Z11 &&
			     Z12 == model.Z12 &&
			     Z02 == model.Z02 &&
			     Z21 == model.Z21 &&
			     Z22 == model.Z22 &&
			     Precision == model.Precision &&
			     Precision_Analyzer == model.Precision_Analyzer &&
			     A == model.A &&
			     Reg == model.Reg &&
			     p1Min == model.domain().min[0] &&
			     p1Mid == model.domain().defaultPoint.x[0] &&
			     p1Max == model.domain().max[0] &&
			     p2Min == model.domain().min[1] &&
			     p2Mid == model.domain().defaultPoint.x[1] &&
			     p2Max == model.domain().max[1] &&
			     y1Min == model.domain().min[2] &&
			     y1Mid == model.domain().defaultPoint.x[2] &&
			     y1Max == model.domain().max[2] &&
			     y2Min == model.domain().min[3] &&
			     y2Mid == model.domain().defaultPoint.x[3] &&
			     y2Max == model.domain().max[3]);
	}
	public void SetValues(ModelValues values)
	{
		B1 = values.B1;
		B2 = values.B2;
		B11 = values.B11;
		B22 = values.B22;
		B12 = values.B12;
		B21 = values.B21;
		C0 = values.C0;
		Z01 = values.Z01;
		Z11 = values.Z11;
		Z12 = values.Z12;
		Z02 = values.Z02;
		Z21 = values.Z21;
		Z22 = values.Z22;
		Precision = values.Precision;
		Precision_Analyzer = values.Precision_Analyzer;
		A = values.A;
		Reg = values.Reg;
		
		SellableResourceStepFor1stServer = values.SellableResourceStepFor1stServer;
		SellableResourceStepFor2ndServer = values.SellableResourceStepFor2ndServer;
		
		p1Min = values.p1Min;
		p1Mid = values.p1Mid;
		p1Max = values.p1Max;
		p2Min = values.p2Min;
		p2Mid = values.p2Mid;
		p2Max = values.p2Max;
		y1Min = values.y1Min;
		y1Mid = values.y1Mid;
		y1Max = values.y1Max;
		y2Min = values.y2Min;
		y2Mid = values.y2Mid;
		y2Max = values.y2Max;
		
		StepY1 = values.StepY1;
		StepY2 = values.StepY2;
		StepP1 = values.StepP1;
		StepP2 = values.StepP2;
	}
	
	public void SetValues(WalrasModel model)
	{
		B1 = model.B1;
		B2 = model.B2;
		B11 = model.B11;
		B22 = model.B22;
		B12 = model.B12;
		B21 = model.B21;
		C0 = model.C0;
		Z01 = model.Z01;
		Z11 = model.Z11;
		Z12 = model.Z12;
		Z02 = model.Z02;
		Z21 = model.Z21;
		Z22 = model.Z22;
		Precision = model.Precision;
		Precision_Analyzer = model.Precision_Analyzer;
		A = model.A;
		Reg = model.Reg;
		
		SellableResourceStepFor1stServer = B1 / (100 / Precision);
		SellableResourceStepFor2ndServer = B2 / (100 / Precision);
		
		p1Min = model.domain().min[0];
		p1Mid = model.domain().defaultPoint.x[0];
		p1Max = model.domain().max[0];
		p2Min = model.domain().min[1];
		p2Mid = model.domain().defaultPoint.x[1];
		p2Max = model.domain().max[1];
		y1Min = model.domain().min[2];
		y1Mid = model.domain().defaultPoint.x[2];
		y1Max = model.domain().max[2];
		y2Min = model.domain().min[3];
		y2Mid = model.domain().defaultPoint.x[3];
		y2Max = model.domain().max[3];
		
		StepY1 = (y1Max - y1Min) / (100 / Precision);
		StepY2 = (y2Max - y2Min) / (100 / Precision);
		StepP1 = (p1Max - p1Min) / (100 / Precision);
		StepP2 = (p2Max - p2Min) / (100 / Precision);
	}
}
