From fedadc3af84110c4220f604e3775290d38987a74 Mon Sep 17 00:00:00 2001 From: "DSTO\\pivatom" Date: Tue, 18 Dec 2018 10:14:04 +1030 Subject: [PATCH] Add equals operator overload --- DecisionSystem/vote.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/DecisionSystem/vote.py b/DecisionSystem/vote.py index ff55df4..f5a5e47 100644 --- a/DecisionSystem/vote.py +++ b/DecisionSystem/vote.py @@ -1,7 +1,7 @@ from Messaging.packmessage import PackMessage class Vote(PackMessage): - def __init__(self, voter, vote): + def __init__(self, vote = None): self._vote = vote @property @@ -12,6 +12,13 @@ class Vote(PackMessage): def vote(self, value): self._vote = value + def __eq__(self, other): + if not isinstance(other, Vote): + return False + + if other.vote == self.vote: + return True + def serialise(self): # Still need associated device as well? to know who went the message,