34 const daisi::material_flow::Order &getOrder()
const;
36 bool isOrigin()
const;
40 void setLastPosition(
const daisi::util::Position &position);
42 const daisi::util::Position &getLastPosition()
const;
48 daisi::material_flow::Order order_;
50 bool is_origin_ =
false;
51 daisi::util::Position position_;
57 void addWeight(
double weight) {
58 if (weight >= 0 && all_positive_) {
59 weights_.push_back(weight);
60 }
else if (weight <= 0 && !all_positive_) {
61 weights_.push_back(weight);
63 throw std::invalid_argument(
"Weight does not fit to the edge type");
67 double getWeight()
const {
69 return *std::max_element(weights_.begin(), weights_.end());
71 return *std::min_element(weights_.begin(), weights_.end());
74 void removeLastWeight() { weights_.pop_back(); }
76 int getNumberOfWeights()
const {
return weights_.size(); }
78 void updateWeight(
const int index,
const double &weight) {
79 if (index >= weights_.size()) {
80 throw std::invalid_argument(
"Index out of range");
83 if (weight >= 0 && all_positive_) {
84 weights_[index] = weight;
85 }
else if (weight < 0 && !all_positive_) {
86 weights_[index] = weight;
88 throw std::invalid_argument(
"Weight does not fit to the edge type");
93 std::vector<double> weights_;