using IStation.Epanet.Enums;
namespace IStation.Epanet.Network.Structures
{
///Report field properties.
public class Field
{
///Lower/upper report limits.
private readonly double[] _rptLim = { 0d, 0d, 0d };
///Init field name, precision, report limit and state.
/// Field name.
public Field(FieldType type)
{
Type = type;
Enabled = false;
Precision = 2;
SetRptLim(RangeType.LOW, Constants.BIG * Constants.BIG);
SetRptLim(RangeType.HI, -Constants.BIG * Constants.BIG);
}
public FieldType Type { get; }
///Name of reported variable.
public string Name => Type.ParseStr();
///Number of decimal places.
public int Precision { get; set; }
///Units of reported variable.
public string Units { get; set; }
///Enabled if in table.
public bool Enabled { get; set; }
public void SetRptLim(RangeType type, double value) { _rptLim[(int)type] = value; }
public double GetRptLim(RangeType type) { return _rptLim[(int)type]; }
}
}