From e904c97447f9ca15dc45294b9b980048e59ff4ec Mon Sep 17 00:00:00 2001 From: boufaras Date: Tue, 11 Jan 2011 14:29:29 +0000 Subject: [PATCH] add equals method git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2057 331e1502-861f-0410-8da2-ba01fb791d7f --- .../src/problems/permutation/moSwapNeighbor.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/trunk/paradiseo-mo/src/problems/permutation/moSwapNeighbor.h b/trunk/paradiseo-mo/src/problems/permutation/moSwapNeighbor.h index eb988cfed..1d1c7d9db 100644 --- a/trunk/paradiseo-mo/src/problems/permutation/moSwapNeighbor.h +++ b/trunk/paradiseo-mo/src/problems/permutation/moSwapNeighbor.h @@ -79,6 +79,17 @@ public: _second = indices.second; } + /** + * @param _neighbor a neighbor + * @return if _neighbor and this one are equals + */ + virtual bool equals(moSwapNeighbor& _neighbor) { + unsigned f, s; + _neighbor.getIndices(f, s); + return ((indices.first == f) && (indices.second == s) || (indices.first + == s) && (indices.second == f)); + } + /** * Print the Neighbor */