LotSizingDataModel.Core 2.0.1
Core domain model, shared abstractions and XML-serializable entities.
Loading...
Searching...
No Matches
ProductionMicroPeriodReference.cs
Go to the documentation of this file.
1using System;
2using System.Xml.Serialization;
4
6
7[Serializable]
8[XmlType(TypeName = "productionMicroPeriodReference")]
10{
11 private int _macroPeriod;
12 private int _microPeriodIndex;
13
17
19 int macroPeriod,
20 int microPeriodIndex)
21 {
22 MacroPeriod = macroPeriod;
23 MicroPeriodIndex = microPeriodIndex;
24 }
25
26 [XmlAttribute("macroPeriod")]
27 public int MacroPeriod
28 {
29 get => _macroPeriod;
30 set
31 {
32 if (value < 0)
33 {
34 throw new ArgumentOutOfRangeException(
35 nameof(value),
36 value,
37 "The macro-period index cannot be negative.");
38 }
39
40 SetProperty(ref _macroPeriod, value);
41 }
42 }
43
44 [XmlAttribute("microPeriodIndex")]
46 {
47 get => _microPeriodIndex;
48 set
49 {
50 if (value < 0)
51 {
52 throw new ArgumentOutOfRangeException(
53 nameof(value),
54 value,
55 "The micro-period index cannot be negative.");
56 }
57
58 SetProperty(ref _microPeriodIndex, value);
59 }
60 }
61
62 [XmlIgnore]
63 public bool IsInternallyValid =>
64 MacroPeriod > 0 &&
66
69 other is not null &&
70 MacroPeriod == other.MacroPeriod &&
72
73 public override string ToString() =>
74 $"Macro:{MacroPeriod}/Micro:{MicroPeriodIndex}";
75}
Base class for model objects that notify listeners when one of their properties changes.