LotSizingDataModel.Core 2.0.1
Core domain model, shared abstractions and XML-serializable entities.
Loading...
Searching...
No Matches
StandaloneWarehouse.cs
Go to the documentation of this file.
1using System;
2using System.Xml.Serialization;
3
5
6/// <summary>
7/// Represents a standalone warehouse that is not attached to a plant.
8///
9/// Corresponds to the UML class "Autonome", derived from "Entrepot".
10/// Its identifier corresponds to e in the source model.
11/// </summary>
12[Serializable]
13[XmlType(TypeName = "standaloneWarehouse")]
14public sealed partial class StandaloneWarehouse : Warehouse
15{
16 private int _id;
17
18 /// <summary>
19 /// Initializes an empty standalone warehouse.
20 ///
21 /// This public parameterless constructor is required
22 /// by <see cref="XmlSerializer"/>.
23 /// </summary>
25 {
26 }
27
28 /// <summary>
29 /// Initializes a standalone warehouse with an identifier and a name.
30 /// </summary>
31 /// <param name="id">
32 /// Numerical identifier corresponding to e in the source model.
33 /// </param>
34 /// <param name="name">
35 /// Warehouse name.
36 /// </param>
37 public StandaloneWarehouse(int id, string name)
38 : base(name) // Initialize base warehouse with name
39 {
40 // Initialize standalone warehouse identifier
41 Id = id;
42 }
43
44 /// <summary>
45 /// Gets or sets the numerical identifier of the standalone warehouse.
46 ///
47 /// Corresponds to e in the source model.
48 /// </summary>
49 [XmlAttribute("id")]
50 public int Id
51 {
52 get => _id;
53 set
54 {
55 // Validate that the identifier is non-negative
56 if (value < 0)
57 {
58 throw new ArgumentOutOfRangeException(
59 nameof(value),
60 value,
61 "The standalone warehouse identifier cannot be negative.");
62 }
63
64 // Update the backing field and notify property change if value differs
65 SetProperty(ref _id, value);
66 }
67 }
68}
StandaloneWarehouse()
Initializes an empty standalone warehouse.
StandaloneWarehouse(int id, string name)
Initializes a standalone warehouse with an identifier and a name.
int Id
Gets or sets the numerical identifier of the standalone warehouse.
Warehouse()
Initializes a new instance of the Warehouse class.
Definition Warehouse.cs:26