using System;
using System.IO;

namespace LeafWeb.Web.Charter
{
	[Serializable]
	public class CurveData
	{
		private readonly String _curveId;
		private readonly CurveParamSet _paramSet1;
		private readonly CurveParamSet _paramSet2;
		private readonly CurveParamSet _paramSet3;
		private readonly CurveParamSet _paramSet4;

		public CurveData(StreamReader sr, ref String errMsg, ref int lineNbr)
		{
			// For each curve in the output file there are four sets of data.

			_paramSet1 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref _curveId);
			if (errMsg.Length > 0)
				return;

			_paramSet2 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref _curveId);
			if (errMsg.Length > 0)
				return;

			_paramSet3 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref _curveId);
			if (errMsg.Length > 0)
				return;

			_paramSet4 = new CurveParamSet(sr, ref errMsg, ref lineNbr, ref _curveId);
		}

		public String GetCurveId()
		{
			return _curveId;
		}

		public CurveParamSet CndctFixedCmpPntFixedParams()
		{
			return _paramSet1;
		}

		public CurveParamSet CndctFixedCmpPntEstimatedParams()
		{
			return _paramSet2;
		}

		public CurveParamSet CndctEstimatedCmpPntFixedParams()
		{
			return _paramSet3;
		}

		public CurveParamSet CndctEstimatedCmpPntEstimatedParams()
		{
			return _paramSet4;
		}
	}
}