LotSizingDataModel.Core 2.0.1
Core domain model, shared abstractions and XML-serializable entities.
Loading...
Searching...
No Matches
TransportLane.cs
Go to the documentation of this file.
1using System;
2using System.Xml.Serialization;
4
6
7/// <summary>
8/// Represents a transport lane between two warehouses.
9///
10/// A transport lane has exactly one origin warehouse,
11/// exactly one destination warehouse and a stable identifier.
12///
13/// Corresponds to the UML class "Liaison".
14/// </summary>
15[Serializable]
16[XmlType(TypeName = "transportLane")]
17public sealed partial class TransportLane : IdentifiedEntity
18{
19 private WarehouseReference _origin = new();
20 private WarehouseReference _destination = new();
21
22 /// <summary>
23 /// Initializes an empty transport lane.
24 ///
25 /// This public parameterless constructor is required
26 /// by <see cref="XmlSerializer"/>.
27 /// </summary>
29 {
30 }
31
32 /// <summary>
33 /// Initializes a transport lane.
34 /// </summary>
35 /// <param name="origin">
36 /// Reference to the origin warehouse.
37 /// </param>
38 /// <param name="destination">
39 /// Reference to the destination warehouse.
40 /// </param>
41 /// <param name="id">Stable lane identifier.</param>
42 public TransportLane(int id, WarehouseReference origin, WarehouseReference destination)
43 {
44 Id = id;
45 Origin = origin;
46 Destination = destination;
47 }
48
49 /// <summary>
50 /// Gets or sets the origin warehouse.
51 /// </summary>
52 [XmlElement("origin")]
54 {
55 get => _origin;
56 set
57 {
58 // Validate that the origin warehouse reference is not null
59 ArgumentNullException.ThrowIfNull(value);
60
61 // Update the backing field and notify property change if value differs
62 SetProperty(
63 ref _origin,
64 value);
65 }
66 }
67
68 /// <summary>
69 /// Gets or sets the destination warehouse.
70 /// </summary>
71 [XmlElement("destination")]
73 {
74 get => _destination;
75 set
76 {
77 // Validate that the destination warehouse reference is not null
78 ArgumentNullException.ThrowIfNull(value);
79
80 // Update the backing field and notify property change if value differs
81 SetProperty(
82 ref _destination,
83 value);
84 }
85 }
86
87}
int Id
Gets or sets the numerical identifier of the entity.
IdentifiedEntity()
Initializes a new instance of the IdentifiedEntity class.
TransportLane()
Initializes an empty transport lane.
WarehouseReference Destination
Gets or sets the destination warehouse.
TransportLane(int id, WarehouseReference origin, WarehouseReference destination)
Initializes a transport lane.
WarehouseReference Origin
Gets or sets the origin warehouse.
Represents a serializable reference to a warehouse.