From 8abc5ecbed5d798e49a09f358d522e17e9abd0aa Mon Sep 17 00:00:00 2001 From: Romain BERNARD <romain.bernard@uca.fr> Date: Thu, 29 Feb 2024 12:58:53 +0100 Subject: [PATCH] add transit state comparator --- src/ShortestPath/Transit/TransitAlgorithmState.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/ShortestPath/Transit/TransitAlgorithmState.h b/src/ShortestPath/Transit/TransitAlgorithmState.h index 48707ee..6a6bf0f 100644 --- a/src/ShortestPath/Transit/TransitAlgorithmState.h +++ b/src/ShortestPath/Transit/TransitAlgorithmState.h @@ -139,6 +139,18 @@ public: && this->getConnections().size() > rhs.getConnections().size())); } + bool operator==(const TransitAlgorithmState& rhs) const { + return this->_nodeIndex == rhs.getNodeIndex() //same current node + && this->getInstant() == rhs.getInstant() + && this->getConnections().size() == rhs.getConnections().size(); + } + + bool operator!=(const TransitAlgorithmState& rhs) const { + return this->_nodeIndex != rhs.getNodeIndex() //same current node + || this->getInstant() != rhs.getInstant() + || this->getConnections().size() != rhs.getConnections().size(); + } + TransitAlgorithmState& operator=(const TransitAlgorithmState& baseState) { _nodeIndex = baseState.getNodeIndex(); _instant = baseState.getInstant(); -- GitLab