LotSizingDataModel.Core 2.0.1
Core domain model, shared abstractions and XML-serializable entities.
Loading...
Searching...
No Matches
MicroPeriodCount.cs
Go to the documentation of this file.
1using System;
2using System.Xml.Serialization;
5
7
8/// <summary>
9/// Number of scheduling micro-periods contained in each planning macro-period.
10/// </summary>
11[Serializable]
12[XmlType(TypeName = "microPeriodCount")]
13public sealed class MicroPeriodCount :
15{
17 {
18 }
19
20 public MicroPeriodCount(int planningHorizon)
21 : base(planningHorizon, defaultValue: 1)
22 {
23 }
24
26 int planningHorizon,
27 int defaultMicroPeriodCount)
28 : base(
29 planningHorizon,
30 defaultMicroPeriodCount)
31 {
32 }
33
34 [XmlIgnore]
36 Values;
37
38 public int GetCount(int period) =>
39 GetValue(period);
40
41 public void SetCount(
42 int period,
43 int count) =>
44 SetValue(period, count);
45
46 [XmlIgnore]
47 protected override int DefaultValueForNewPeriods =>
48 1;
49
50 protected override void ValidateValue(
51 int value,
52 string parameterName)
53 {
54 base.ValidateValue(value, parameterName);
55
56 if (value <= 0)
57 {
58 throw new ArgumentOutOfRangeException(
59 parameterName,
60 value,
61 "A micro-period count must be strictly positive.");
62 }
63 }
64}
Represents a sequence of integer values indexed by planning period.
int GetValue(int period)
Gets the parameter value for a planning period.
IntegerTimeSeriesParameter()
Initializes an empty period-dependent integer parameter.
void SetValue(int period, int value)
Sets the parameter value for a planning period.
IntegerTimeSeries Values
Gets or sets the parameter values for all planning periods.
MicroPeriodCount(int planningHorizon, int defaultMicroPeriodCount)
override void ValidateValue(int value, string parameterName)
Validates one integer value.