@@ -30,7 +30,7 @@ namespace dsm {
3030 std::optional<std::pair<double , double >> m_coords;
3131 std::string m_name;
3232 Size m_capacity;
33- Size m_transportCapacity;
33+ int m_transportCapacity;
3434
3535 public:
3636 // / @brief Construct a new Node object with capacity 1
@@ -79,7 +79,13 @@ namespace dsm {
7979 virtual void setCapacity (Size capacity) { m_capacity = capacity; }
8080 // / @brief Set the node's transport capacity
8181 // / @param capacity The node's transport capacity
82- virtual void setTransportCapacity (Size capacity) { m_transportCapacity = capacity; }
82+ virtual void setTransportCapacity (int capacity) {
83+ if (capacity < 1 ) {
84+ throw std::invalid_argument (buildLog (std::format (
85+ " The transport capacity of a node ({}) must be greater than 0." , capacity)));
86+ }
87+ m_transportCapacity = capacity;
88+ }
8389 // / @brief Get the node's id
8490 // / @return Id The node's id
8591 Id id () const { return m_id; }
@@ -94,7 +100,7 @@ namespace dsm {
94100 Size capacity () const { return m_capacity; }
95101 // / @brief Get the node's transport capacity
96102 // / @return Size The node's transport capacity
97- Size transportCapacity () const { return m_transportCapacity; }
103+ int transportCapacity () const { return m_transportCapacity; }
98104
99105 virtual double density () const = 0;
100106 virtual bool isFull () const = 0;
0 commit comments